Struct Elf64

Source
pub struct Elf64<'a> { /* private fields */ }
Expand description

The parsed structure of an ELF file

Implementations§

Source§

impl<'a> Elf64<'a>

Source

pub fn parse(elf_bytes: &'a [u8]) -> Result<Self, ElfParserError>

Parse from the given byte slice

Source

pub fn file_header(&self) -> &Elf64Ehdr

Returns the file header.

Source

pub fn program_header_table(&self) -> &[Elf64Phdr]

Returns the program header table.

Source

pub fn section_header_table(&self) -> &[Elf64Shdr]

Returns the section header table.

Source

pub fn dynamic_symbol_table(&self) -> Option<&[Elf64Sym]>

Returns the dynamic symbol table.

Source

pub fn dynamic_relocations_table(&self) -> Option<&[Elf64Rel]>

Returns the dynamic relocations table.

Source

pub fn parse_file_header( elf_bytes: &'a [u8], ) -> Result<(Range<usize>, &'a Elf64Ehdr), ElfParserError>

Parses the file header.

Source

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.

Source

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.

Source

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

Source

pub fn section_name( &self, sh_name: Elf64Word, ) -> Result<&'a [u8], ElfParserError>

Returns the string corresponding to the given sh_name

Source

pub fn symbol_name( &self, st_name: Elf64Word, ) -> Result<&'a [u8], ElfParserError>

Returns the name of the st_name symbol

Source

pub fn symbol_table(&self) -> Result<Option<&'a [Elf64Sym]>, ElfParserError>

Returns the symbol table

Source

pub fn dynamic_symbol_name( &self, st_name: Elf64Word, ) -> Result<&'a [u8], ElfParserError>

Returns the name of the st_name dynamic symbol

Source

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

Source

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

Source

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

Source

pub fn slice_from_bytes<T: 'static>( bytes: &[u8], range: Range<usize>, ) -> Result<&[T], ElfParserError>

Returns the &[T] contained at bytes[range]

Trait Implementations§

Source§

impl Debug for Elf64<'_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V