Struct lief::pe::Symbol

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

Structure that represents a PE-COFF symbol.

Usually PE debug information (including symbols) are wrapped in a PDB file referenced by the CodeViewPDB object.

The PE format allows to define (by COFF inheritance) a symbol table that is different from the regular PDB symbols. This table contains COFF(16) symbols which can reference auxiliary symbols.

Warning: The crate::generic::Symbol::value should be interpreted in perspective of the Symbol::storage_class.

Reference: https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#coff-symbol-table

Implementations§

§

impl Symbol<'_>

pub fn auxiliary_symbols(&self) -> ItAuxiliarySymbols<'_>

Auxiliary symbols associated with this symbol.

pub fn storage_class(&self) -> StorageClass

Storage class of the symbol which indicates what kind of definition a symbol represents.

pub fn base_type(&self) -> BaseType

The simple (base) data type

pub fn complex_type(&self) -> ComplexType

The complex type (if any)

pub fn section_idx(&self) -> i16

The signed integer that identifies the section, using a one-based index into the section table. Some values have special meaning:

  • 0: The symbol record is not yet assigned a section. A value of zero indicates that a reference to an external symbol is defined elsewhere. A value of non-zero is a common symbol with a size that is specified by the value.
  • -1: The symbol has an absolute (non-relocatable) value and is not an address.
  • -2: The symbol provides general type or debugging information but does not correspond to a section. Microsoft tools use this setting along with .file records

pub fn is_external(&self) -> bool

pub fn is_weak_external(&self) -> bool

pub fn is_undefined(&self) -> bool

pub fn is_function_line_info(&self) -> bool

pub fn is_file_record(&self) -> bool

Trait Implementations§

§

impl Debug for Symbol<'_>

§

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

Formats the value using the given formatter. Read more
§

impl Symbol for Symbol<'_>

§

fn name(&self) -> String

Symbol’s name
§

fn value(&self) -> u64

Symbol’s value whose interpretation depends on the symbol’s kind. Usually this is the address of the symbol though.
§

fn size(&self) -> u64

Size of the symbol (can be 0)

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Symbol<'a>

§

impl<'a> !Send for Symbol<'a>

§

impl<'a> !Sync for Symbol<'a>

§

impl<'a> Unpin for Symbol<'a>

§

impl<'a> !UnwindSafe for Symbol<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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, U> TryFrom<U> for Twhere 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 Twhere 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.