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 = 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);
}
_ => {}
}
}
Re-exports§
pub use fallible_iterator::FallibleIterator;
Modules§
Structs§
- Address
Gap - A gap in a live range.
- Address
Map - A mapping between addresses and offsets used in the PDB and PE file.
- Address
Range - An address range of a live range.
- Alias
Type - The information parsed from a type record with kind
LF_ALIASorLF_ALIAS_ST. - Annotation
Reference Symbol - Reference to an annotation.
- Annotation
Symbol - Collection of annotation strings.
- Argument
List - The information parsed from a type record with kind
LF_ARGLIST. - ArmSwitch
Table Symbol - used to describe the layout of a jump table
- Array
Type - The information parsed from a type record with kind
LF_ARRAY,LF_ARRAY_STorLF_STRIDED_ARRAY. - Base
Class Type - The information parsed from a type record with kind
LF_BCLASSorLF_BINTERFACE. - Base
Pointer Relative Symbol - BP-Relative variable
- 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.
- COMToken
- COM+ metadata token for managed procedures (
CV_tkn_t). - Call
Site Info Symbol - Indirect call site information
- Class
Type - The information parsed from a type record with kind
LF_CLASS,LF_CLASS_ST,LF_STRUCTURE,LF_STRUCTURE_STorLF_INTERFACE. - Coff
Group Symbol - A COFF section in a PE executable.
- 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.
- DBIModule
Info - Information about a module parsed from the DBI stream.
- DBISection
Contribution - Information about a module’s contribution to a section.
struct SCin Microsoft’s code: https://github.com/Microsoft/microsoft-pdb/blob/082c5290e5aff028ae84e43affa8be717aa7af73/PDB/include/dbicommon.h#L42 - DBISection
Contribution Iter - A
DBISectionContributionIteriterates over the section contributions in the DBI section, producingDBISectionContributions. - DBISection
MapItem - See https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/syzygy/pdb/pdb_data.h#L172 Also see https://www.virtualbox.org/browser/vbox/trunk/include/iprt/formats/codeview.h?rev=93115#L272 This is also known as OMF Segment Map. In the OMF SegmentMap structure, flags and section_type are a single 16-bit value.
- DBISection
MapIter - A
DBISectionMapIteriterates over the section map in the DBI section, producingDBISectionMaps. - 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.
- DefRange
Frame Pointer Relative Full Scope Symbol - A frame variable valid in all function scope
- DefRange
Frame Pointer Relative Symbol - A live range of frame variable
- DefRange
Register Relative Symbol - A live range of variable related to a register.
- DefRange
Register Symbol - A live range of en-registed variable
- DefRange
SubField Register Symbol - A live range of sub field of variable. like locala.i
- DefRange
SubField Symbol - A live range of sub field of variable. like locala.i
- DefRange
Symbol - A live range of sub field of variable
- Enumerate
Type - The information parsed from a type record with kind
LF_ENUMERATEorLF_ENUMERATE_ST. - Enumeration
Type - The information parsed from a type record with kind
LF_ENUMorLF_ENUM_ST. - EnvBlock
Symbol - Environment block split off from
S_COMPILE2. - 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.
- File
Static Symbol - A static file symbol.
- Frame
Cookie Symbol - Description of a security cookie on a stack frame.
- Frame
Data - Frame data for a code block.
- Frame
Data Iter - Iterator over entries in a
FrameTable. - Frame
Procedure Flags - Frame procedure flags declared in
FrameProcedureSymbol - Frame
Procedure Symbol - Extra frame and proc information
- Frame
Table - Describes stack frame layout of functions.
- Function
Attributes - Function
Id - Global function, usually inlined.
- Function
List Symbol - A list of functions and their invocation counts.
- Heap
Allocation Site Symbol - Description of a heap allocation site.
- IdIndex
- Index of an
IdinIdInformationstream. - 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.
- Inlinees
Symbol - List of inlinees of a function
- Item
- Represents an entry in the type or id stream.
- Item
Finder - In-memory index for efficient random-access to
Items by index. - Item
Information - Zero-copy access to a PDB type or id stream.
- Item
Iter - An iterator over items in
TypeInformationorIdInformation. - 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
LineProgramprovides access to source line information for a module and its procedures. - Local
- An
ItemIndexthat is local to a module. - Local
Symbol - A local symbol in optimized code.
- Local
Variable Flags - Flags for a
LocalSymbol. - Managed
Procedure Symbol - A managed procedure, such as a function or method.
- Managed
Slot Symbol - A managed local variable slot.
- 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_MEMBERorLF_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_ONEMETHODorLF_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
ModuleIteriterates over the modules in the DBI section, producingModules. - 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.
- OemSymbol
- An OEM symbol.
- Overloaded
Method Type - The information parsed from a type record with kind
LF_METHODorLF_METHOD_ST. - PDB
PDBprovides 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
PdbInternalRvaranges 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
voidorchar *. - 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.
- Range
Flags - Flags of a
DefRangeRegisterSymbolorDefRangeSubFieldRegisterSymbol. - RawString
RawStringrefers 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
Rvaranges returned byAddressMap::rva_ranges. - Section
Characteristics - Characteristic flags of an
ImageSectionHeader. - Section
Offset - An offset relative to a PE section.
- Section
Symbol - A COFF section in a PE executable.
- 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_STMEMBERorLF_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
SymbolIteriterates over aSymbolTable, producingSymbols. - 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.
- Token
Reference Symbol - Reference to a managed procedure symbol (
S_LMANPROCorS_GMANPROC). - Trampoline
Symbol - Trampoline thunk.
- Type
Index - Index of
TypeDatain theTypeInformationstream. - Type
Properties - Union
Type - The information parsed from a type record with kind
LF_UNIONorLF_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_VBCLASSorLF_IVBCLASS. - Virtual
Function Table Pointer Type - The information parsed from a type record with kind
LF_VFUNCTAB. - Virtual
Function Table Type - The information parsed from a type record with kind
LF_VFTABLE. - Virtual
Table Shape Type - The information parsed from a type record with kind
LF_VTSHAPE.
Enums§
- Binary
Annotation - Represents a parsed
BinaryAnnotation. - CPUType
- These values correspond to the
CV_CPU_TYPE_eenumeration, and are documented on MSDN. - Class
Kind - Used by
ClassTypeto distinguish class-like concepts. - Cross
Module Export - A cross module export that can either be a
Typeor anId. - DBISection
MapItem Flag - Section flag values for the
DBISectionMapItem::flagsfield. - DBISection
MapItem Section Type - Section type values for the
DBISectionMapItem::flagsfield. - Error
- An error that occurred while reading or parsing the PDB.
- File
Checksum - Checksum of a source file’s contents.
- Frame
Cookie Type - Construction of the security cookie value.
- 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.
- Jump
Table Entry Size - Enumeration of possible jump table entry sizes.
- 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_LANGenumeration, and are documented on MSDN. - Symbol
Data - Information parsed from a
Symbolrecord. - 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.
- Virtual
Table Shape Descriptor
Constants§
- IMAGE_
SCN_ CNT_ CODE - The section contains executable code.
- IMAGE_
SCN_ MEM_ EXECUTE - The section can be executed as code.
- IMAGE_
SCN_ MEM_ READ - The section can be read.
- IMAGE_
SCN_ MEM_ WRITE - The section can be written to.
Traits§
- Item
Index - An index into either the
TypeInformationorIdInformationstream. - Source
- The
pdbcrate accesses PDB files via thepdb::Sourcetrait. - 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
Ids by index. - IdInformation
- Zero-copy access to the PDB type stream (TPI).
- IdIter
- An iterator over
Ids returned byIdInformation::iter. - Name
Iter - An iterator over
StreamNames. - 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
Types by index. - Type
Information - Zero-copy access to the PDB type stream (TPI).
- Type
Iter - An iterator over
Types returned byTypeInformation::iter.