PdbFile
Description
Parsed PDB file. Holds the raw bytes (owned or borrowed) plus decoded indices into them.
Fields
| Name | Description |
|---|---|
allocator |
Allocator backing the byte buffer + functions vec. |
data |
Raw PDB bytes. |
data_size |
Length of data in bytes. |
owns_data |
True if data was allocated via allocator. |
block_size |
MSF page size (read from the superblock; usually 4096 but can be 512/1024/2048). |
num_streams |
Stream count from the directory. |
info |
Decoded PDB Info stream (#1). |
functions |
Sorted-by-rva list of public function names from the Publics stream. Populated by PdbFileOpen[FromMemory]. |
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Pdb.c:97:
build_msf_blob();
PdbFile pdb;
bool ok = PdbFileOpenFromMemory(&pdb, blob, sizeof(blob), base);
if (!ok) {- In
Pdb.c:123:
MemSet(garbage, 0xCC, sizeof(garbage));
PdbFile pdb;
bool ok = !PdbFileOpenFromMemory(&pdb, garbage, sizeof(garbage), base);- In
Pdb.c:285:
build_full_pdb_blob();
PdbFile pdb;
bool ok = PdbFileOpenFromMemory(&pdb, fblob, sizeof(fblob), base);
if (!ok) {- In
Pdb.c:137:
// Reconstruct the stream directory into a contiguous buffer.
static bool reconstruct_directory(PdbFile *self, u32 num_dir_bytes, u32 block_map_addr) {
// The block_map_addr page holds an array of u32 block indices,
// one per `block_size` chunk of the directory. The number of
- In
Pdb.c:182:
// Parse the reconstructed directory bytes into per-stream metadata.
static bool parse_directory(PdbFile *self) {
if (self->stream_dir_size < 4) {
LOG_ERROR("PDB: directory truncated (no stream count)");- In
Pdb.c:238:
// ---------------------------------------------------------------------------
static bool parse_pdb_info(PdbFile *self) {
if (self->num_streams <= 1)
return true; // no info stream
- In
Pdb.c:275:
} DbiSubstreamInfo;
static DbiSubstreamInfo parse_dbi_header(const PdbFile *self) {
DbiSubstreamInfo r = {0};
if (DBI_STREAM_INDEX >= self->num_streams)- In
Pdb.c:358:
// return a small allocator-backed array of (RVA, VSize) pairs. Caller
// frees via AllocatorFree.
static SectionRva *load_section_table(const PdbFile *self, u16 section_hdr_stream, u32 *out_count) {
*out_count = 0;
if (section_hdr_stream >= self->num_streams)- In
Pdb.c:431:
static bool walk_publics(
const PdbFile *self,
u16 symrec_stream,
const SectionRva *sections,- In
Pdb.c:512:
// Top-level: pull DBI -> SectionHdr table + SymRecord stream -> publics.
static bool parse_pdb_functions(PdbFile *self) {
DbiSubstreamInfo dbi = parse_dbi_header(self);
if (!dbi.ok)- In
Pdb.c:591:
// ---------------------------------------------------------------------------
bool PdbFileOpenFromMemory(PdbFile *out, u8 *data, size data_size, Allocator *alloc) {
if (!out || !data || !alloc) {
LOG_ERROR("PdbFileOpenFromMemory: NULL argument");- In
Pdb.c:623:
}
bool PdbFileOpen(PdbFile *out, const char *path, Allocator *alloc) {
if (!out || !path || !alloc) {
LOG_ERROR("PdbFileOpen: NULL argument");- In
Pdb.c:646:
}
void PdbFileDeinit(PdbFile *self) {
if (!self)
return;- In
Pdb.c:671:
}
const PdbFunction *PdbFileResolveRva(const PdbFile *self, u32 rva) {
if (!self || self->functions.length == 0)
return NULL;- In
PdbCache.h:36:
u64 module_base; // last-seen runtime load base
PeFile pe;
PdbFile pdb;
bool pe_open;
bool pdb_open;- In
Pdb.h:108:
size name_pool_size;
size name_pool_used;
} PdbFile;
///
- In
Pdb.h:119:
/// TAGS: Parser, PDB, File
///
bool PdbFileOpen(PdbFile *out, const char *path, Allocator *alloc);
///
- In
Pdb.h:130:
/// TAGS: Parser, PDB, Memory
///
bool PdbFileOpenFromMemory(PdbFile *out, u8 *data, size data_size, Allocator *alloc);
///
- In
Pdb.h:135:
/// Release storage owned by a `PdbFile`. Safe on a zeroed struct.
///
void PdbFileDeinit(PdbFile *self);
///
- In
Pdb.h:146:
/// FAILURE : Returns NULL.
///
const PdbFunction *PdbFileResolveRva(const PdbFile *self, u32 rva);
#endif // MISRA_PARSERS_PDB_H
Last updated on