pub trait Object<'data, 'file> {
type Segment: ObjectSegment<'data>;
type SegmentIterator: Iterator<Item = Self::Segment>;
type Section: ObjectSection<'data>;
type SectionIterator: Iterator<Item = Self::Section>;
type SymbolIterator: Iterator<Item = Symbol<'data>>;
Show 15 methods
fn machine(&self) -> Machine;
fn segments(&'file self) -> Self::SegmentIterator;
fn entry(&'file self) -> u64;
fn section_by_name(&'file self, section_name: &str) -> Option<Self::Section>;
fn sections(&'file self) -> Self::SectionIterator;
fn symbol_by_index(&self, index: u64) -> Option<Symbol<'data>>;
fn symbols(&'file self) -> Self::SymbolIterator;
fn dynamic_symbols(&'file self) -> Self::SymbolIterator;
fn symbol_map(&self) -> SymbolMap<'data>;
fn is_little_endian(&self) -> bool;
fn has_debug_symbols(&self) -> bool;
fn section_data_by_name(
&'file self,
section_name: &str
) -> Option<Cow<'data, [u8]>> { ... }
fn mach_uuid(&self) -> Option<Uuid> { ... }
fn build_id(&self) -> Option<&'data [u8]> { ... }
fn gnu_debuglink(&self) -> Option<(&'data [u8], u32)> { ... }
}
Expand description
An object file.
Required Associated Types§
sourcetype Segment: ObjectSegment<'data>
type Segment: ObjectSegment<'data>
A segment in the object file.
sourcetype SegmentIterator: Iterator<Item = Self::Segment>
type SegmentIterator: Iterator<Item = Self::Segment>
An iterator over the segments in the object file.
sourcetype Section: ObjectSection<'data>
type Section: ObjectSection<'data>
A section in the object file.
sourcetype SectionIterator: Iterator<Item = Self::Section>
type SectionIterator: Iterator<Item = Self::Section>
An iterator over the sections in the object file.
sourcetype SymbolIterator: Iterator<Item = Symbol<'data>>
type SymbolIterator: Iterator<Item = Symbol<'data>>
An iterator over the symbols in the object file.
Required Methods§
sourcefn segments(&'file self) -> Self::SegmentIterator
fn segments(&'file self) -> Self::SegmentIterator
Get an iterator over the segments in the file.
sourcefn section_by_name(&'file self, section_name: &str) -> Option<Self::Section>
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.
sourcefn sections(&'file self) -> Self::SectionIterator
fn sections(&'file self) -> Self::SectionIterator
Get an iterator over the sections in the file.
sourcefn symbol_by_index(&self, index: u64) -> Option<Symbol<'data>>
fn symbol_by_index(&self, index: u64) -> Option<Symbol<'data>>
Get the debugging symbol at the given index.
This is similar to self.symbols().nth(index)
, except that
the index will take into account malformed or unsupported symbols.
sourcefn symbols(&'file self) -> Self::SymbolIterator
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.
sourcefn dynamic_symbols(&'file self) -> Self::SymbolIterator
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.
sourcefn symbol_map(&self) -> SymbolMap<'data>
fn symbol_map(&self) -> SymbolMap<'data>
Construct a map from addresses to symbols.
sourcefn is_little_endian(&self) -> bool
fn is_little_endian(&self) -> bool
Return true if the file is little endian, false if it is big endian.
sourcefn has_debug_symbols(&self) -> bool
fn has_debug_symbols(&self) -> bool
Return true if the file contains debug information sections, false if not.
Provided Methods§
sourcefn section_data_by_name(
&'file self,
section_name: &str
) -> Option<Cow<'data, [u8]>>
fn section_data_by_name(
&'file self,
section_name: &str
) -> Option<Cow<'data, [u8]>>
Get the contents of the section named section_name
, if such
a section exists.
The section_name
is interpreted according to Self::section_by_name
.
This may decompress section data.
sourcefn gnu_debuglink(&self) -> Option<(&'data [u8], u32)>
fn gnu_debuglink(&self) -> Option<(&'data [u8], u32)>
The filename and CRC from a .gnu_debuglink
section.