mod stopped_target; mod running_target; use crate::clibwrap; use nix::unistd::Pid; pub use running_target::*; pub use stopped_target::*; #[derive(thiserror::Error, Debug)] #[error("Error when calling ptrace: {0}")] pub struct PTraceError(#[from] nix::errno::Errno); #[derive(thiserror::Error, Debug)] #[error("Error when calling ptrace: {0}")] pub struct CustomPTraceError(#[from] clibwrap::ErrnoError); #[derive(thiserror::Error, Debug)] #[error("Error when waiting on child process: {0}")] pub struct WaitError(#[from] nix::errno::Errno); #[derive(thiserror::Error, Debug)] pub enum DebugError { #[error(transparent)] PTraceError(#[from] PTraceError), #[error(transparent)] CustomPTraceError(#[from] CustomPTraceError), #[error(transparent)] WaitError(#[from] WaitError), #[error("Child stopped with status {0:?}, but was not expecting to catch this one")] UnexpectedWaitStatus(nix::sys::wait::WaitStatus), #[error("Tried to insert a breakpoint at {address:#x} but one was already set for the same address")] DuplicateBreakpoint { address: u64 }, #[error("Reference a breakpoint at {address:#x}, but not breakpoint exists there")] NonExistingBreakpoint { address: u64 }, } pub struct ExitedTarget { pub exit_code: i32, pub was_pid: Pid, }