pub struct Elf64<'a> { /* private fields */ }
Expand description
The parsed structure of an ELF file
Implementations§
Source§impl<'a> Elf64<'a>
impl<'a> Elf64<'a>
Sourcepub fn parse(elf_bytes: &'a [u8]) -> Result<Self, ElfParserError>
pub fn parse(elf_bytes: &'a [u8]) -> Result<Self, ElfParserError>
Parse from the given byte slice
Sourcepub fn file_header(&self) -> &Elf64Ehdr
pub fn file_header(&self) -> &Elf64Ehdr
Returns the file header.
Sourcepub fn program_header_table(&self) -> &[Elf64Phdr]
pub fn program_header_table(&self) -> &[Elf64Phdr]
Returns the program header table.
Sourcepub fn section_header_table(&self) -> &[Elf64Shdr]
pub fn section_header_table(&self) -> &[Elf64Shdr]
Returns the section header table.
Sourcepub fn dynamic_symbol_table(&self) -> Option<&[Elf64Sym]>
pub fn dynamic_symbol_table(&self) -> Option<&[Elf64Sym]>
Returns the dynamic symbol table.
Sourcepub fn dynamic_relocations_table(&self) -> Option<&[Elf64Rel]>
pub fn dynamic_relocations_table(&self) -> Option<&[Elf64Rel]>
Returns the dynamic relocations table.
Sourcepub fn parse_file_header(
elf_bytes: &'a [u8],
) -> Result<(Range<usize>, &'a Elf64Ehdr), ElfParserError>
pub fn parse_file_header( elf_bytes: &'a [u8], ) -> Result<(Range<usize>, &'a Elf64Ehdr), ElfParserError>
Parses the file header.
Sourcepub fn parse_program_header_table(
elf_bytes: &'a [u8],
file_header_range: Range<usize>,
file_header: &Elf64Ehdr,
) -> Result<(Range<usize>, &'a [Elf64Phdr]), ElfParserError>
pub fn parse_program_header_table( elf_bytes: &'a [u8], file_header_range: Range<usize>, file_header: &Elf64Ehdr, ) -> Result<(Range<usize>, &'a [Elf64Phdr]), ElfParserError>
Parses the program header table.
Sourcepub fn parse_section_header_table(
elf_bytes: &'a [u8],
file_header_range: Range<usize>,
file_header: &Elf64Ehdr,
program_header_table_range: Range<usize>,
) -> Result<(Range<usize>, &'a [Elf64Shdr]), ElfParserError>
pub fn parse_section_header_table( elf_bytes: &'a [u8], file_header_range: Range<usize>, file_header: &Elf64Ehdr, program_header_table_range: Range<usize>, ) -> Result<(Range<usize>, &'a [Elf64Shdr]), ElfParserError>
Parses the section header table.
Sourcepub fn get_string_in_section(
elf_bytes: &'a [u8],
section_header: &Elf64Shdr,
offset_in_section: Elf64Word,
maximum_length: usize,
) -> Result<&'a [u8], ElfParserError>
pub fn get_string_in_section( elf_bytes: &'a [u8], section_header: &Elf64Shdr, offset_in_section: Elf64Word, maximum_length: usize, ) -> Result<&'a [u8], ElfParserError>
Query a single string from a section which is marked as SHT_STRTAB
Sourcepub fn section_name(
&self,
sh_name: Elf64Word,
) -> Result<&'a [u8], ElfParserError>
pub fn section_name( &self, sh_name: Elf64Word, ) -> Result<&'a [u8], ElfParserError>
Returns the string corresponding to the given sh_name
Sourcepub fn symbol_name(
&self,
st_name: Elf64Word,
) -> Result<&'a [u8], ElfParserError>
pub fn symbol_name( &self, st_name: Elf64Word, ) -> Result<&'a [u8], ElfParserError>
Returns the name of the st_name
symbol
Sourcepub fn symbol_table(&self) -> Result<Option<&'a [Elf64Sym]>, ElfParserError>
pub fn symbol_table(&self) -> Result<Option<&'a [Elf64Sym]>, ElfParserError>
Returns the symbol table
Sourcepub fn dynamic_symbol_name(
&self,
st_name: Elf64Word,
) -> Result<&'a [u8], ElfParserError>
pub fn dynamic_symbol_name( &self, st_name: Elf64Word, ) -> Result<&'a [u8], ElfParserError>
Returns the name of the st_name
dynamic symbol
Sourcepub fn get_symbol_table_of_section(
&self,
section_header: &Elf64Shdr,
) -> Result<&'a [Elf64Sym], ElfParserError>
pub fn get_symbol_table_of_section( &self, section_header: &Elf64Shdr, ) -> Result<&'a [Elf64Sym], ElfParserError>
Returns the symbol table of a section which is marked as SHT_SYMTAB
Sourcepub fn slice_from_program_header<T: 'static>(
bytes: &'a [u8],
_: &Elf64Phdr,
) -> Result<&'a [T], ElfParserError>
pub fn slice_from_program_header<T: 'static>( bytes: &'a [u8], _: &Elf64Phdr, ) -> Result<&'a [T], ElfParserError>
Returns the &[T]
contained in the data described by the given program
header
Sourcepub fn slice_from_section_header<T: 'static>(
bytes: &'a [u8],
_: &Elf64Shdr,
) -> Result<&'a [T], ElfParserError>
pub fn slice_from_section_header<T: 'static>( bytes: &'a [u8], _: &Elf64Shdr, ) -> Result<&'a [T], ElfParserError>
Returns the &[T]
contained in the section data described by the given
section header
Sourcepub fn slice_from_bytes<T: 'static>(
bytes: &[u8],
range: Range<usize>,
) -> Result<&[T], ElfParserError>
pub fn slice_from_bytes<T: 'static>( bytes: &[u8], range: Range<usize>, ) -> Result<&[T], ElfParserError>
Returns the &[T]
contained at bytes[range]
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Elf64<'a>
impl<'a> RefUnwindSafe for Elf64<'a>
impl<'a> Send for Elf64<'a>
impl<'a> Sync for Elf64<'a>
impl<'a> Unpin for Elf64<'a>
impl<'a> UnwindSafe for Elf64<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more