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