fuel_vm/interpreter/executors/
debug.rs

1use crate::{
2    error::InterpreterError,
3    interpreter::{
4        EcalHandler,
5        ExecutableTransaction,
6        Interpreter,
7        Memory,
8    },
9    state::ProgramState,
10    storage::InterpreterStorage,
11};
12
13impl<M, S, Tx, Ecal> Interpreter<M, S, Tx, Ecal>
14where
15    M: Memory,
16    S: InterpreterStorage,
17    Tx: ExecutableTransaction,
18    Ecal: EcalHandler,
19{
20    /// Continue the execution from a previously interrupted program flow.
21    pub fn resume(&mut self) -> Result<ProgramState, InterpreterError<S::DataError>> {
22        let state = self
23            .debugger_last_state()
24            .ok_or(InterpreterError::DebugStateNotInitialized)?;
25
26        let state = match state {
27            ProgramState::Return(w) => Ok(ProgramState::Return(w)),
28
29            ProgramState::ReturnData(d) => Ok(ProgramState::ReturnData(d)),
30
31            ProgramState::Revert(w) => Ok(ProgramState::Revert(w)),
32
33            ProgramState::RunProgram(_) => self.run_program(),
34
35            ProgramState::VerifyPredicate(_) => unimplemented!(),
36        }?;
37
38        if state.is_debug() {
39            self.debugger_set_last_state(state);
40        }
41
42        Ok(state)
43    }
44}