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- TheTracerinstance used to decode instructions and hold tracer-local resources (e.g., anasm::Parser).process- Theprocess::Infodescribing the traced process (provides PID, sections, entry point, etc.).state- Aprogress::Stateinstance which holds runtime tracing state such as breakpoints, layout, and execution mode.print- A printing callback used to render a singleasm::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.