Trait object::Object
[−]
[src]
pub trait Object<'a>: Sized { type Segment: ObjectSegment<'a>; type SegmentIterator: Iterator<Item = Self::Segment>; type Section: ObjectSection<'a>; type SectionIterator: Iterator<Item = Self::Section>; fn parse(data: &'a [u8]) -> Result<Self, &'static str>; fn machine(&self) -> Machine; fn segments(&'a self) -> Self::SegmentIterator; fn section_data_by_name(&self, section_name: &str) -> Option<&'a [u8]>; fn sections(&'a self) -> Self::SectionIterator; fn symbols(&self) -> Vec<Symbol<'a>>; fn is_little_endian(&self) -> bool; }
An object file.
Associated Types
type Segment: ObjectSegment<'a>
A segment in the object file.
type SegmentIterator: Iterator<Item = Self::Segment>
An iterator over the segments in the object file.
type Section: ObjectSection<'a>
A section in the object file.
type SectionIterator: Iterator<Item = Self::Section>
An iterator over the sections in the object file.
Required Methods
fn parse(data: &'a [u8]) -> Result<Self, &'static str>
Parse the raw object file data.
fn machine(&self) -> Machine
Get the machine type of the file.
fn segments(&'a self) -> Self::SegmentIterator
Get an iterator over the segments in the file.
fn section_data_by_name(&self, section_name: &str) -> Option<&'a [u8]>
Get the contents of 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.
For example, if ".text" is requested for a Mach-O object file, then the actual
section name that is searched for is "__text".
For some object files, multiple segments may contain sections with the same name. In this case, the first matching section will be used.
fn sections(&'a self) -> Self::SectionIterator
Get an iterator over the sections in the file.
fn symbols(&self) -> Vec<Symbol<'a>>
Get a Vec
of the symbols defined in the file.
The symbols are unsorted and have the same order as the symbols in the file.
fn is_little_endian(&self) -> bool
Return true if the file is little endian, false if it is big endian.
Implementors
impl<'a> Object<'a> for ElfFile<'a> type Segment = ElfSegment<'a>; type SegmentIterator = ElfSegmentIterator<'a>; type Section = ElfSection<'a>; type SectionIterator = ElfSectionIterator<'a>;
impl<'a> Object<'a> for MachOFile<'a> type Segment = MachOSegment<'a>; type SegmentIterator = MachOSegmentIterator<'a>; type Section = MachOSection<'a>; type SectionIterator = MachOSectionIterator<'a>;
impl<'a> Object<'a> for PeFile<'a> type Segment = PeSegment<'a>; type SegmentIterator = PeSegmentIterator<'a>; type Section = PeSection<'a>; type SectionIterator = PeSectionIterator<'a>;
impl<'a> Object<'a> for File<'a> type Segment = Segment<'a>; type SegmentIterator = SegmentIterator<'a>; type Section = Section<'a>; type SectionIterator = SectionIterator<'a>;