Skip to main content

Arch

Trait Arch 

Source
pub trait Arch:
    Any
    + Debug
    + Send
    + Sync {
Show 16 methods // Required methods fn scan_instructions_internal( &self, address: u64, code: &[u8], section_index: usize, relocations: &[Relocation], diff_config: &DiffObjConfig, ) -> Result<Vec<InstructionRef>>; fn display_instruction( &self, resolved: ResolvedInstructionRef<'_>, diff_config: &DiffObjConfig, cb: &mut dyn FnMut(InstructionPart<'_>) -> Result<()>, ) -> Result<()>; fn data_reloc_size(&self, flags: RelocationFlags) -> usize; // Provided methods fn post_init( &mut self, _sections: &[Section], _symbols: &[Symbol], _symbol_indices: &[usize], ) { ... } fn generate_pooled_relocations( &self, _address: u64, _code: &[u8], _relocations: &[Relocation], _symbols: &[Symbol], ) -> Vec<Relocation> { ... } fn data_flow_analysis( &self, _obj: &Object, _symbol: &Symbol, _code: &[u8], _relocations: &[Relocation], ) -> Option<Box<dyn FlowAnalysisResult>> { ... } fn relocation_override( &self, _file: &File<'_>, _section: &Section<'_, '_>, _address: u64, _relocation: &Relocation, ) -> Result<Option<RelocationOverride>> { ... } fn reloc_name(&self, _flags: RelocationFlags) -> Option<&'static str> { ... } fn symbol_address(&self, address: u64, _kind: SymbolKind) -> u64 { ... } fn extra_symbol_flags(&self, _symbol: &Symbol<'_, '_>) -> SymbolFlagSet { ... } fn guess_data_type( &self, _resolved: ResolvedInstructionRef<'_>, _bytes: &[u8], ) -> Option<DataType> { ... } fn symbol_hover( &self, _obj: &Object, _symbol_index: usize, ) -> Vec<HoverItem> { ... } fn symbol_context( &self, _obj: &Object, _symbol_index: usize, ) -> Vec<ContextItem> { ... } fn instruction_hover( &self, _obj: &Object, _resolved: ResolvedInstructionRef<'_>, ) -> Vec<HoverItem> { ... } fn instruction_context( &self, _obj: &Object, _resolved: ResolvedInstructionRef<'_>, ) -> Vec<ContextItem> { ... } fn infer_function_size( &self, symbol: &Symbol, _section: &Section, next_address: u64, ) -> Result<u64> { ... }
}

Required Methods§

Source

fn scan_instructions_internal( &self, address: u64, code: &[u8], section_index: usize, relocations: &[Relocation], diff_config: &DiffObjConfig, ) -> Result<Vec<InstructionRef>>

Generate a list of instructions references (offset, size, opcode) from the given code.

The opcode IDs are used to generate the initial diff. Implementations should do as little parsing as possible here: just enough to identify the base instruction opcode, size, and possible branch destination (for visual representation). As needed, instructions are parsed via process_instruction to compare their arguments.

Source

fn display_instruction( &self, resolved: ResolvedInstructionRef<'_>, diff_config: &DiffObjConfig, cb: &mut dyn FnMut(InstructionPart<'_>) -> Result<()>, ) -> Result<()>

Format an instruction for display.

Implementations should call the callback for each part of the instruction: usually the mnemonic and arguments, plus any separators and visual formatting.

Source

fn data_reloc_size(&self, flags: RelocationFlags) -> usize

Provided Methods§

Source

fn post_init( &mut self, _sections: &[Section], _symbols: &[Symbol], _symbol_indices: &[usize], )

Finishes arch-specific initialization that must be done after sections have been combined.

Source

fn generate_pooled_relocations( &self, _address: u64, _code: &[u8], _relocations: &[Relocation], _symbols: &[Symbol], ) -> Vec<Relocation>

Generate a list of fake relocations from the given code that represent pooled data accesses.

Source

fn data_flow_analysis( &self, _obj: &Object, _symbol: &Symbol, _code: &[u8], _relocations: &[Relocation], ) -> Option<Box<dyn FlowAnalysisResult>>

Source

fn relocation_override( &self, _file: &File<'_>, _section: &Section<'_, '_>, _address: u64, _relocation: &Relocation, ) -> Result<Option<RelocationOverride>>

Source

fn reloc_name(&self, _flags: RelocationFlags) -> Option<&'static str>

Source

fn symbol_address(&self, address: u64, _kind: SymbolKind) -> u64

Source

fn extra_symbol_flags(&self, _symbol: &Symbol<'_, '_>) -> SymbolFlagSet

Source

fn guess_data_type( &self, _resolved: ResolvedInstructionRef<'_>, _bytes: &[u8], ) -> Option<DataType>

Source

fn symbol_hover(&self, _obj: &Object, _symbol_index: usize) -> Vec<HoverItem>

Source

fn symbol_context( &self, _obj: &Object, _symbol_index: usize, ) -> Vec<ContextItem>

Source

fn instruction_hover( &self, _obj: &Object, _resolved: ResolvedInstructionRef<'_>, ) -> Vec<HoverItem>

Source

fn instruction_context( &self, _obj: &Object, _resolved: ResolvedInstructionRef<'_>, ) -> Vec<ContextItem>

Source

fn infer_function_size( &self, symbol: &Symbol, _section: &Section, next_address: u64, ) -> Result<u64>

Implementations§

Source§

impl dyn Arch

Source

pub fn scan_instructions( &self, resolved: ResolvedSymbol<'_>, diff_config: &DiffObjConfig, ) -> Result<Vec<InstructionRef>>

Generate a list of instructions references (offset, size, opcode) from the given code.

See [scan_instructions_internal] for more details.

Source

pub fn process_instruction( &self, resolved: ResolvedInstructionRef<'_>, diff_config: &DiffObjConfig, ) -> Result<ParsedInstruction>

Parse an instruction to gather its mnemonic and arguments for more detailed comparison.

This is called only when we need to compare the arguments of an instruction.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§