pub struct Debugger { /* private fields */ }Expand description
Main structure of bug-stalker, control debugee state and provides application functionality.
Implementations§
Source§impl Debugger
impl Debugger
pub fn async_backtrace(&mut self) -> Result<AsyncBacktrace, Error>
pub fn async_step_over(&mut self) -> Result<(), Error>
Sourcepub fn async_step_out(&mut self) -> Result<(), Error>
pub fn async_step_out(&mut self) -> Result<(), Error>
Wait for current task ends.
Source§impl Debugger
impl Debugger
Sourcepub fn set_breakpoint_at_addr(
&mut self,
addr: RelocatedAddress,
) -> Result<BreakpointView<'_>, Error>
pub fn set_breakpoint_at_addr( &mut self, addr: RelocatedAddress, ) -> Result<BreakpointView<'_>, Error>
Sourcepub fn remove_breakpoint(
&mut self,
addr: Address,
) -> Result<Option<BreakpointView<'_>>, Error>
pub fn remove_breakpoint( &mut self, addr: Address, ) -> Result<Option<BreakpointView<'_>>, Error>
Sourcepub fn remove_breakpoint_by_number(
&mut self,
number: u32,
) -> Result<Option<BreakpointView<'_>>, Error>
pub fn remove_breakpoint_by_number( &mut self, number: u32, ) -> Result<Option<BreakpointView<'_>>, Error>
Sourcepub fn remove_breakpoints_at_addresses(
&mut self,
addresses: impl Iterator<Item = Address>,
) -> Result<Vec<BreakpointView<'_>>, Error>
pub fn remove_breakpoints_at_addresses( &mut self, addresses: impl Iterator<Item = Address>, ) -> Result<Vec<BreakpointView<'_>>, Error>
Remove breakpoint from instruction.
§Arguments
addresses: address of instruction where breakpoint may be found.
Sourcepub fn set_breakpoint_at_fn(
&mut self,
template: &str,
) -> Result<Vec<BreakpointView<'_>>, Error>
pub fn set_breakpoint_at_fn( &mut self, template: &str, ) -> Result<Vec<BreakpointView<'_>>, Error>
Create and enable breakpoint at debugee address space on the following function start.
§Arguments
template: template for searchin functions where debugee must be stopped
§Errors
Return [SetupError::PlaceNotFound] if function not found,
return [BreakpointError::DebugInformation] if errors occur while fetching debug information.
Sourcepub fn remove_breakpoint_at_fn(
&mut self,
template: &str,
) -> Result<Vec<BreakpointView<'_>>, Error>
pub fn remove_breakpoint_at_fn( &mut self, template: &str, ) -> Result<Vec<BreakpointView<'_>>, Error>
Disable and remove breakpoint from function start.
§Arguments
template: template for searchin functions where breakpoints must be deleted
Sourcepub fn set_breakpoint_at_line(
&mut self,
fine_path_tpl: &str,
line: u64,
) -> Result<Vec<BreakpointView<'_>>, Error>
pub fn set_breakpoint_at_line( &mut self, fine_path_tpl: &str, line: u64, ) -> Result<Vec<BreakpointView<'_>>, Error>
Sourcepub fn remove_breakpoint_at_line(
&mut self,
fine_name_tpl: &str,
line: u64,
) -> Result<Vec<BreakpointView<'_>>, Error>
pub fn remove_breakpoint_at_line( &mut self, fine_name_tpl: &str, line: u64, ) -> Result<Vec<BreakpointView<'_>>, Error>
Disable and remove breakpoint at the following file and line number.
§Arguments
fine_name: file name (ex: “main.rs”)line: line number
Sourcepub fn set_transparent_breakpoint(
&mut self,
request: CreateTransparentBreakpointRequest,
) -> Result<(), Error>
pub fn set_transparent_breakpoint( &mut self, request: CreateTransparentBreakpointRequest, ) -> Result<(), Error>
Sourcepub fn breakpoints_snapshot(&self) -> Vec<BreakpointView<'_>>
pub fn breakpoints_snapshot(&self) -> Vec<BreakpointView<'_>>
Return list of breakpoints.
Sourcepub fn add_deferred_at_addr(&mut self, addr: RelocatedAddress)
pub fn add_deferred_at_addr(&mut self, addr: RelocatedAddress)
Add new deferred breakpoint by address in debugee address space.
Sourcepub fn add_deferred_at_function(&mut self, function: &str)
pub fn add_deferred_at_function(&mut self, function: &str)
Add new deferred breakpoint by function name.
Sourcepub fn add_deferred_at_line(&mut self, file: &str, line: u64)
pub fn add_deferred_at_line(&mut self, file: &str, line: u64)
Add new deferred breakpoint by file and line.
Sourcepub fn refresh_deferred(&mut self) -> Vec<Error>
pub fn refresh_deferred(&mut self) -> Vec<Error>
Refresh deferred breakpoints. Trying to set breakpoint if success - remove breakpoint from a deferred list.
Source§impl Debugger
impl Debugger
Sourcepub fn set_watchpoint_on_expr(
&mut self,
expr_source: &str,
dqe: Dqe,
condition: BreakCondition,
) -> Result<WatchpointView<'_>, Error>
pub fn set_watchpoint_on_expr( &mut self, expr_source: &str, dqe: Dqe, condition: BreakCondition, ) -> Result<WatchpointView<'_>, Error>
Set a new watchpoint on a result of DQE.
§Arguments
expr_source: expression stringdqe: DQEcondition: condition for activating a watchpoint
Sourcepub fn set_watchpoint_on_memory(
&mut self,
addr: RelocatedAddress,
size: BreakSize,
condition: BreakCondition,
temporary: bool,
) -> Result<WatchpointView<'_>, Error>
pub fn set_watchpoint_on_memory( &mut self, addr: RelocatedAddress, size: BreakSize, condition: BreakCondition, temporary: bool, ) -> Result<WatchpointView<'_>, Error>
Set a new watchpoint on a memory location
§Arguments
addr: address in debugee memorysize: size of debugee memory locationcondition: condition for activating a watchpoint
Sourcepub fn remove_watchpoint_by_number(
&mut self,
num: u32,
) -> Result<Option<WatchpointView<'_>>, Error>
pub fn remove_watchpoint_by_number( &mut self, num: u32, ) -> Result<Option<WatchpointView<'_>>, Error>
Sourcepub fn remove_watchpoint_by_addr(
&mut self,
addr: RelocatedAddress,
) -> Result<Option<WatchpointView<'_>>, Error>
pub fn remove_watchpoint_by_addr( &mut self, addr: RelocatedAddress, ) -> Result<Option<WatchpointView<'_>>, Error>
Sourcepub fn remove_watchpoint_by_expr(
&mut self,
dqe: Dqe,
) -> Result<Option<WatchpointView<'_>>, Error>
pub fn remove_watchpoint_by_expr( &mut self, dqe: Dqe, ) -> Result<Option<WatchpointView<'_>>, Error>
Sourcepub fn watchpoint_list(&self) -> Vec<WatchpointView<'_>>
pub fn watchpoint_list(&self) -> Vec<WatchpointView<'_>>
Return a list of all watchpoints.
Source§impl Debugger
impl Debugger
Sourcepub fn get_oracle(&self, name: &str) -> Option<&dyn Oracle>
pub fn get_oracle(&self, name: &str) -> Option<&dyn Oracle>
Sourcepub fn get_oracle_arc(&self, name: &str) -> Option<Arc<dyn Oracle>>
pub fn get_oracle_arc(&self, name: &str) -> Option<Arc<dyn Oracle>>
Same as get_oracle but return an Arc<dyn Oracle>
Sourcepub fn all_oracles(&self) -> impl Iterator<Item = &dyn Oracle>
pub fn all_oracles(&self) -> impl Iterator<Item = &dyn Oracle>
Return all oracles.
Sourcepub fn all_oracles_arc(&self) -> impl Iterator<Item = Arc<dyn Oracle>> + '_
pub fn all_oracles_arc(&self) -> impl Iterator<Item = Arc<dyn Oracle>> + '_
Same as all_oracles but return iterator over Arc<dyn Oracle>
pub fn process(&self) -> &Child<Installed>
pub fn set_hook(&mut self, hooks: impl EventHook + 'static)
Sourcepub fn ecx(&self) -> &ExplorationContext
pub fn ecx(&self) -> &ExplorationContext
Return last set exploration context.
Sourcepub fn restart_debugee(&mut self) -> Result<Pid, Error>
pub fn restart_debugee(&mut self) -> Result<Pid, Error>
Restart debugee by recreating debugee process, save all user-defined breakpoints. Return when new debugee stopped or ends.
! change exploration context
Sourcepub fn start_debugee(&mut self) -> Result<(), Error>
pub fn start_debugee(&mut self) -> Result<(), Error>
Start and execute debugee. Return when debugee stopped or ends.
§Errors
Return error if debugee already run or execution fails.
Sourcepub fn start_debugee_force(&mut self) -> Result<(), Error>
pub fn start_debugee_force(&mut self) -> Result<(), Error>
Start and execute debugee. Restart if debugee already started. Return when debugee stopped or ends.
Sourcepub fn dry_start_debugee(&mut self) -> Result<(), Error>
pub fn dry_start_debugee(&mut self) -> Result<(), Error>
Sourcepub fn continue_debugee(&mut self) -> Result<(), Error>
pub fn continue_debugee(&mut self) -> Result<(), Error>
Continue debugee execution.
Sourcepub fn frame_info(&self) -> Result<FrameInfo, Error>
pub fn frame_info(&self) -> Result<FrameInfo, Error>
Return in focus frame information.
Sourcepub fn step_into(&mut self) -> Result<(), Error>
pub fn step_into(&mut self) -> Result<(), Error>
Do a single step (until debugee reaches a different source line).
! change exploration context
Sourcepub fn stepi(&mut self) -> Result<(), Error>
pub fn stepi(&mut self) -> Result<(), Error>
Move in focus thread to the next instruction.
! change exploration context
Sourcepub fn thread_state(&self) -> Result<Vec<ThreadSnapshot>, Error>
pub fn thread_state(&self) -> Result<Vec<ThreadSnapshot>, Error>
Return list of currently running debugee threads.
Sourcepub fn read_memory(&self, addr: usize, read_n: usize) -> Result<Vec<u8>, Error>
pub fn read_memory(&self, addr: usize, read_n: usize) -> Result<Vec<u8>, Error>
Read N bytes from a debugee process.
§Arguments
addr: address in debugee address space where readsread_n: read byte count
Sourcepub fn write_memory(
&self,
addr: uintptr_t,
value: uintptr_t,
) -> Result<(), Error>
pub fn write_memory( &self, addr: uintptr_t, value: uintptr_t, ) -> Result<(), Error>
Write sizeof(uintptr_t) bytes in debugee address space. Note that little endian byte order will be used when writing.
§Arguments
addr: address to writevalue: value to write
Sourcepub fn read_local_variables(&self) -> Result<Vec<QueryResult<'_>>, Error>
pub fn read_local_variables(&self) -> Result<Vec<QueryResult<'_>>, Error>
Reads all local variables from current function in current thread.
Sourcepub fn read_variable(
&self,
select_expr: Dqe,
) -> Result<Vec<QueryResult<'_>>, Error>
pub fn read_variable( &self, select_expr: Dqe, ) -> Result<Vec<QueryResult<'_>>, Error>
Reads any variable from the current thread, uses a select expression to filter variables and fetch their properties (such as structure fields or array elements).
§Arguments
select_expr: data query expression
Sourcepub fn read_variable_names(
&self,
select_expr: Dqe,
) -> Result<Vec<String>, Error>
pub fn read_variable_names( &self, select_expr: Dqe, ) -> Result<Vec<String>, Error>
Reads any variable from the current thread, uses a select expression to filter variables and return their names.
§Arguments
select_expr: data query expression
Sourcepub fn read_argument(
&self,
select_expr: Dqe,
) -> Result<Vec<QueryResult<'_>>, Error>
pub fn read_argument( &self, select_expr: Dqe, ) -> Result<Vec<QueryResult<'_>>, Error>
Reads any argument from the current function, uses a select expression to filter variables and fetch their properties (such as structure fields or array elements).
§Arguments
select_expr: data query expression
Sourcepub fn read_argument_names(
&self,
select_expr: Dqe,
) -> Result<Vec<String>, Error>
pub fn read_argument_names( &self, select_expr: Dqe, ) -> Result<Vec<String>, Error>
Reads any argument from the current function, uses a select expression to filter arguments and return their names.
§Arguments
select_expr: data query expression
Sourcepub fn current_thread_registers_at_pc(
&self,
pc: RelocatedAddress,
) -> Result<DwarfRegisterMap, Error>
pub fn current_thread_registers_at_pc( &self, pc: RelocatedAddress, ) -> Result<DwarfRegisterMap, Error>
Return registers dump for on focus thread at instruction defined by pc.
§Arguments
pc: program counter value
Sourcepub fn known_files(&self) -> impl Iterator<Item = &PathBuf>
pub fn known_files(&self) -> impl Iterator<Item = &PathBuf>
Return list of known files income from dwarf parser.
Return a list of shared libraries.
Sourcepub fn disasm(&self) -> Result<FunctionAssembly, Error>
pub fn disasm(&self) -> Result<FunctionAssembly, Error>
Return a list of disassembled instruction for a function in focus.
Sourcepub fn current_function_range(&self) -> Result<FunctionRange<'_>, Error>
pub fn current_function_range(&self) -> Result<FunctionRange<'_>, Error>
Return two place descriptors, at the start and at the end of the current function.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Debugger
impl !RefUnwindSafe for Debugger
impl !Send for Debugger
impl !Sync for Debugger
impl Unpin for Debugger
impl !UnwindSafe for Debugger
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);