pub trait Process: Send {
Show 25 methods
// Required methods
fn state(&mut self) -> ProcessState;
fn set_dtb(&mut self, dtb1: Address, dtb2: Address) -> Result<()>;
fn module_address_list_callback(
&mut self,
target_arch: Option<&ArchitectureIdent>,
callback: ModuleAddressCallback<'_>
) -> Result<()>;
fn module_by_address(
&mut self,
address: Address,
architecture: ArchitectureIdent
) -> Result<ModuleInfo>;
fn primary_module_address(&mut self) -> Result<Address>;
fn module_import_list_callback(
&mut self,
info: &ModuleInfo,
callback: ImportCallback<'_>
) -> Result<()>;
fn module_export_list_callback(
&mut self,
info: &ModuleInfo,
callback: ExportCallback<'_>
) -> Result<()>;
fn module_section_list_callback(
&mut self,
info: &ModuleInfo,
callback: SectionCallback<'_>
) -> Result<()>;
fn info(&self) -> &ProcessInfo;
fn mapped_mem_range(
&mut self,
gap_size: imem,
start: Address,
end: Address,
out: MemoryRangeCallback<'_>
);
// Provided methods
fn module_list_callback(
&mut self,
target_arch: Option<&ArchitectureIdent>,
callback: ModuleInfoCallback<'_>
) -> Result<()> { ... }
fn module_by_name_arch(
&mut self,
name: &str,
architecture: Option<&ArchitectureIdent>
) -> Result<ModuleInfo> { ... }
fn module_by_name(&mut self, name: &str) -> Result<ModuleInfo> { ... }
fn module_list_arch(
&mut self,
target_arch: Option<&ArchitectureIdent>
) -> Result<Vec<ModuleInfo>> { ... }
fn module_list(&mut self) -> Result<Vec<ModuleInfo>> { ... }
fn primary_module(&mut self) -> Result<ModuleInfo> { ... }
fn module_import_list(
&mut self,
info: &ModuleInfo
) -> Result<Vec<ImportInfo>> { ... }
fn module_export_list(
&mut self,
info: &ModuleInfo
) -> Result<Vec<ExportInfo>> { ... }
fn module_section_list(
&mut self,
info: &ModuleInfo
) -> Result<Vec<SectionInfo>> { ... }
fn module_import_by_name(
&mut self,
info: &ModuleInfo,
name: &str
) -> Result<ImportInfo> { ... }
fn module_export_by_name(
&mut self,
info: &ModuleInfo,
name: &str
) -> Result<ExportInfo> { ... }
fn module_section_by_name(
&mut self,
info: &ModuleInfo,
name: &str
) -> Result<SectionInfo> { ... }
fn mapped_mem_range_vec(
&mut self,
gap_size: imem,
start: Address,
end: Address
) -> Vec<MemoryRange> { ... }
fn mapped_mem(&mut self, gap_size: imem, out: MemoryRangeCallback<'_>) { ... }
fn mapped_mem_vec(&mut self, gap_size: imem) -> Vec<MemoryRange> { ... }
}
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§
sourcefn state(&mut self) -> ProcessState
fn state(&mut self) -> ProcessState
Retrieves the state of the process
sourcefn set_dtb(&mut self, dtb1: Address, dtb2: Address) -> Result<()>
fn set_dtb(&mut self, dtb1: Address, dtb2: Address) -> Result<()>
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()
.
sourcefn module_address_list_callback(
&mut self,
target_arch: Option<&ArchitectureIdent>,
callback: ModuleAddressCallback<'_>
) -> Result<()>
fn module_address_list_callback( &mut self, target_arch: Option<&ArchitectureIdent>, callback: ModuleAddressCallback<'_> ) -> Result<()>
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 betweenSome(ProcessInfo::sys_arch())
, andSome(ProcessInfo::proc_arch())
.None
for all.callback
- where to pass each matching module to. This is an opaque callback.
sourcefn module_by_address(
&mut self,
address: Address,
architecture: ArchitectureIdent
) -> Result<ModuleInfo>
fn module_by_address( &mut self, address: Address, architecture: ArchitectureIdent ) -> Result<ModuleInfo>
Retrieves a module by its structure address and architecture
Arguments
address
- address where module’s information resides inarchitecture
- architecture of the module. Should be eitherProcessInfo::proc_arch
, orProcessInfo::sys_arch
.
sourcefn primary_module_address(&mut self) -> Result<Address>
fn primary_module_address(&mut self) -> Result<Address>
Retrieves address of the primary module structure of the process
This will generally be for the initial executable that was run
sourcefn module_import_list_callback(
&mut self,
info: &ModuleInfo,
callback: ImportCallback<'_>
) -> Result<()>
fn module_import_list_callback( &mut self, info: &ModuleInfo, callback: ImportCallback<'_> ) -> Result<()>
Retrieves a list of all imports of a given module
sourcefn module_export_list_callback(
&mut self,
info: &ModuleInfo,
callback: ExportCallback<'_>
) -> Result<()>
fn module_export_list_callback( &mut self, info: &ModuleInfo, callback: ExportCallback<'_> ) -> Result<()>
Retrieves a list of all exports of a given module
sourcefn module_section_list_callback(
&mut self,
info: &ModuleInfo,
callback: SectionCallback<'_>
) -> Result<()>
fn module_section_list_callback( &mut self, info: &ModuleInfo, callback: SectionCallback<'_> ) -> Result<()>
Retrieves a list of all sections of a given module
sourcefn info(&self) -> &ProcessInfo
fn info(&self) -> &ProcessInfo
Retrieves the process info
fn mapped_mem_range( &mut self, gap_size: imem, start: Address, end: Address, out: MemoryRangeCallback<'_> )
Provided Methods§
sourcefn module_list_callback(
&mut self,
target_arch: Option<&ArchitectureIdent>,
callback: ModuleInfoCallback<'_>
) -> Result<()>
fn module_list_callback( &mut self, target_arch: Option<&ArchitectureIdent>, callback: ModuleInfoCallback<'_> ) -> Result<()>
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 betweenSome(ProcessInfo::sys_arch())
, andSome(ProcessInfo::proc_arch())
.None
for all.callback
- where to pass each matching module to. This is an opaque callback.
sourcefn module_by_name_arch(
&mut self,
name: &str,
architecture: Option<&ArchitectureIdent>
) -> Result<ModuleInfo>
fn module_by_name_arch( &mut self, name: &str, architecture: Option<&ArchitectureIdent> ) -> Result<ModuleInfo>
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 findarchitecture
- architecture of the module. Should be eitherProcessInfo::proc_arch
, orProcessInfo::sys_arch
, or None for both.
sourcefn module_by_name(&mut self, name: &str) -> Result<ModuleInfo>
fn module_by_name(&mut self, name: &str) -> Result<ModuleInfo>
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
sourcefn module_list_arch(
&mut self,
target_arch: Option<&ArchitectureIdent>
) -> Result<Vec<ModuleInfo>>
fn module_list_arch( &mut self, target_arch: Option<&ArchitectureIdent> ) -> Result<Vec<ModuleInfo>>
Retrieves a module list for the process
Arguments
target_arch
- sets which architecture to retrieve the modules for (if emulated). Choose betweenSome(ProcessInfo::sys_arch())
, andSome(ProcessInfo::proc_arch())
.None
for all.
sourcefn module_list(&mut self) -> Result<Vec<ModuleInfo>>
fn module_list(&mut self) -> Result<Vec<ModuleInfo>>
Retrieves a module list for the process
This is equivalent to Process::module_list_arch(None)
sourcefn primary_module(&mut self) -> Result<ModuleInfo>
fn primary_module(&mut self) -> Result<ModuleInfo>
Retrieves information for the primary module of the process
This will generally be the initial executable that was run
sourcefn module_import_list(&mut self, info: &ModuleInfo) -> Result<Vec<ImportInfo>>
fn module_import_list(&mut self, info: &ModuleInfo) -> Result<Vec<ImportInfo>>
Retrieves a list of all imports of a given module
sourcefn module_export_list(&mut self, info: &ModuleInfo) -> Result<Vec<ExportInfo>>
fn module_export_list(&mut self, info: &ModuleInfo) -> Result<Vec<ExportInfo>>
Retrieves a list of all exports of a given module
sourcefn module_section_list(&mut self, info: &ModuleInfo) -> Result<Vec<SectionInfo>>
fn module_section_list(&mut self, info: &ModuleInfo) -> Result<Vec<SectionInfo>>
Retrieves a list of all sections of a given module
sourcefn module_import_by_name(
&mut self,
info: &ModuleInfo,
name: &str
) -> Result<ImportInfo>
fn module_import_by_name( &mut self, info: &ModuleInfo, name: &str ) -> Result<ImportInfo>
Finds a single import of a given module by its name
sourcefn module_export_by_name(
&mut self,
info: &ModuleInfo,
name: &str
) -> Result<ExportInfo>
fn module_export_by_name( &mut self, info: &ModuleInfo, name: &str ) -> Result<ExportInfo>
Finds a single export of a given module by its name
sourcefn module_section_by_name(
&mut self,
info: &ModuleInfo,
name: &str
) -> Result<SectionInfo>
fn module_section_by_name( &mut self, info: &ModuleInfo, name: &str ) -> Result<SectionInfo>
Finds a single section of a given module by its name