pub struct PtraceState {
pub core_state: PtraceCoreState,
pub tracee_waiters: WaitQueue,
pub last_signal: Option<SignalInfo>,
pub last_signal_waitable: bool,
pub event_data: Option<PtraceEventData>,
pub stop_status: PtraceStatus,
pub last_syscall_was_error: bool,
}Expand description
Per-task ptrace-related state
Fields§
§core_state: PtraceCoreStateThe core state of the tracer, which can be shared between processes
tracee_waiters: WaitQueueThe tracee waits on this WaitQueue to find out when it should stop or wake for ptrace-related shenanigans.
last_signal: Option<SignalInfo>The signal that caused the task to enter the given state (for signal-delivery-stop)
last_signal_waitable: boolWhether waitpid() will return the last signal. The presence of last_signal can’t be used for that, because that needs to be saved for GETSIGINFO.
event_data: Option<PtraceEventData>Data about the PTRACE_EVENT that caused the most recent stop (if any).
stop_status: PtraceStatusIndicates whether the last ptrace call put this thread into a state with special semantics for stopping behavior.
last_syscall_was_error: boolFor SYSCALL_INFO_EXIT
Implementations§
Source§impl PtraceState
impl PtraceState
pub fn new( pid: pid_t, attach_type: PtraceAttachType, options: PtraceOptions, ) -> Box<Self>
pub fn get_pid(&self) -> pid_t
pub fn set_pid(&mut self, pid: pid_t)
pub fn is_seized(&self) -> bool
pub fn get_attach_type(&self) -> PtraceAttachType
pub fn is_waitable(&self, stop: StopState, options: &WaitingOptions) -> bool
pub fn set_last_signal(&mut self, signal: Option<SignalInfo>)
pub fn set_last_event(&mut self, event: Option<PtraceEventData>)
pub fn get_last_signal( &mut self, keep_signal_waitable: bool, ) -> Option<SignalInfo>
pub fn has_option(&self, option: PtraceOptions) -> bool
pub fn set_options_from_bits(&mut self, option: u32) -> Result<(), Errno>
pub fn get_options(&self) -> PtraceOptions
Sourcepub fn get_core_state(&self) -> PtraceCoreState
pub fn get_core_state(&self) -> PtraceCoreState
Returns enough of the ptrace state to propagate it to a fork / clone / vforked task.
pub fn tracer_waiters(&self) -> &Arc<WaitQueue>
Sourcepub fn get_target_syscall(
&self,
target: &Task,
state: &TaskMutableState,
) -> Result<(i32, ptrace_syscall_info), Errno>
pub fn get_target_syscall( &self, target: &Task, state: &TaskMutableState, ) -> Result<(i32, ptrace_syscall_info), Errno>
Returns an (i32, ptrace_syscall_info) pair. The ptrace_syscall_info is the info associated with the syscall that the target task is currently blocked on, The i32 is (per ptrace(2)) “the number of bytes available to be written by the kernel. If the size of the data to be written by the kernel exceeds the size specified by the addr argument, the output data is truncated.”; ptrace(PTRACE_GET_SYSCALL_INFO) returns that value“
Sourcepub fn get_core_state_for_clone(
&self,
clone_args: &clone_args,
) -> (PtraceOptions, Option<PtraceCoreState>)
pub fn get_core_state_for_clone( &self, clone_args: &clone_args, ) -> (PtraceOptions, Option<PtraceCoreState>)
Gets the core state for this ptrace if the options set on this ptrace match |trace_kind|. Returns a pair: the trace option you should use (sometimes this is different from the one that the caller thinks it should use), and the core state.
Auto Trait Implementations§
impl Freeze for PtraceState
impl !RefUnwindSafe for PtraceState
impl Send for PtraceState
impl Sync for PtraceState
impl Unpin for PtraceState
impl !UnwindSafe for PtraceState
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, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
T to [Self]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 more