[][src]Struct symbolic_debuginfo::elf::ElfObject

pub struct ElfObject<'d> { /* fields omitted */ }

Executable and Linkable Format, used for executables and libraries on Linux.

Methods

impl<'d> ElfObject<'d>[src]

pub fn test(data: &[u8]) -> bool[src]

Tests whether the buffer could contain an ELF object.

pub fn parse(data: &'d [u8]) -> Result<Self, ElfError>[src]

Tries to parse an ELF object from the given slice.

pub fn file_format(&self) -> FileFormat[src]

The container file format, which is always FileFormat::Elf.

pub fn code_id(&self) -> Option<CodeId>[src]

The code identifier of this object.

As opposed to Mach-O, ELF does not specify a unique ID for object files in its header. Compilers and linkers usually add either SHT_NOTE sections or PT_NOTE program header elements for this purpose.

pub fn debug_id(&self) -> DebugId[src]

The debug information identifier of an ELF object.

The debug identifier is a rehash of the first 16 bytes of the code_id, if present. Otherwise, this function will hash the first page of the .text section (program code) to synthesize a unique ID. This is likely not a valid UUID since was generated off a hash value.

If all of the above fails, the identifier will be an empty DebugId.

pub fn arch(&self) -> Arch[src]

The CPU architecture of this object, as specified in the ELF header.

pub fn kind(&self) -> ObjectKind[src]

The kind of this object, as specified in the ELF header.

pub fn load_address(&self) -> u64[src]

The address at which the image prefers to be loaded into memory.

ELF files store all internal addresses as if it was loaded at that address. When the image is actually loaded, that spot might already be taken by other images and so it must be relocated to a new address. At runtime, a relocation table manages the arithmetics behind this.

Addresses used in symbols or debug_session have already been rebased relative to that load address, so that the caller only has to deal with addresses relative to the actual start of the image.

pub fn has_symbols(&self) -> bool[src]

Determines whether this object exposes a public symbol table.

Important traits for ElfSymbolIterator<'d, 'o>
pub fn symbols(&self) -> ElfSymbolIterator<'d, '_>[src]

Returns an iterator over symbols in the public symbol table.

pub fn symbol_map(&self) -> SymbolMap<'d>[src]

Returns an ordered map of symbols in the symbol table.

pub fn has_debug_info(&self) -> bool[src]

Determines whether this object contains debug information.

pub fn debug_session(&self) -> Result<DwarfDebugSession<'d>, DwarfError>[src]

Constructs a debugging session.

A debugging session loads certain information from the object file and creates caches for efficient access to various records in the debug information. Since this can be quite a costly process, try to reuse the debugging session as long as possible.

ELF files generally use DWARF debugging information, which is also used by MachO containers on macOS.

Constructing this session will also work if the object does not contain debugging information, in which case the session will be a no-op. This can be checked via has_debug_info.

pub fn has_unwind_info(&self) -> bool[src]

Determines whether this object contains stack unwinding information.

pub fn data(&self) -> &'d [u8][src]

Returns the raw data of the ELF file.

Trait Implementations

impl<'d> ObjectLike for ElfObject<'d>[src]

type Error = DwarfError

Errors thrown when reading information from this object.

type Session = DwarfDebugSession<'d>

A session that allows optimized access to debugging information.

fn debug_file_name(&self) -> Option<Cow<str>>[src]

The filename of the debug companion file.

impl<'d> Dwarf<'d> for ElfObject<'d>[src]

fn has_section(&self, name: &str) -> bool[src]

Determines whether the specified section exists. Read more

impl<'_> Debug for ElfObject<'_>[src]

impl<'slf, 'd: 'slf> AsSelf<'slf> for ElfObject<'d>[src]

type Ref = ElfObject<'slf>

The Self type with 'slf lifetimes, returned by as_self.

Auto Trait Implementations

impl<'d> Send for ElfObject<'d>

impl<'d> Sync for ElfObject<'d>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]