pub struct ScriptDebugger {
pub state: DebuggerState,
pub coverage: CoverageTracker,
pub pause_events: Vec<(usize, String)>,
}Expand description
Wraps VM execution with pre-instruction hooks.
Fields§
§state: DebuggerState§coverage: CoverageTracker§pause_events: Vec<(usize, String)>Collected pause events (ip, chunk_name).
Implementations§
Source§impl ScriptDebugger
impl ScriptDebugger
pub fn new() -> Self
Sourcepub fn execute(
&mut self,
vm: &mut Vm,
chunk: Arc<Chunk>,
) -> Result<Vec<Value>, ScriptError>
pub fn execute( &mut self, vm: &mut Vm, chunk: Arc<Chunk>, ) -> Result<Vec<Value>, ScriptError>
Execute a chunk, checking breakpoints at each instruction. Returns (result, paused_at) where paused_at contains events if a breakpoint fired. In a real interactive debugger this would suspend; here we collect events and continue.
Sourcepub fn pre_instruction(
&mut self,
ip: usize,
chunk_name: &str,
depth: usize,
) -> bool
pub fn pre_instruction( &mut self, ip: usize, chunk_name: &str, depth: usize, ) -> bool
Simulate pre-instruction hook called by the VM main loop. Returns true if execution should pause.
pub fn step_in(&mut self)
pub fn step_over(&mut self, current_depth: usize)
pub fn step_out(&mut self, current_depth: usize)
pub fn resume(&mut self)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ScriptDebugger
impl RefUnwindSafe for ScriptDebugger
impl Send for ScriptDebugger
impl Sync for ScriptDebugger
impl Unpin for ScriptDebugger
impl UnsafeUnpin for ScriptDebugger
impl UnwindSafe for ScriptDebugger
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.