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§
- Address
Map - A mapping between addresses and offsets used in the PDB and PE file.
- Annotation
Reference Symbol - Reference to an annotation.
- Argument
List - The information parsed from a type record with kind
LF_ARGLIST
. - Array
Type - The information parsed from a type record with kind
LF_ARRAY
,LF_ARRAY_ST
orLF_STRIDED_ARRAY
. - Base
Class Type - The information parsed from a type record with kind
LF_BCLASS
orLF_BINTERFACE
. - Binary
Annotations - Binary annotations of a symbol.
- Binary
Annotations Iter - An iterator over binary annotations used by
S_INLINESITE
. - Bitfield
Type - The information parsed from a type record with kind
LF_BITFIELD
. - Block
Symbol - A block symbol.
- Build
Info Id - Tool, version and command line build information.
- Build
Info Symbol - Reference to build information.
- Class
Type - The information parsed from a type record with kind
LF_CLASS
,LF_CLASS_ST
,LF_STRUCTURE
,LF_STRUCTURE_ST
orLF_INTERFACE
. - Compile
Flags - Compile flags declared in
CompileFlagsSymbol
. - Compile
Flags Symbol - Flags used to compile a module.
- Compiler
Version - A version number refered to by
CompileFlagsSymbol
. - Constant
Symbol - A constant value.
- Cross
Module Export Iter - Iterator returned by
CrossModuleExports::exports
. - Cross
Module Exports - A table of exports declared by this module.
- Cross
Module Imports - Provides efficient access to imported types and IDs from other modules.
- Cross
Module Ref - Reference to a local type or id in another module.
- DBISection
Contribution - 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 - DBISection
Contribution Iter - A
DBISectionContributionIter
iterates over the section contributions in the DBI section, producingDBISectionContribution
s. - Data
Reference Symbol - Reference to an imported variable.
- Data
Symbol - Static data, such as a global variable.
- Debug
Information - Provides access to the “DBI” stream inside the PDB.
- Enumerate
Type - The information parsed from a type record with kind
LF_ENUMERATE
orLF_ENUMERATE_ST
. - Enumeration
Type - The information parsed from a type record with kind
LF_ENUM
orLF_ENUM_ST
. - Export
Symbol - An exported symbol.
- Export
Symbol Flags - Flags of an
ExportSymbol
. - Field
Attributes - Field
List - The information parsed from a type record with kind
LF_FIELDLIST
. - File
Index - Index of a file entry in the module.
- File
Info - Information record on a source file.
- File
Iterator - An iterator over file records in a module.
- Frame
Data - Frame data for a code block.
- Frame
Data Iter - Iterator over entries in a
FrameTable
. - Frame
Table - Describes stack frame layout of functions.
- Function
Attributes - Function
Id - Global function, usually inlined.
- IdIndex
- Index of an
Id
inIdInformation
stream. - Image
Section Header - A PE
IMAGE_SECTION_HEADER
, as described in the Microsoft documentation. - Inline
Site Symbol - The callsite of an inlined function.
- Inlinee
- An inlined function that can evaluate to line information.
- Inlinee
Iterator - An iterator over line information records in a module.
- Inlinee
Line Iterator - An iterator over line information records in a module.
- Item
- Represents an entry in the type or id stream.
- Item
Finder - In-memory index for efficient random-access to
Item
s by index. - Item
Information - Zero-copy access to a PDB type or id stream.
- Item
Iter - An iterator over items in
TypeInformation
orIdInformation
. - Label
Symbol - A label symbol.
- Line
Info - Mapping of a source code offset to a source file location.
- Line
Iterator - An iterator over line information records in a module.
- Line
Program - The
LineProgram
provides access to source line information for a module and its procedures. - Local
- An
ItemIndex
that is local to a module. - Local
Symbol - A local symbol in optimized code.
- Local
Variable Flags - Flags for a
LocalSymbol
. - Member
Function Id - Member function, usually inlined.
- Member
Function Type - The information parsed from a type record with kind
LF_MFUNCTION
. - Member
Type - The information parsed from a type record with kind
LF_MEMBER
orLF_MEMBER_ST
. - Method
List - The information parsed from a type record with kind
LF_METHODLIST
. - Method
List Entry - An entry in a
MethodList
. - Method
Type - The information parsed from a type record with kind
LF_ONEMETHOD
orLF_ONEMETHOD_ST
. - Modifier
Type - The information parsed from a type record with kind
LF_MODIFIER
. - Module
- Represents a module from the DBI stream.
- Module
Info - This struct contains data about a single module from its module info stream.
- Module
Iter - A
ModuleIter
iterates over the modules in the DBI section, producingModule
s. - Module
Ref - Named reference to a
Module
. - Multi
Register Variable Symbol - A Register variable spanning multiple registers.
- Nested
Type - The information parsed from a type record with kind
LF_NESTTYPE
,LF_NESTTYPE_ST
,LF_NESTTYPEEX
, orLF_NESTTYPEEX_ST
. - ObjName
Symbol - Name of the object file of this module.
- Overloaded
Method Type - The information parsed from a type record with kind
LF_METHOD
orLF_METHOD_ST
. - PDB
PDB
provides access to the data within a PDB file.- PDBInformation
- A PDB info stream header parsed from a stream.
- PdbInternal
Rva - A Relative Virtual Address in an unoptimized PE file.
- PdbInternal
RvaRange Iter - Iterator over
PdbInternalRva
ranges returned byAddressMap::internal_rva_ranges
. - PdbInternal
Section Offset - An offset relative to a PE section in the original unoptimized binary.
- Pointer
Attributes - Pointer
Type - The information parsed from a type record with kind
LF_POINTER
. - Primitive
Type - Represents a primitive type like
void
orchar *
. - Procedure
Flags - Flags of a
ProcedureSymbol
. - Procedure
Reference Symbol - Reference to an imported procedure.
- Procedure
Symbol - A procedure, such as a function or method.
- Procedure
Type - The information parsed from a type record with kind
LF_PROCEDURE
. - Public
Symbol - A public symbol with a mangled name.
- RawString
RawString
refers to a&[u8]
that physically resides somewhere inside a PDB data structure.- Register
- A register referred to by its number.
- Register
Relative Symbol - A register relative symbol.
- Register
Variable Symbol - A Register variable.
- Rva
- A Relative Virtual Address as it appears in a PE file.
- RvaRange
Iter - Iterator over
Rva
ranges returned byAddressMap::rva_ranges
. - Section
Characteristics - Characteristic flags of an
ImageSectionHeader
. - Section
Offset - An offset relative to a PE section.
- Separated
Code Flags - Flags for a
SeparatedCodeSymbol
. - Separated
Code Symbol - A separated code symbol.
- Source
Slice - Represents an offset + size of the source file.
- Static
Member Type - The information parsed from a type record with kind
LF_STMEMBER
orLF_STMEMBER_ST
. - Stream
Index - Index of a PDB stream.
- Stream
Name - A named stream contained within the PDB file.
- Stream
Names - A list of named streams contained within the PDB file.
- String
Id - A string.
- String
List Id - A list of substrings.
- String
Ref - A reference to a string in the string table.
- String
Table - The global string table of a PDB.
- Symbol
- Represents a symbol from the symbol table.
- Symbol
Index - A reference into the symbol table of a module.
- Symbol
Iter - A
SymbolIter
iterates over aSymbolTable
, producingSymbol
s. - Symbol
Table - PDB symbol tables contain names, locations, and metadata about functions, global/static data, constants, data types, and more.
- Thread
Storage Symbol - A thread local variable.
- Thunk
Adjustor - Thunk adjustor
- Thunk
Symbol - A thunk symbol.
- Trampoline
Symbol - Trampoline thunk.
- Type
Index - Index of
TypeData
in theTypeInformation
stream. - Type
Properties - Union
Type - The information parsed from a type record with kind
LF_UNION
orLF_UNION_ST
. - User
Defined Type Source Id - Source and line of the definition of a User Defined Type (UDT).
- User
Defined Type Symbol - A user defined type.
- Using
Namespace Symbol - A using namespace directive.
- Virtual
Base Class Type - The information parsed from a type record with kind
LF_VBCLASS
orLF_IVBCLASS
. - Virtual
Function Table Pointer Type - The information parsed from a type record with kind
LF_VFUNCTAB
.
Enums§
- Binary
Annotation - Represents a parsed
BinaryAnnotation
. - CPUType
- These values correspond to the CV_CPU_TYPE_e enumeration, and are documented on MSDN.
- Class
Kind - Used by
ClassType
to distinguish class-like concepts. - Cross
Module Export - A cross module export that can either be a
Type
or anId
. - Error
- An error that occurred while reading or parsing the PDB.
- File
Checksum - Checksum of a source file’s contents.
- Frame
Type - A compiler specific frame type.
- Header
Version - The version of the PDB format.
- IdData
- Encapsulates parsed data about an
Id
. - Indirection
- Pointer mode of primitive types.
- Line
Info Kind - The kind of source construct a line info is referring to.
- Machine
Type - The target machine’s architecture. Reference: https://docs.microsoft.com/en-us/windows/desktop/debug/pe-format#machine-types
- Pointer
Kind - The kind of a
PointerType
. - Pointer
Mode - The mode of a
PointerType
. - Primitive
Kind - A simple type.
- Source
Language - These values correspond to the CV_CFL_LANG enumeration, and are documented on MSDN.
- Symbol
Data - Information parsed from a
Symbol
record. - Thunk
Kind - A thunk kind
- Trampoline
Type - Subtype of
TrampolineSymbol
. - Type
Data - Encapsulates parsed data about a
Type
. - User
Defined Type Source File Ref - A reference to the source file name of a
UserDefinedTypeSourceId
. - Variant
- Value of an enumerate type.
Traits§
- Item
Index - An index into either the
TypeInformation
orIdInformation
stream. - Source
- The
pdb
crate accesses PDB files via thepdb::Source
trait. - Source
View - An owned, droppable, read-only view of the source file which can be referenced as a byte slice.
Type Aliases§
- Id
- Information on an inline function, build infos or source references.
- IdFinder
- In-memory index for efficient random-access of
Id
s by index. - IdInformation
- Zero-copy access to the PDB type stream (TPI).
- IdIter
- An iterator over
Id
s returned byIdInformation::iter
. - Name
Iter - An iterator over
StreamName
s. - Result
- The result type returned by this crate.
- Symbol
Kind - The raw type discriminator for
Symbols
. - Type
- Information on a primitive type, class, or procedure.
- Type
Finder - In-memory index for efficient random-access of
Type
s by index. - Type
Information - Zero-copy access to the PDB type stream (TPI).
- Type
Iter - An iterator over
Type
s returned byTypeInformation::iter
.