Expand description
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::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);
}
_ => {}
}
}
Re-exports
pub use fallible_iterator::FallibleIterator;
Structs
A mapping between addresses and offsets used in the PDB and PE file.
Reference to an annotation.
The information parsed from a type record with kind LF_ARGLIST
.
The information parsed from a type record with kind
LF_ARRAY
, LF_ARRAY_ST
or LF_STRIDED_ARRAY
.
The information parsed from a type record with kind LF_BCLASS
or LF_BINTERFACE
.
Binary annotations of a symbol.
An iterator over binary annotations used by S_INLINESITE
.
The information parsed from a type record with kind LF_BITFIELD
.
A block symbol.
Tool, version and command line build information.
Reference to build information.
The information parsed from a type record with kind
LF_CLASS
, LF_CLASS_ST
, LF_STRUCTURE
, LF_STRUCTURE_ST
or LF_INTERFACE
.
Compile flags declared in CompileFlagsSymbol
.
Flags used to compile a module.
A version number refered to by CompileFlagsSymbol
.
A constant value.
Iterator returned by CrossModuleExports::exports
.
A table of exports declared by this module.
Provides efficient access to imported types and IDs from other modules.
Reference to a local type or id in another module.
Information about a module’s contribution to a section.
struct SC
in Microsoft’s code:
https://github.com/Microsoft/microsoft-pdb/blob/082c5290e5aff028ae84e43affa8be717aa7af73/PDB/include/dbicommon.h#L42
A DBISectionContributionIter
iterates over the section contributions in the DBI section, producing DBISectionContribution
s.
Reference to an imported variable.
Static data, such as a global variable.
Provides access to the “DBI” stream inside the PDB.
The information parsed from a type record with kind LF_ENUMERATE
or LF_ENUMERATE_ST
.
The information parsed from a type record with kind LF_ENUM
or LF_ENUM_ST
.
An exported symbol.
Flags of an ExportSymbol
.
The information parsed from a type record with kind LF_FIELDLIST
.
Index of a file entry in the module.
Information record on a source file.
An iterator over file records in a module.
Frame data for a code block.
Iterator over entries in a FrameTable
.
Describes stack frame layout of functions.
Global function, usually inlined.
Index of an Id
in IdInformation
stream.
A PE IMAGE_SECTION_HEADER
, as described in the Microsoft documentation.
The callsite of an inlined function.
An inlined function that can evaluate to line information.
An iterator over line information records in a module.
An iterator over line information records in a module.
Represents an entry in the type or id stream.
In-memory index for efficient random-access to Item
s by index.
Zero-copy access to a PDB type or id stream.
An iterator over items in TypeInformation
or
IdInformation
.
A label symbol.
Mapping of a source code offset to a source file location.
An iterator over line information records in a module.
The LineProgram
provides access to source line information for a module and its procedures.
A local symbol in optimized code.
Flags for a LocalSymbol
.
Member function, usually inlined.
The information parsed from a type record with kind LF_MFUNCTION
.
The information parsed from a type record with kind LF_MEMBER
or LF_MEMBER_ST
.
The information parsed from a type record with kind LF_METHODLIST
.
An entry in a MethodList
.
The information parsed from a type record with kind LF_ONEMETHOD
or LF_ONEMETHOD_ST
.
The information parsed from a type record with kind LF_MODIFIER
.
Represents a module from the DBI stream.
This struct contains data about a single module from its module info stream.
A ModuleIter
iterates over the modules in the DBI section, producing Module
s.
A Register variable spanning multiple registers.
The information parsed from a type record with kind
LF_NESTTYPE
, LF_NESTTYPE_ST
, LF_NESTTYPEEX
, or LF_NESTTYPEEX_ST
.
Name of the object file of this module.
The information parsed from a type record with kind LF_METHOD
or LF_METHOD_ST
.
PDB
provides access to the data within a PDB file.
A PDB info stream header parsed from a stream.
A Relative Virtual Address in an unoptimized PE file.
Iterator over PdbInternalRva
ranges returned by AddressMap::internal_rva_ranges
.
An offset relative to a PE section in the original unoptimized binary.
The information parsed from a type record with kind LF_POINTER
.
Represents a primitive type like void
or char *
.
Flags of a ProcedureSymbol
.
Reference to an imported procedure.
A procedure, such as a function or method.
The information parsed from a type record with kind LF_PROCEDURE
.
A public symbol with a mangled name.
RawString
refers to a &[u8]
that physically resides somewhere inside a PDB data structure.
A register referred to by its number.
A register relative symbol.
A Register variable.
A Relative Virtual Address as it appears in a PE file.
Iterator over Rva
ranges returned by AddressMap::rva_ranges
.
Characteristic flags of an ImageSectionHeader
.
An offset relative to a PE section.
Flags for a SeparatedCodeSymbol
.
A separated code symbol.
Represents an offset + size of the source file.
The information parsed from a type record with kind LF_STMEMBER
or LF_STMEMBER_ST
.
Index of a PDB stream.
A named stream contained within the PDB file.
A list of named streams contained within the PDB file.
A string.
A list of substrings.
A reference to a string in the string table.
The global string table of a PDB.
Represents a symbol from the symbol table.
A reference into the symbol table of a module.
A SymbolIter
iterates over a SymbolTable
, producing Symbol
s.
PDB symbol tables contain names, locations, and metadata about functions, global/static data, constants, data types, and more.
A thread local variable.
Thunk adjustor
A thunk symbol.
Trampoline thunk.
Index of TypeData
in the TypeInformation
stream.
The information parsed from a type record with kind LF_UNION
or LF_UNION_ST
.
Source and line of the definition of a User Defined Type (UDT).
A user defined type.
A using namespace directive.
The information parsed from a type record with kind LF_VBCLASS
or LF_IVBCLASS
.
The information parsed from a type record with kind LF_VFUNCTAB
.
Enums
Represents a parsed BinaryAnnotation
.
Used by ClassType
to distinguish class-like concepts.
A cross module export that can either be a Type
or an Id
.
An error that occurred while reading or parsing the PDB.
Checksum of a source file’s contents.
A compiler specific frame type.
The version of the PDB format.
Encapsulates parsed data about an Id
.
Pointer mode of primitive types.
The kind of source construct a line info is referring to.
The target machine’s architecture. Reference: https://docs.microsoft.com/en-us/windows/desktop/debug/pe-format#machine-types
The kind of a PointerType
.
The mode of a PointerType
.
A simple type.
These values correspond to the CV_CFL_LANG enumeration, and are documented on MSDN.
Information parsed from a Symbol
record.
A thunk kind
Subtype of TrampolineSymbol
.
Encapsulates parsed data about a Type
.
A reference to the source file name of a UserDefinedTypeSourceId
.
Value of an enumerate type.
Traits
An index into either the TypeInformation
or
IdInformation
stream.
The pdb
crate accesses PDB files via the pdb::Source
trait.
An owned, droppable, read-only view of the source file which can be referenced as a byte slice.
Type Definitions
Information on an inline function, build infos or source references.
Zero-copy access to the PDB type stream (TPI).
An iterator over Id
s returned by IdInformation::iter
.
An iterator over StreamName
s.
The result type returned by this crate.
The raw type discriminator for Symbols
.
Information on a primitive type, class, or procedure.
In-memory index for efficient random-access of Type
s by index.
Zero-copy access to the PDB type stream (TPI).
An iterator over Type
s returned by TypeInformation::iter
.