Skip to main content

trace_with

Function trace_with 

Source
pub fn trace_with(
    context: &Tracer,
    process: &Info,
    state: State<'_>,
    print: impl PrintFn,
    progress: impl ProgressFn,
) -> Result<i32>
Expand description

Traces the execution of a process and prints the instructions being executed.

This function owns the tracer loop: it drives the traced child using ptrace, restores and manages breakpoints, decodes instructions with the provided Tracer, and uses the supplied print and progress callbacks to render output and update the tracing UI.

§Arguments

  • context - The Tracer instance used to decode instructions and hold tracer-local resources (e.g., an asm::Parser).
  • process - The process::Info describing the traced process (provides PID, sections, entry point, etc.).
  • state - A progress::State instance which holds runtime tracing state such as breakpoints, layout, and execution mode.
  • print - A printing callback used to render a single asm::Instruction.
  • progress - A progress/update callback invoked each trace iteration to update UI state and possibly change tracing behavior.

§Errors

Returns an Err if any underlying operation fails: ELF/DWARF parsing, ptrace/syscall errors, register reads/writes, or instruction decoding.

§Returns

Returns Ok(exit_code) where exit_code is the child’s exit status when tracing finishes, or an Err on failure.