pub struct PtraceDumper {
    pub pid: Pid,
    pub threads: Vec<Thread>,
    pub auxv: HashMap<u32, u32>,
    pub mappings: Vec<MappingInfo>,
    pub page_size: usize,
    /* private fields */
}

Fields§

§pid: Pid§threads: Vec<Thread>§auxv: HashMap<u32, u32>§mappings: Vec<MappingInfo>§page_size: usize

Implementations§

source§

impl PtraceDumper

source

pub fn new(pid: Pid, stop_timeout: Duration) -> Result<Self, InitError>

Constructs a dumper for extracting information of a given process with a process ID of |pid|.

source

pub fn init(&mut self, stop_timeout: Duration) -> Result<(), InitError>

source

pub fn late_init(&mut self) -> Result<(), InitError>

source

pub fn copy_from_process( child: Pid, src: *mut c_void, num_of_bytes: usize ) -> Result<Vec<u8>, DumperError>

Copies content of |length| bytes from a given process |child|, starting from |src|, into |dest|. This method uses ptrace to extract the content from the target process. Always returns true.

source

pub fn suspend_thread(child: Pid) -> Result<(), DumperError>

Suspends a thread by attaching to it.

source

pub fn resume_thread(child: Pid) -> Result<(), DumperError>

Resumes a thread by detaching from it.

source

pub fn suspend_threads(&mut self) -> Result<(), DumperError>

source

pub fn resume_threads(&mut self) -> Result<(), DumperError>

source

pub fn get_thread_info_by_index( &self, index: usize ) -> Result<ThreadInfo, ThreadInfoError>

Read thread info from /proc/$pid/status. Fill out the |tgid|, |ppid| and |pid| members of |info|. If unavailable, these members are set to -1. Returns true if all three members are available.

source

pub fn get_stack_info( &self, int_stack_pointer: usize ) -> Result<(usize, usize), DumperError>

source

pub fn sanitize_stack_copy( &self, stack_copy: &mut [u8], stack_pointer: usize, sp_offset: usize ) -> Result<(), DumperError>

source

pub fn find_mapping(&self, address: usize) -> Option<&MappingInfo>

source

pub fn find_mapping_no_bias(&self, address: usize) -> Option<&MappingInfo>

source

pub fn elf_file_identifier_from_mapped_file( mem_slice: &[u8] ) -> Result<Vec<u8>, DumperError>

source

pub fn elf_identifier_for_mapping_index( &mut self, idx: usize ) -> Result<Vec<u8>, DumperError>

source

pub fn elf_identifier_for_mapping( mapping: &mut MappingInfo, pid: Pid ) -> Result<Vec<u8>, DumperError>

Trait Implementations§

source§

impl Debug for PtraceDumper

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for PtraceDumper

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.