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

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

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

Implementations

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

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

Tests whether the buffer could contain an ELF object.

pub fn parse(data: &'data [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 name(&self) -> Option<&'data str>[src]

The binary's soname, if any.

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.

pub fn symbols(&self) -> ElfSymbolIterator<'data, '_>

Notable traits for ElfSymbolIterator<'data, 'object>

impl<'data, 'object> Iterator for ElfSymbolIterator<'data, 'object> type Item = Symbol<'data>;
[src]

Returns an iterator over symbols in the public symbol table.

pub fn symbol_map(&self) -> SymbolMap<'data>[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<'data>, 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 has_sources(&self) -> bool[src]

Determines whether this object contains embedded source.

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

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

Returns the raw data of the ELF file.

Trait Implementations

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

type Ref = ElfObject<'slf>

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

impl Debug for ElfObject<'_>[src]

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

impl<'data: 'object, 'object> ObjectLike<'data, 'object> for ElfObject<'data>[src]

type Error = DwarfError

Errors thrown when reading information from this object.

type Session = DwarfDebugSession<'data>

A session that allows optimized access to debugging information.

type SymbolIterator = ElfSymbolIterator<'data, 'object>

The iterator over the symbols in the public symbol table.

Auto Trait Implementations

impl<'data> RefUnwindSafe for ElfObject<'data>

impl<'data> Send for ElfObject<'data>

impl<'data> Sync for ElfObject<'data>

impl<'data> Unpin for ElfObject<'data>

impl<'data> UnwindSafe for ElfObject<'data>

Blanket Implementations

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

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

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

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.