Skip to content
PeCodeViewInfo

PeCodeViewInfo

Description

CodeView debug record extracted from the PE Debug Directory. The matching PDB file is identified by its (guid, age) pair; the pdb_path is a hint from the linker (usually an absolute path on the build machine – callers should treat it as a basename plus fallback search rather than an authoritative location).

Fields

Name Description
present True if the PE contained a CodeView entry. False for binaries built without -debug / /DEBUG or stripped of debug info entirely.
guid 16-byte unique identifier matching the corresponding PDB’s signature.
age Generation counter incremented on every PDB write; the PDB must have the same age to be considered a match.
pdb_path NUL-terminated string borrowed from the PE bytes. Valid until PeDeinit.

Usage example (Cross-references)

Usage examples (Cross-references)
        u32  age;
        Zstr pdb_path;
    } PeCodeViewInfo;
    
    ///
        u32            size_of_image;
        PeSections     sections;
        PeCodeViewInfo codeview;
    } Pe;
    // On success populates `out_path` (an owned Str the caller frees).
    static bool find_pdb(const Pe *pe, Zstr pe_path, Str *out_path) {
        const PeCodeViewInfo *cv = PeCodeView(pe);
        if (!cv->present || !cv->pdb_path)
            return false;
        // Validate the (GUID, age) pair matches. If the PE and PDB
        // disagree the names are probably stale -- worse than no symbols.
        const PeCodeViewInfo *pe_cv   = PeCodeView(&entry->pe);
        const PdbInfo        *pdb_inf = PdbInfoStream(&entry->pdb);
        if (pe_cv->age != pdb_inf->age || MemCompare(pe_cv->guid, pdb_inf->guid, 16) != 0) {
    // it to a file offset first.
    static void pe_decode_codeview(PeContext *ctx) {
        PeCodeViewInfo *cv = &ctx->out->codeview;
        cv->present        = false;
Last updated on