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;
Structs§
- A mapping between addresses and offsets used in the PDB and PE file.
- The information parsed from a type record with kind
LF_ALIAS
orLF_ALIAS_ST
. - 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
orLF_STRIDED_ARRAY
. - The information parsed from a type record with kind
LF_BCLASS
orLF_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.
- COM+ metadata token for managed procedures (
CV_tkn_t
). - The information parsed from a type record with kind
LF_CLASS
,LF_CLASS_ST
,LF_STRUCTURE
,LF_STRUCTURE_ST
orLF_INTERFACE
. - A COFF section in a PE executable.
- 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, producingDBISectionContribution
s. - 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.
- A
DBISectionMapIter
iterates over the section map in the DBI section, producingDBISectionMap
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
orLF_ENUMERATE_ST
. - The information parsed from a type record with kind
LF_ENUM
orLF_ENUM_ST
. - Environment block split off from
S_COMPILE2
. - 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
inIdInformation
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
orIdInformation
. - 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. - An
ItemIndex
that is local to a module. - A local symbol in optimized code.
- Flags for a
LocalSymbol
. - A managed procedure, such as a function or method.
- A managed local variable slot.
- 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
orLF_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
orLF_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, producingModule
s. - Named reference to a
Module
. - A Register variable spanning multiple registers.
- The information parsed from a type record with kind
LF_NESTTYPE
,LF_NESTTYPE_ST
,LF_NESTTYPEEX
, orLF_NESTTYPEEX_ST
. - Name of the object file of this module.
- An OEM symbol.
- The information parsed from a type record with kind
LF_METHOD
orLF_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 byAddressMap::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
orchar *
. - 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 byAddressMap::rva_ranges
. - Characteristic flags of an
ImageSectionHeader
. - An offset relative to a PE section.
- A COFF section in a PE executable.
- 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
orLF_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 aSymbolTable
, producingSymbol
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.
- Reference to a managed procedure symbol (
S_LMANPROC
orS_GMANPROC
). - Trampoline thunk.
- Index of
TypeData
in theTypeInformation
stream. - The information parsed from a type record with kind
LF_UNION
orLF_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
orLF_IVBCLASS
. - The information parsed from a type record with kind
LF_VFUNCTAB
. - The information parsed from a type record with kind
LF_VFTABLE
. - The information parsed from a type record with kind
LF_VTSHAPE
.
Enums§
- Represents a parsed
BinaryAnnotation
. - These values correspond to the CV_CPU_TYPE_e enumeration, and are documented on MSDN.
- Used by
ClassType
to distinguish class-like concepts. - A cross module export that can either be a
Type
or anId
. - Section flag values for the
DBISectionMapItem::flags
field. - Section type values for the
DBISectionMapItem::flags
field. - 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.
Constants§
- The section contains executable code.
- The section can be executed as code.
- The section can be read.
- The section can be written to.
Traits§
- An index into either the
TypeInformation
orIdInformation
stream. - The
pdb
crate accesses PDB files via thepdb::Source
trait. - An owned, droppable, read-only view of the source file which can be referenced as a byte slice.
Type Aliases§
- Information on an inline function, build infos or source references.
- In-memory index for efficient random-access of
Id
s by index. - Zero-copy access to the PDB type stream (TPI).
- An iterator over
Id
s returned byIdInformation::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 byTypeInformation::iter
.