[][src]Trait object::read::Object

pub trait Object<'data, 'file>: Sealed {
    type Segment: ObjectSegment<'data>;
    type SegmentIterator: Iterator<Item = Self::Segment>;
    type Section: ObjectSection<'data>;
    type SectionIterator: Iterator<Item = Self::Section>;
    type SymbolIterator: Iterator<Item = (SymbolIndex, Symbol<'data>)>;
    fn architecture(&self) -> Architecture;
fn is_little_endian(&self) -> bool;
fn is_64(&self) -> bool;
fn segments(&'file self) -> Self::SegmentIterator;
fn entry(&'file self) -> u64;
fn section_by_name(&'file self, section_name: &str) -> Option<Self::Section>;
fn section_by_index(
        &'file self,
        index: SectionIndex
    ) -> Result<Self::Section>;
fn sections(&'file self) -> Self::SectionIterator;
fn symbol_by_index(&self, index: SymbolIndex) -> Result<Symbol<'data>>;
fn symbols(&'file self) -> Self::SymbolIterator;
fn dynamic_symbols(&'file self) -> Self::SymbolIterator;
fn symbol_map(&self) -> SymbolMap<'data>;
fn has_debug_symbols(&self) -> bool;
fn flags(&self) -> FileFlags; fn endianness(&self) -> Endianness { ... }
fn symbol_data(
        &'file self,
        symbol: &Symbol<'data>
    ) -> Result<Option<&'data [u8]>> { ... }
fn mach_uuid(&self) -> Result<Option<[u8; 16]>> { ... }
fn build_id(&self) -> Result<Option<&'data [u8]>> { ... }
fn gnu_debuglink(&self) -> Result<Option<(&'data [u8], u32)>> { ... } }

An object file.

Associated Types

type Segment: ObjectSegment<'data>

A segment in the object file.

type SegmentIterator: Iterator<Item = Self::Segment>

An iterator over the segments in the object file.

type Section: ObjectSection<'data>

A section in the object file.

type SectionIterator: Iterator<Item = Self::Section>

An iterator over the sections in the object file.

type SymbolIterator: Iterator<Item = (SymbolIndex, Symbol<'data>)>

An iterator over the symbols in the object file.

Loading content...

Required methods

fn architecture(&self) -> Architecture

Get the architecture type of the file.

fn is_little_endian(&self) -> bool

Return true if the file is little endian, false if it is big endian.

fn is_64(&self) -> bool

Return true if the file can contain 64-bit addresses.

fn segments(&'file self) -> Self::SegmentIterator

Get an iterator over the segments in the file.

fn entry(&'file self) -> u64

Get the entry point address of the binary

fn section_by_name(&'file self, section_name: &str) -> Option<Self::Section>

Get the section named section_name, if such a section exists.

If section_name starts with a '.' then it is treated as a system section name, and is compared using the conventions specific to the object file format. This includes:

  • if ".text" is requested for a Mach-O object file, then the actual section name that is searched for is "__text".
  • if ".debug_info" is requested for an ELF object file, then ".zdebug_info" may be returned (and similarly for other debug sections).

For some object files, multiple segments may contain sections with the same name. In this case, the first matching section will be used.

This method skips over sections with invalid names.

fn section_by_index(&'file self, index: SectionIndex) -> Result<Self::Section>

Get the section at the given index.

The meaning of the index depends on the object file.

For some object files, this requires iterating through all sections.

Returns an error if the index is invalid.

fn sections(&'file self) -> Self::SectionIterator

Get an iterator over the sections in the file.

fn symbol_by_index(&self, index: SymbolIndex) -> Result<Symbol<'data>>

Get the debugging symbol at the given index.

The meaning of the index depends on the object file.

Returns an error if the index is invalid.

fn symbols(&'file self) -> Self::SymbolIterator

Get an iterator over the debugging symbols in the file.

This may skip over symbols that are malformed or unsupported.

fn dynamic_symbols(&'file self) -> Self::SymbolIterator

Get an iterator over the dynamic linking symbols in the file.

This may skip over symbols that are malformed or unsupported.

fn symbol_map(&self) -> SymbolMap<'data>

Construct a map from addresses to symbols.

fn has_debug_symbols(&self) -> bool

Return true if the file contains debug information sections, false if not.

fn flags(&self) -> FileFlags

File flags that are specific to each file format.

Loading content...

Provided methods

fn endianness(&self) -> Endianness

Get the endianness of the file.

fn symbol_data(
    &'file self,
    symbol: &Symbol<'data>
) -> Result<Option<&'data [u8]>>

Get the data for the given symbol.

This may iterate over segments.

Returns Ok(None) for undefined symbols or if the data could not be found.

fn mach_uuid(&self) -> Result<Option<[u8; 16]>>

The UUID from a Mach-O LC_UUID load command.

fn build_id(&self) -> Result<Option<&'data [u8]>>

The build ID from an ELF NT_GNU_BUILD_ID note.

The filename and CRC from a .gnu_debuglink section.

Loading content...

Implementors

impl<'data, 'file> Object<'data, 'file> for CoffFile<'data> where
    'data: 'file, 
[src]

type Segment = CoffSegment<'data, 'file>

type SegmentIterator = CoffSegmentIterator<'data, 'file>

type Section = CoffSection<'data, 'file>

type SectionIterator = CoffSectionIterator<'data, 'file>

type SymbolIterator = CoffSymbolIterator<'data, 'file>

impl<'data, 'file> Object<'data, 'file> for File<'data> where
    'data: 'file, 
[src]

type Segment = Segment<'data, 'file>

type SegmentIterator = SegmentIterator<'data, 'file>

type Section = Section<'data, 'file>

type SectionIterator = SectionIterator<'data, 'file>

type SymbolIterator = SymbolIterator<'data, 'file>

impl<'data, 'file, Elf> Object<'data, 'file> for ElfFile<'data, Elf> where
    'data: 'file,
    Elf: FileHeader
[src]

type Segment = ElfSegment<'data, 'file, Elf>

type SegmentIterator = ElfSegmentIterator<'data, 'file, Elf>

type Section = ElfSection<'data, 'file, Elf>

type SectionIterator = ElfSectionIterator<'data, 'file, Elf>

type SymbolIterator = ElfSymbolIterator<'data, 'file, Elf>

impl<'data, 'file, Mach> Object<'data, 'file> for MachOFile<'data, Mach> where
    'data: 'file,
    Mach: MachHeader
[src]

type Segment = MachOSegment<'data, 'file, Mach>

type SegmentIterator = MachOSegmentIterator<'data, 'file, Mach>

type Section = MachOSection<'data, 'file, Mach>

type SectionIterator = MachOSectionIterator<'data, 'file, Mach>

type SymbolIterator = MachOSymbolIterator<'data, 'file, Mach>

impl<'data, 'file, Pe> Object<'data, 'file> for PeFile<'data, Pe> where
    'data: 'file,
    Pe: ImageNtHeaders
[src]

type Segment = PeSegment<'data, 'file, Pe>

type SegmentIterator = PeSegmentIterator<'data, 'file, Pe>

type Section = PeSection<'data, 'file, Pe>

type SectionIterator = PeSectionIterator<'data, 'file, Pe>

type SymbolIterator = CoffSymbolIterator<'data, 'file>

Loading content...