pub trait Tracer {
// Required method
fn trace(&self, pid: Pid) -> Result<i32>;
}Expand description
A trait for implementing ptrace-based process tracers.
Types implementing Tracer provide the logic to inspect and control a traced
process using the ptrace API. The primary extension point is the trace
method, which is invoked with the PID of the child process to be traced. This
allows custom tracing logic, such as system call inspection, breakpoint
handling, or binary instrumentation.
Required Methods§
Sourcefn trace(&self, pid: Pid) -> Result<i32>
fn trace(&self, pid: Pid) -> Result<i32>
Trace the execution of the process identified by pid.
Implementations should drive the ptrace-based inspection loop for the
child pid and return the process’s numeric exit/status code. This is
the primary extension point used by the library to perform binary
inspection.
§Arguments
pid- PID of the traced child process.
§Errors
Returns Err when any ptrace/wait/IO operation fails while tracing.
§Returns
Returns Ok(exit_code) where exit_code is the traced process’s
numeric exit status (or a signal-derived value). On failure an Err
value is returned.