[][src]Crate pdb

The pdb create parses Microsoft PDB (Program Database) files. PDB files contain debugging information produced by most compilers that target Windows, including information about symbols, types, modules, and so on.

Usage

PDB files are accessed via the pdb::PDB object.

Example

let file = std::fs::File::open("fixtures/self/foo.pdb")?;
let mut pdb = pdb::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(pdb::SymbolData::PublicSymbol(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, symbol.name()?);
        }
        _ => {}
    }
}

Re-exports

pub use fallible_iterator::FallibleIterator;

Structs

AddressMap

A mapping between addresses and offsets used in the PDB and PE file.

AnnotationReferenceSymbol

The information parsed from a symbol record with kind S_ANNOTATIONREF.

ArgumentList

The information parsed from a type record with kind LF_ARGLIST.

ArrayType

The information parsed from a type record with kind LF_ARRAY, LF_ARRAY_ST or LF_STRIDED_ARRAY.

BaseClassType

The information parsed from a type record with kind LF_BCLASS or LF_BINTERFACE.

BitfieldType

The information parsed from a type record with kind LF_BITFIELD.

ClassType

The information parsed from a type record with kind LF_CLASS, LF_CLASS_ST, LF_STRUCTURE, LF_STRUCTURE_ST or LF_INTERFACE.

Compile3Symbol

The information parsed from a symbol record with kind S_COMPILE3

ConstantSymbol

The information parsed from a symbol record with kind S_CONSTANT, or S_CONSTANT_ST.

DataReferenceSymbol

The information parsed from a symbol record with kind S_DATAREF or S_DATAREF_ST.

DataSymbol

The information parsed from a symbol record with kind S_LDATA32, S_LDATA32_ST, S_GDATA32, S_GDATA32_ST, S_LMANDATA, S_LMANDATA_ST, S_GMANDATA, or S_GMANDATA_ST.

DebugInformation

Provides access to the "DBI" stream inside the PDB.

EnumerateType

The information parsed from a type record with kind LF_ENUMERATE or LF_ENUMERATE_ST.

EnumerationType

The information parsed from a type record with kind LF_ENUM or LF_ENUM_ST.

FieldAttributes
FieldList

The information parsed from a type record with kind LF_FIELDLIST.

FunctionAttributes
ImageSectionHeader

A PE IMAGE_SECTION_HEADER, as described in the Microsoft documentation.

MemberFunctionType

The information parsed from a type record with kind LF_MFUNCTION.

MemberType

The information parsed from a type record with kind LF_MEMBER or LF_MEMBER_ST.

MethodList

The information parsed from a type record with kind LF_METHODLIST.

MethodListEntry

An entry in a MethodList.

MethodType

The information parsed from a type record with kind LF_ONEMETHOD or LF_ONEMETHOD_ST.

ModifierType

The information parsed from a type record with kind LF_MODIFIER.

Module

Represents a module from the DBI stream.

ModuleInfo

This struct contains data about a single module from its module info stream.

ModuleIter

A ModuleIter iterates over the modules in the DBI section, producing Modules.

NamespaceSymbol

The information parsed from a symbol record with kind S_UNAMESPACE, or S_UNAMESPACE_ST.

NestedType

The information parsed from a type record with kind LF_NESTTYPE, LF_NESTTYPE_ST, LF_NESTTYPEEX, or LF_NESTTYPEEX_ST.

ObjNameSymbol

The information parsed from a symbol record with kind S_OBJNAME, or S_OBJNAME_ST.

OverloadedMethodType

The information parsed from a type record with kind LF_METHOD or LF_METHOD_ST.

PDB

PDB provides access to the data within a PDB file.

PDBInformation

A PDB info stream header parsed from a stream.

PdbInternalRva

A Relative Virtual Address in an unoptimized PE file.

PdbInternalSectionOffset

An offset relative to a PE section in the original unoptimized binary.

PointerAttributes
PointerType

The information parsed from a type record with kind LF_POINTER.

PrimitiveType

Represents a primitive type like void or char *.

ProcedureFlags

The information parsed from a CV_PROCFLAGS bit field

ProcedureReferenceSymbol

The information parsed from a symbol record with kind S_PROCREF, S_PROCREF_ST, S_LPROCREF, or S_LPROCREF_ST.

ProcedureSymbol

The information parsed from a symbol record with kind S_GPROC32, S_GPROC32_ST, S_LPROC32, S_LPROC32_ST S_GPROC32_ID, S_LPROC32_ID, S_LPROC32_DPC, or S_LPROC32_DPC_ID

ProcedureType

The information parsed from a type record with kind LF_PROCEDURE.

PublicSymbol

The information parsed from a symbol record with kind S_PUB32 or S_PUB32_ST.

RawString

RawString refers to a &[u8] that physically resides somewhere inside a PDB data structure.

Rva

A Relative Virtual Address as it appears in a PE file.

SectionOffset

An offset relative to a PE section.

SourceSlice

Represents an offset + size of the source file.

StaticMemberType

The information parsed from a type record with kind LF_STMEMBER or LF_STMEMBER_ST.

StreamName

A named stream contained within the PDB file.

StreamNames

A list of named streams contained within the PDB file.

Symbol

Represents a symbol from the symbol table.

SymbolIter

A SymbolIter iterates over a SymbolTable, producing Symbols.

SymbolTable

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

ThreadStorageSymbol

The information parsed from a symbol record with kind S_LTHREAD32, S_LTHREAD32_ST, S_GTHREAD32, or S_GTHREAD32_ST.

Type

Represents a type from the type table. A Type has been minimally processed and may not be correctly formed or even understood by this library.

TypeFinder

A TypeFinder is a secondary, in-memory data structure that permits efficiently finding types by TypeIndex. It starts out empty and must be populated by calling update(&TypeIter) while iterating.

TypeInformation

TypeInformation provides zero-copy access to a PDB type data stream.

TypeIter

A TypeIter iterates over a TypeInformation, producing Typess.

TypeProperties
UnionType

The information parsed from a type record with kind LF_UNION or LF_UNION_ST.

UserDefinedTypeSymbol

The information parsed from a symbol record with kind S_UDT, or S_UDT_ST.

VirtualBaseClassType

The information parsed from a type record with kind LF_VBCLASS or LF_IVBCLASS.

VirtualFunctionTablePointerType

The information parsed from a type record with kind LF_VFUNCTAB.

Enums

ClassKind

Used by ClassType to distinguish class-like concepts.

Error

An error that occurred while reading or parsing the PDB.

HeaderVersion

The version of the PDB format.

Indirection

Pointer kinds.

MachineType

The target machine's architecture. Reference: https://docs.microsoft.com/en-us/windows/desktop/debug/pe-format#machine-types

PrimitiveKind
SymbolData

SymbolData contains the information parsed from a symbol record.

TypeData

Encapsulates parsed data about a Type.

Variant

Value of an enumerate type.

Traits

Source

The pdb crate accesses PDB files via the pdb::Source trait.

SourceView

An owned, droppable, read-only view of the source file which can be referenced as a byte slice.

Type Definitions

NameIter

An iterator over StreamNames.

Result

The result type returned by this crate.

TypeIndex

TypeIndex refers to a type somewhere in PDB.type_information().