pub struct PrintDebugger {
pub source_map: SourceMap<String>,
pub stack: bool,
pub stack_bytes: bool,
pub visit_stack: bool,
pub registers: bool,
pub registers_bytes: bool,
pub visit_registers: bool,
pub operation_details: bool,
pub step_through: bool,
pub mode: PrintDebuggerMode,
/* private fields */
}Expand description
A debugger that prints every step to standard output.
Everything is off by default, so a bare PrintDebugger only announces the
scopes and operations it passes. Turn the parts you want on with the builder
methods, or start from PrintDebugger::full.
A value on the stack or in a register is only printed as a value when its
type was registered with PrintDebugger::printable or one of its
siblings. Anything else is printed as raw bytes.
Fields§
§source_map: SourceMap<String>Names the printed places after the original source.
stack: boolPrint how many bytes the stack holds.
stack_bytes: boolPrint the raw bytes of the stack.
visit_stack: boolPrint each value on the stack, one by one.
registers: boolPrint the register count and the scope barriers.
registers_bytes: boolPrint the raw bytes of the register storage.
visit_registers: boolPrint each register, one by one.
operation_details: boolPrint the whole operation rather than only its name.
step_through: boolWait for a line on standard input after every printout.
mode: PrintDebuggerModeWhen to print around an operation or a scope.
Implementations§
Source§impl PrintDebugger
impl PrintDebugger
Sourcepub fn full() -> PrintDebugger
pub fn full() -> PrintDebugger
A debugger with everything turned on, step_through included.
Sourcepub fn stack(self, mode: bool) -> PrintDebugger
pub fn stack(self, mode: bool) -> PrintDebugger
Sets PrintDebugger::stack, builder style.
Sourcepub fn stack_bytes(self, mode: bool) -> PrintDebugger
pub fn stack_bytes(self, mode: bool) -> PrintDebugger
Sets PrintDebugger::stack_bytes, builder style.
Sourcepub fn visit_stack(self, mode: bool) -> PrintDebugger
pub fn visit_stack(self, mode: bool) -> PrintDebugger
Sets PrintDebugger::visit_stack, builder style.
Sourcepub fn registers(self, mode: bool) -> PrintDebugger
pub fn registers(self, mode: bool) -> PrintDebugger
Sets PrintDebugger::registers, builder style.
Sourcepub fn registers_bytes(self, mode: bool) -> PrintDebugger
pub fn registers_bytes(self, mode: bool) -> PrintDebugger
Sets PrintDebugger::registers_bytes, builder style.
Sourcepub fn visit_registers(self, mode: bool) -> PrintDebugger
pub fn visit_registers(self, mode: bool) -> PrintDebugger
Sets PrintDebugger::visit_registers, builder style.
Sourcepub fn operation_details(self, mode: bool) -> PrintDebugger
pub fn operation_details(self, mode: bool) -> PrintDebugger
Sets PrintDebugger::operation_details, builder style.
Sourcepub fn step_through(self, mode: bool) -> PrintDebugger
pub fn step_through(self, mode: bool) -> PrintDebugger
Sets PrintDebugger::step_through, builder style.
With it on, every printout waits for a line on standard input, so the script only moves when you press enter.
Sourcepub fn mode(self, mode: PrintDebuggerMode) -> PrintDebugger
pub fn mode(self, mode: PrintDebuggerMode) -> PrintDebugger
Sets PrintDebugger::mode, builder style.
Sourcepub fn printable<T>(self) -> PrintDebuggerwhere
T: Debug + 'static,
pub fn printable<T>(self) -> PrintDebuggerwhere
T: Debug + 'static,
Prints values of type T with their Debug output.
Sourcepub fn printable_custom<T>(
self,
f: impl Fn(&PrintDebugger, &T) -> String + Send + Sync + 'static,
) -> PrintDebuggerwhere
T: 'static,
pub fn printable_custom<T>(
self,
f: impl Fn(&PrintDebugger, &T) -> String + Send + Sync + 'static,
) -> PrintDebuggerwhere
T: 'static,
Prints values of type T with a function of your own.
Sourcepub fn printable_raw<T>(
self,
f: impl Fn(&PrintDebugger, *const ()) -> String + Send + Sync + 'static,
) -> PrintDebuggerwhere
T: 'static,
pub fn printable_raw<T>(
self,
f: impl Fn(&PrintDebugger, *const ()) -> String + Send + Sync + 'static,
) -> PrintDebuggerwhere
T: 'static,
PrintDebugger::printable_custom with the value as a raw pointer.
For a type that cannot be named as a Rust reference here. The pointer
given to f holds a value of T.
Sourcepub fn basic_printables(self) -> PrintDebugger
pub fn basic_printables(self) -> PrintDebugger
Sourcepub fn display<T>(&self, data: &T) -> Option<(&'static str, String)>
pub fn display<T>(&self, data: &T) -> Option<(&'static str, String)>
Formats data with what was registered for its type.
Returns the type name and the text, or None when the type was never
registered as printable.
Sourcepub fn display_raw(
&self,
type_hash: TypeHash,
pointer: *const (),
) -> Option<(&'static str, String)>
pub fn display_raw( &self, type_hash: TypeHash, pointer: *const (), ) -> Option<(&'static str, String)>
PrintDebugger::display for a value whose type is only known at
runtime.
pointer must hold a value of the type named by type_hash, which is
what the caller has to get right.