Struct pdb2::SymbolTable

source ·
pub struct SymbolTable<'s> { /* private fields */ }
Expand description

PDB symbol tables contain names, locations, and metadata about functions, global/static data, constants, data types, and more.

The SymbolTable holds a SourceView referencing the symbol table inside the PDB file. All the data structures returned by a SymbolTable refer to that buffer.

Example

let file = std::fs::File::open("fixtures/self/foo.pdb")?;
let mut pdb = pdb2::PDB::open(file)?;

let symbol_table = pdb.global_symbols()?;
let address_map = pdb.address_map()?;

let mut symbols = symbol_table.iter();
while let Some(symbol) = symbols.next()? {
    match symbol.parse() {
        Ok(pdb2::SymbolData::Public(data)) if data.function => {
            // we found the location of a function!
            let rva = data.offset.to_rva(&address_map).unwrap_or_default();
            println!("{} is {}", rva, data.name);
        }
        _ => {}
    }
}

Implementations§

source§

impl<'s> SymbolTable<'s>

source

pub fn iter(&self) -> SymbolIter<'_>

Returns an iterator that can traverse the symbol table in sequential order.

source

pub fn iter_at(&self, index: SymbolIndex) -> SymbolIter<'_>

Returns an iterator over symbols starting at the given index.

Trait Implementations§

source§

impl<'s> Debug for SymbolTable<'s>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'s> !RefUnwindSafe for SymbolTable<'s>

§

impl<'s> Send for SymbolTable<'s>

§

impl<'s> Sync for SymbolTable<'s>

§

impl<'s> Unpin for SymbolTable<'s>

§

impl<'s> !UnwindSafe for SymbolTable<'s>

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.