Process

Trait Process 

Source
pub trait Process: Send {
Show 25 methods // Required methods fn state(&mut self) -> ProcessState; fn set_dtb(&mut self, dtb1: Address, dtb2: Address) -> Result<(), Error>; fn module_address_list_callback( &mut self, target_arch: Option<&ArchitectureIdent>, callback: OpaqueCallback<'_, ModuleAddressInfo>, ) -> Result<(), Error>; fn module_by_address( &mut self, address: Address, architecture: ArchitectureIdent, ) -> Result<ModuleInfo, Error>; fn primary_module_address(&mut self) -> Result<Address, Error>; fn module_import_list_callback( &mut self, info: &ModuleInfo, callback: OpaqueCallback<'_, ImportInfo>, ) -> Result<(), Error>; fn module_export_list_callback( &mut self, info: &ModuleInfo, callback: OpaqueCallback<'_, ExportInfo>, ) -> Result<(), Error>; fn module_section_list_callback( &mut self, info: &ModuleInfo, callback: OpaqueCallback<'_, SectionInfo>, ) -> Result<(), Error>; fn info(&self) -> &ProcessInfo; fn mapped_mem_range( &mut self, gap_size: i64, start: Address, end: Address, out: OpaqueCallback<'_, CTup3<Address, u64, PageType>>, ); // Provided methods fn module_list_callback( &mut self, target_arch: Option<&ArchitectureIdent>, callback: OpaqueCallback<'_, ModuleInfo>, ) -> Result<(), Error> { ... } fn module_by_name_arch( &mut self, name: &str, architecture: Option<&ArchitectureIdent>, ) -> Result<ModuleInfo, Error> { ... } fn module_by_name(&mut self, name: &str) -> Result<ModuleInfo, Error> { ... } fn module_list_arch( &mut self, target_arch: Option<&ArchitectureIdent>, ) -> Result<Vec<ModuleInfo>, Error> { ... } fn module_list(&mut self) -> Result<Vec<ModuleInfo>, Error> { ... } fn primary_module(&mut self) -> Result<ModuleInfo, Error> { ... } fn module_import_list( &mut self, info: &ModuleInfo, ) -> Result<Vec<ImportInfo>, Error> { ... } fn module_export_list( &mut self, info: &ModuleInfo, ) -> Result<Vec<ExportInfo>, Error> { ... } fn module_section_list( &mut self, info: &ModuleInfo, ) -> Result<Vec<SectionInfo>, Error> { ... } fn module_import_by_name( &mut self, info: &ModuleInfo, name: &str, ) -> Result<ImportInfo, Error> { ... } fn module_export_by_name( &mut self, info: &ModuleInfo, name: &str, ) -> Result<ExportInfo, Error> { ... } fn module_section_by_name( &mut self, info: &ModuleInfo, name: &str, ) -> Result<SectionInfo, Error> { ... } fn mapped_mem_range_vec( &mut self, gap_size: i64, start: Address, end: Address, ) -> Vec<CTup3<Address, u64, PageType>> { ... } fn mapped_mem( &mut self, gap_size: i64, out: OpaqueCallback<'_, CTup3<Address, u64, PageType>>, ) { ... } fn mapped_mem_vec( &mut self, gap_size: i64, ) -> Vec<CTup3<Address, u64, PageType>> { ... }
}
Expand description

Provides all actions on processes

This trait provides a lot of typical functionality for processes, such as memory access, module lists, and basic information.

Future expansions could include threads, keyboard input, and more.

Required Methods§

Source

fn state(&mut self) -> ProcessState

Retrieves the state of the process

Source

fn set_dtb(&mut self, dtb1: Address, dtb2: Address) -> Result<(), Error>

Changes the dtb this process uses for memory translations

§Remarks

In case the architecture only uses a single dtb for translation the second parameter should be set to Address::invalid().

Source

fn module_address_list_callback( &mut self, target_arch: Option<&ArchitectureIdent>, callback: OpaqueCallback<'_, ModuleAddressInfo>, ) -> Result<(), Error>

Walks the process’ module list and calls the provided callback for each module structure address

§Arguments
  • target_arch - sets which architecture to retrieve the modules for (if emulated). Choose between Some(ProcessInfo::sys_arch()), and Some(ProcessInfo::proc_arch()). None for all.
  • callback - where to pass each matching module to. This is an opaque callback.
Source

fn module_by_address( &mut self, address: Address, architecture: ArchitectureIdent, ) -> Result<ModuleInfo, Error>

Retrieves a module by its structure address and architecture

§Arguments
  • address - address where module’s information resides in
  • architecture - architecture of the module. Should be either ProcessInfo::proc_arch, or ProcessInfo::sys_arch.
Source

fn primary_module_address(&mut self) -> Result<Address, Error>

Retrieves address of the primary module structure of the process

This will generally be for the initial executable that was run

Source

fn module_import_list_callback( &mut self, info: &ModuleInfo, callback: OpaqueCallback<'_, ImportInfo>, ) -> Result<(), Error>

Retrieves a list of all imports of a given module

Source

fn module_export_list_callback( &mut self, info: &ModuleInfo, callback: OpaqueCallback<'_, ExportInfo>, ) -> Result<(), Error>

Retrieves a list of all exports of a given module

Source

fn module_section_list_callback( &mut self, info: &ModuleInfo, callback: OpaqueCallback<'_, SectionInfo>, ) -> Result<(), Error>

Retrieves a list of all sections of a given module

Source

fn info(&self) -> &ProcessInfo

Retrieves the process info

Source

fn mapped_mem_range( &mut self, gap_size: i64, start: Address, end: Address, out: OpaqueCallback<'_, CTup3<Address, u64, PageType>>, )

Provided Methods§

Source

fn module_list_callback( &mut self, target_arch: Option<&ArchitectureIdent>, callback: OpaqueCallback<'_, ModuleInfo>, ) -> Result<(), Error>

Walks the process’ module list and calls the provided callback for each module

§Arguments
  • target_arch - sets which architecture to retrieve the modules for (if emulated). Choose between Some(ProcessInfo::sys_arch()), and Some(ProcessInfo::proc_arch()). None for all.
  • callback - where to pass each matching module to. This is an opaque callback.
Source

fn module_by_name_arch( &mut self, name: &str, architecture: Option<&ArchitectureIdent>, ) -> Result<ModuleInfo, Error>

Finds a process module by its name under specified architecture

This function can be useful for quickly accessing a specific module

§Arguments
  • name - name of the module to find
  • architecture - architecture of the module. Should be either ProcessInfo::proc_arch, or ProcessInfo::sys_arch, or None for both.
Source

fn module_by_name(&mut self, name: &str) -> Result<ModuleInfo, Error>

Finds any architecture process module by its name

This function can be useful for quickly accessing a specific module

§Arguments
  • name - name of the module to find
Source

fn module_list_arch( &mut self, target_arch: Option<&ArchitectureIdent>, ) -> Result<Vec<ModuleInfo>, Error>

Retrieves a module list for the process

§Arguments
  • target_arch - sets which architecture to retrieve the modules for (if emulated). Choose between Some(ProcessInfo::sys_arch()), and Some(ProcessInfo::proc_arch()). None for all.
Source

fn module_list(&mut self) -> Result<Vec<ModuleInfo>, Error>

Retrieves a module list for the process

This is equivalent to Process::module_list_arch(None)

Source

fn primary_module(&mut self) -> Result<ModuleInfo, Error>

Retrieves information for the primary module of the process

This will generally be the initial executable that was run

Source

fn module_import_list( &mut self, info: &ModuleInfo, ) -> Result<Vec<ImportInfo>, Error>

Retrieves a list of all imports of a given module

Source

fn module_export_list( &mut self, info: &ModuleInfo, ) -> Result<Vec<ExportInfo>, Error>

Retrieves a list of all exports of a given module

Source

fn module_section_list( &mut self, info: &ModuleInfo, ) -> Result<Vec<SectionInfo>, Error>

Retrieves a list of all sections of a given module

Source

fn module_import_by_name( &mut self, info: &ModuleInfo, name: &str, ) -> Result<ImportInfo, Error>

Finds a single import of a given module by its name

Source

fn module_export_by_name( &mut self, info: &ModuleInfo, name: &str, ) -> Result<ExportInfo, Error>

Finds a single export of a given module by its name

Source

fn module_section_by_name( &mut self, info: &ModuleInfo, name: &str, ) -> Result<SectionInfo, Error>

Finds a single section of a given module by its name

Source

fn mapped_mem_range_vec( &mut self, gap_size: i64, start: Address, end: Address, ) -> Vec<CTup3<Address, u64, PageType>>

Source

fn mapped_mem( &mut self, gap_size: i64, out: OpaqueCallback<'_, CTup3<Address, u64, PageType>>, )

Source

fn mapped_mem_vec( &mut self, gap_size: i64, ) -> Vec<CTup3<Address, u64, PageType>>

Implementors§

Source§

impl<'cglue_a, CGlueO> Process for CGlueO
where CGlueO: 'cglue_a + GetContainer + GetVtbl<ProcessVtbl<'cglue_a, <CGlueO as GetContainer>::ContType>> + Send + ProcessOpaqueObj<'cglue_a>, ProcessVtbl<'cglue_a, <CGlueO as GetContainer>::ContType>: StableAbi,