pub struct Binary { /* private fields */ }
Expand description
This is the main interface to read and write ELF binary attributes.
Note that this structure implements the generic::Binary
trait from which other generic
functions are exposed
Implementations§
§impl Binary
impl Binary
pub fn virtual_size(&self) -> u64
pub fn virtual_size(&self) -> u64
Return the size taken by the binary when loaded (virtual size)
pub fn interpreter(&self) -> String
pub fn interpreter(&self) -> String
Return the path to the ELF interpreter that is used to process the ELF information once loaded by the kernel
pub fn sections(&self) -> Sections<'_> ⓘ
pub fn sections(&self) -> Sections<'_> ⓘ
Return an iterator over the crate::elf::Section
of the binary
pub fn segments(&self) -> Segments<'_> ⓘ
pub fn segments(&self) -> Segments<'_> ⓘ
Return an iterator over the crate::elf::Segment
of the binary
pub fn dynamic_entries(&self) -> DynamicEntries<'_> ⓘ
pub fn dynamic_entries(&self) -> DynamicEntries<'_> ⓘ
Return an iterator over the crate::elf::DynamicEntries
of the binary
pub fn dynamic_symbols(&self) -> DynamicSymbols<'_> ⓘ
pub fn dynamic_symbols(&self) -> DynamicSymbols<'_> ⓘ
Return an iterator over the dynamic crate::elf::Symbol
of the binary
pub fn exported_symbols(&self) -> ExportedSymbols<'_> ⓘ
pub fn exported_symbols(&self) -> ExportedSymbols<'_> ⓘ
Return an iterator over the exported crate::elf::Symbol
of the binary
pub fn imported_symbols(&self) -> ImportedSymbols<'_> ⓘ
pub fn imported_symbols(&self) -> ImportedSymbols<'_> ⓘ
Return an iterator over the imported crate::elf::Symbol
of the binary
pub fn symtab_symbols(&self) -> SymtabSymbols<'_> ⓘ
pub fn symtab_symbols(&self) -> SymtabSymbols<'_> ⓘ
Return an iterator over the symtab-debug crate::elf::Symbol
of the binary
pub fn symbols_version(&self) -> SymbolsVersion<'_> ⓘ
pub fn symbols_version(&self) -> SymbolsVersion<'_> ⓘ
Return an iterator over the crate::elf::SymbolVersion
of the binary
pub fn symbols_version_requirement(&self) -> SymbolsVersionRequirement<'_> ⓘ
pub fn symbols_version_requirement(&self) -> SymbolsVersionRequirement<'_> ⓘ
Return an iterator over the crate::elf::SymbolVersionRequirement
of the binary
pub fn symbols_version_definition(&self) -> SymbolsVersionDefinition<'_> ⓘ
pub fn symbols_version_definition(&self) -> SymbolsVersionDefinition<'_> ⓘ
Return an iterator over the crate::elf::SymbolVersionDefinition
of the binary
pub fn notes(&self) -> ItNotes<'_> ⓘ
pub fn notes(&self) -> ItNotes<'_> ⓘ
Return an iterator over the crate::elf::Notes
of the binary
pub fn pltgot_relocations(&self) -> PltGotRelocations<'_> ⓘ
pub fn pltgot_relocations(&self) -> PltGotRelocations<'_> ⓘ
Return an iterator over the .plt.got
crate::elf::Relocation
of the binary
pub fn dynamic_relocations(&self) -> DynamicRelocations<'_> ⓘ
pub fn dynamic_relocations(&self) -> DynamicRelocations<'_> ⓘ
Return an iterator over the regular crate::elf::Relocation
of the binary
pub fn object_relocations(&self) -> ObjectRelocations<'_> ⓘ
pub fn object_relocations(&self) -> ObjectRelocations<'_> ⓘ
Return an iterator over the object-file (.o
) crate::elf::Relocation
pub fn relocations(&self) -> Relocations<'_> ⓘ
pub fn relocations(&self) -> Relocations<'_> ⓘ
Return an iterator over all crate::elf::Relocation
of the binary
pub fn section_by_name(&self, name: &str) -> Option<Section<'_>>
pub fn section_by_name(&self, name: &str) -> Option<Section<'_>>
Try to find the ELF section with the given name
pub fn relocation_by_addr(&self, address: u64) -> Option<Relocation<'_>>
pub fn relocation_by_addr(&self, address: u64) -> Option<Relocation<'_>>
Try to find the ELF relocation that takes place at the given address
pub fn relocation_for_symbol(&self, sym_name: &str) -> Option<Relocation<'_>>
pub fn relocation_for_symbol(&self, sym_name: &str) -> Option<Relocation<'_>>
Try to find the .plt.got
relocation for the given symbol name
pub fn dynamic_symbol_by_name(&self, sym_name: &str) -> Option<Symbol<'_>>
pub fn dynamic_symbol_by_name(&self, sym_name: &str) -> Option<Symbol<'_>>
Try to find the symbol with the given name in the dynamic .dynsym
table
pub fn symtab_symbol_by_name(&self, sym_name: &str) -> Option<Symbol<'_>>
pub fn symtab_symbol_by_name(&self, sym_name: &str) -> Option<Symbol<'_>>
Try to find the symbol with the given name in the debug .symtab
table
pub fn get_library(&self, name: &str) -> Option<Library<'_>>
pub fn get_library(&self, name: &str) -> Option<Library<'_>>
Try to find the library (DT_NEEDED
) with the given name
pub fn section_from_offset(
&self,
offset: u64,
skip_nobits: bool
) -> Option<Section<'_>>
pub fn section_from_offset( &self, offset: u64, skip_nobits: bool ) -> Option<Section<'_>>
Try to find the section that encompasses the given offset. skip_nobits
can be used
to include (or not) the SHT_NOTBIT
sections
pub fn section_from_virtual_address(
&self,
address: u64,
skip_nobits: bool
) -> Option<Section<'_>>
pub fn section_from_virtual_address( &self, address: u64, skip_nobits: bool ) -> Option<Section<'_>>
Try to find the section that encompasses the given virtual address. skip_nobits
can be used
to include (or not) the SHT_NOTBIT
sections
pub fn segment_from_virtual_address(&self, address: u64) -> Option<Segment<'_>>
pub fn segment_from_virtual_address(&self, address: u64) -> Option<Segment<'_>>
Try to find the segment that encompasses the given virtual address
pub fn segment_from_offset(&self, offset: u64) -> Option<Segment<'_>>
pub fn segment_from_offset(&self, offset: u64) -> Option<Segment<'_>>
Try to find the segment that encompasses the given offset
pub fn content_from_virtual_address(&self, address: u64, size: u64) -> &[u8] ⓘ
pub fn content_from_virtual_address(&self, address: u64, size: u64) -> &[u8] ⓘ
Get a slice of the content at the given address.
pub fn virtual_address_to_offset(&self, address: u64) -> Result<u64, Error>
pub fn virtual_address_to_offset(&self, address: u64) -> Result<u64, Error>
Convert the given virtual address into an offset
pub fn get_relocated_dynamic_array(&self, tag: Tag) -> Vec<u64>
pub fn get_relocated_dynamic_array(&self, tag: Tag) -> Vec<u64>
Return the array defined by the given tag (e.g.
dynamic::Tag::INIT_ARRAY
) with relocations applied (if any)
Trait Implementations§
§impl Binary for Binary
impl Binary for Binary
§fn entrypoint(&self) -> u64
fn entrypoint(&self) -> u64
§fn original_size(&self) -> u64
fn original_size(&self) -> u64
§fn debug_info(&self) -> Option<DebugInfo<'_>>
fn debug_info(&self) -> Option<DebugInfo<'_>>
crate::pdb::DebugInfo
or crate::dwarf::DebugInfo
. Read more