Struct object::read::elf::symbol::SymbolTable

source ·
pub struct SymbolTable<'data, Elf: FileHeader, R = &'data [u8]>
where R: ReadRef<'data>,
{ section: SectionIndex, string_section: SectionIndex, shndx_section: SectionIndex, symbols: &'data [Elf::Sym], strings: StringTable<'data, R>, shndx: &'data [U32<Elf::Endian>], }
Expand description

A table of symbol entries in an ELF file.

Also includes the string table used for the symbol names.

Returned by SectionTable::symbols.

Fields§

§section: SectionIndex§string_section: SectionIndex§shndx_section: SectionIndex§symbols: &'data [Elf::Sym]§strings: StringTable<'data, R>§shndx: &'data [U32<Elf::Endian>]

Implementations§

source§

impl<'data, Elf: FileHeader, R: ReadRef<'data>> SymbolTable<'data, Elf, R>

source

pub fn parse( endian: Elf::Endian, data: R, sections: &SectionTable<'data, Elf, R>, section_index: SectionIndex, section: &Elf::SectionHeader, ) -> Result<SymbolTable<'data, Elf, R>>

Parse the given symbol table section.

source

pub fn section(&self) -> SectionIndex

Return the section index of this symbol table.

source

pub fn shndx_section(&self) -> SectionIndex

Return the section index of the shndx table.

source

pub fn string_section(&self) -> SectionIndex

Return the section index of the linked string table.

source

pub fn strings(&self) -> StringTable<'data, R>

Return the string table used for the symbol names.

source

pub fn symbols(&self) -> &'data [Elf::Sym]

Return the symbol table.

source

pub fn iter(&self) -> Iter<'data, Elf::Sym>

Iterate over the symbols.

This includes the null symbol at index 0, which you will usually need to skip.

source

pub fn enumerate(&self) -> impl Iterator<Item = (SymbolIndex, &'data Elf::Sym)>

Iterate over the symbols and their indices.

This includes the null symbol at index 0, which you will usually need to skip.

source

pub fn is_empty(&self) -> bool

Return true if the symbol table is empty.

source

pub fn len(&self) -> usize

The number of symbols.

source

pub fn symbol(&self, index: SymbolIndex) -> Result<&'data Elf::Sym>

Get the symbol at the given index.

Returns an error for null entry at index 0.

source

pub fn shndx(&self, endian: Elf::Endian, index: SymbolIndex) -> Option<u32>

Return the extended section index for the given symbol if present.

source

pub fn symbol_section( &self, endian: Elf::Endian, symbol: &Elf::Sym, index: SymbolIndex, ) -> Result<Option<SectionIndex>>

Return the section index for the given symbol.

This uses the extended section index if present.

source

pub fn symbol_name( &self, endian: Elf::Endian, symbol: &Elf::Sym, ) -> Result<&'data [u8]>

Return the symbol name for the given symbol.

source

pub fn map<Entry: SymbolMapEntry, F: Fn(&'data Elf::Sym) -> Option<Entry>>( &self, endian: Elf::Endian, f: F, ) -> SymbolMap<Entry>

Construct a map from addresses to a user-defined map entry.

Trait Implementations§

source§

impl<'data, Elf: Clone + FileHeader, R> Clone for SymbolTable<'data, Elf, R>
where R: ReadRef<'data> + Clone, Elf::Sym: Clone, Elf::Endian: Clone,

source§

fn clone(&self) -> SymbolTable<'data, Elf, R>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'data, Elf: Debug + FileHeader, R> Debug for SymbolTable<'data, Elf, R>
where R: ReadRef<'data> + Debug, Elf::Sym: Debug, Elf::Endian: Debug,

source§

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

Formats the value using the given formatter. Read more
source§

impl<'data, Elf: FileHeader, R: ReadRef<'data>> Default for SymbolTable<'data, Elf, R>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'data, Elf: Copy + FileHeader, R> Copy for SymbolTable<'data, Elf, R>
where R: ReadRef<'data> + Copy, Elf::Sym: Copy, Elf::Endian: Copy,

Auto Trait Implementations§

§

impl<'data, Elf, R> Freeze for SymbolTable<'data, Elf, R>
where R: Freeze,

§

impl<'data, Elf, R> RefUnwindSafe for SymbolTable<'data, Elf, R>

§

impl<'data, Elf, R> Send for SymbolTable<'data, Elf, R>
where <Elf as FileHeader>::Sym: Sync, R: Send, <Elf as FileHeader>::Endian: Sync,

§

impl<'data, Elf, R> Sync for SymbolTable<'data, Elf, R>
where <Elf as FileHeader>::Sym: Sync, R: Sync, <Elf as FileHeader>::Endian: Sync,

§

impl<'data, Elf, R> Unpin for SymbolTable<'data, Elf, R>
where R: Unpin,

§

impl<'data, Elf, R> UnwindSafe for SymbolTable<'data, Elf, R>

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.