nu_protocol::debugger::debugger_trait

Trait Debugger

Source
pub trait Debugger: Send + Debug {
    // Provided methods
    fn activate(&mut self) { ... }
    fn deactivate(&mut self) { ... }
    fn enter_block(&mut self, engine_state: &EngineState, block: &Block) { ... }
    fn leave_block(&mut self, engine_state: &EngineState, block: &Block) { ... }
    fn enter_element(
        &mut self,
        engine_state: &EngineState,
        pipeline_element: &PipelineElement,
    ) { ... }
    fn leave_element(
        &mut self,
        engine_state: &EngineState,
        element: &PipelineElement,
        result: &Result<PipelineData, ShellError>,
    ) { ... }
    fn enter_instruction(
        &mut self,
        engine_state: &EngineState,
        ir_block: &IrBlock,
        instruction_index: usize,
        registers: &[PipelineData],
    ) { ... }
    fn leave_instruction(
        &mut self,
        engine_state: &EngineState,
        ir_block: &IrBlock,
        instruction_index: usize,
        registers: &[PipelineData],
        error: Option<&ShellError>,
    ) { ... }
    fn report(
        &self,
        engine_state: &EngineState,
        debugger_span: Span,
    ) -> Result<Value, ShellError> { ... }
}
Expand description

Debugger trait that every debugger needs to implement.

By default, its methods are empty. Not every Debugger needs to implement all of them.

Provided Methods§

Source

fn activate(&mut self)

Called by EngineState::activate_debugger().

Intended for initializing the debugger.

Source

fn deactivate(&mut self)

Called by EngineState::deactivate_debugger().

Intended for wrapping up the debugger after a debugging session before returning back to normal evaluation without debugging.

Source

fn enter_block(&mut self, engine_state: &EngineState, block: &Block)

Called when the evaluator enters a block

Source

fn leave_block(&mut self, engine_state: &EngineState, block: &Block)

Called when the evaluator leaves a block

Source

fn enter_element( &mut self, engine_state: &EngineState, pipeline_element: &PipelineElement, )

Called when the AST evaluator enters a pipeline element

Source

fn leave_element( &mut self, engine_state: &EngineState, element: &PipelineElement, result: &Result<PipelineData, ShellError>, )

Called when the AST evaluator leaves a pipeline element

Source

fn enter_instruction( &mut self, engine_state: &EngineState, ir_block: &IrBlock, instruction_index: usize, registers: &[PipelineData], )

Called before the IR evaluator runs an instruction

Source

fn leave_instruction( &mut self, engine_state: &EngineState, ir_block: &IrBlock, instruction_index: usize, registers: &[PipelineData], error: Option<&ShellError>, )

Called after the IR evaluator runs an instruction

Source

fn report( &self, engine_state: &EngineState, debugger_span: Span, ) -> Result<Value, ShellError>

Create a final report as a Value

Intended to be called after deactivate()

Implementors§