VirtualBox

Changeset 100914 in vbox for trunk/include/iprt/formats


Ignore:
Timestamp:
Aug 21, 2023 2:32:45 AM (21 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
158851
Message:

IPRT/pdbvfs: Parse the DBI header and optional header and pick up stream names from it. Also provide the DBI substreams as individual files for simpler access.

Location:
trunk/include/iprt/formats
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/formats/pdb.h

    r100909 r100914  
    324324}
    325325
     326
     327/**
     328 * This is the old DBI stream header.
     329 *
     330 * @note Haven't found any examples of this yet, as it must predate VC60, quite
     331 *       likely VC40 was the last to use it.  It may need padding adjusting as
     332 *       well as a reality check...
     333 */
     334typedef struct RTPDBDBIHDROLD
     335{
     336    /** The global symbol records stream number. */
     337    uint16_t    idxGlobalStream;
     338    /** The public symbol records stream number. */
     339    uint16_t    idxPublicStream;
     340    /** The symbol records stream. */
     341    uint16_t    idxSymRecStream;
     342    /** Haven't seen the real thing yet... The struct could be misaligned by
     343     *  pragma pack(1)... */
     344    uint16_t    uUnusedPadding;
     345    /** Size of the module info substream. */
     346    uint32_t    cbModInfoSubstream;
     347    /** Size of the section contribution substream. */
     348    uint32_t    cbSectContribSubstream;
     349    /** Size of the source info substream. */
     350    uint32_t    cbSrcInfoSubstream;
     351} RTPDBDBIHDROLD;
     352
     353
     354/**
     355 * The new DBI stream header.
     356 */
     357typedef struct RTPDBDBIHDR
     358{
     359    /** 0x00: Header signature, RTPDBDBIHDR_SIGNATURE.
     360     * This has the value UINT32_MAX which probably to make sure it can be
     361     * distinguished from the start of the old header, assuming the global and/or
     362     * public stream indexes won't both be NIL (UINT16_MAX). */
     363    uint32_t        uSignature;
     364    /** 0x04: The header version signature, RTPDBDBIHDR_VCVER_XXX.
     365     * This should be RTPDBDBIHDR_VCVER_50 or higher, even if Visual C++ 4.1 in
     366     * the RTPDBDBIHDR_VCVER_XXX collection. */
     367    uint32_t        uVcVersion;
     368    /** 0x08: Same (copy) of RTPDB70NAMES::uAge / RTPDB20NAMES::uAge. */
     369    uint32_t        uAge;
     370    /** 0x0c: The global symbol records stream number. */
     371    uint16_t        idxGlobalStream;
     372    /** 0x0e: The MSPDB*.DLL version.
     373     * This is a bitfield with two different layout.  If the new format is used,
     374     * the RBuild is stored separately as uPdbDllRBuild
     375     *
     376     * @note In the w2ksp4 PDBs this is all zeros. So, was presumably added
     377     *       after VC60.  Ditto for the two other version/build fields.
     378     *
     379     *       In a random 32-bit xp rtm kernel it's set to 0x8800 (8.0, new format),
     380     *       and with uPdbDllBuild=0xc627 (50727) and uPdbDllRBuild=0x0048 (72).
     381     *
     382     *       For a VBoxRT.dll built with VC 2010 this is set to 0x8a00 (10.0, new
     383     *       format), uPdbDllBuild=0x6f76 (28534) and uPdbDllRBuild=0x0001. */
     384    union
     385    {
     386        uint16_t    u16;
     387        struct
     388        {
     389            uint16_t    uMinor     : 8;
     390            uint16_t    uMajor     : 7;
     391            uint16_t    fNewVerFmt : 1;
     392        } New;
     393        struct
     394        {
     395            uint16_t    uRBuild    : 4;
     396            uint16_t    uMinor     : 7;
     397            uint16_t    uMajor     : 5;
     398        } Old;
     399    } PdbDllVer;
     400    /** 0x10: The public symbol records stream number. */
     401    uint16_t        idxPublicStream;
     402    /** 0x12: The MSPDB*.DLL build number. */
     403    uint16_t        uPdbDllBuild;
     404    /** 0x14: The symbol records stream. */
     405    uint16_t        idxSymRecStream;
     406    /** 0x16: The MSPDB*.DLL rbuild number, whatever that is... (Release build
     407     * number, perhaps?) */
     408    uint16_t        uPdbDllRBuild;
     409    /** 0x18: Size of the module info substream. */
     410    uint32_t        cbModInfoSubstream;
     411    /** 0x1c: Size of the section contribution substream. */
     412    uint32_t        cbSectContribSubstream;
     413    /** 0x20: Size of the section map substream. */
     414    uint32_t        cbSectionMapSubstream;
     415    /** 0x24: Size of the source info substream. */
     416    uint32_t        cbSrcInfoSubstream;
     417    /** 0x28: Size of the type server map substream. */
     418    uint32_t        cbTypeServerMapSubstream;
     419    /** 0x2c: Index of the MFC type server in the type server map substream. */
     420    uint32_t        idxMFC;
     421    /** 0x30: Size of the optional debug header at the end of the stream. */
     422    uint32_t        cbOptDbgHdr;
     423    /** 0x34: Size of the edit & continue substream. Added in VC60, can contain
     424     *  garbage when uVcVersion is older. */
     425    uint32_t        cbEditContinueSubstream;
     426    /** 0x38: Flat, combination of RTPDBDBIHDR_F_XXX. */
     427    uint16_t        fFlags;
     428    /** 0x3a: The machine type (IMAGE_FILE_MACHINE_XXX from pecoff). */
     429    uint16_t        uMachine;
     430    /** 0x3c: Currently unused field.   */
     431    uint32_t        uReserved;
     432} RTPDBDBIHDR;
     433AssertCompileSize(RTPDBDBIHDR,64);
     434
     435/** The value of RTPDBDBIHDR::uSignature. */
     436#define RTPDBDBIHDR_SIGNATURE   UINT32_MAX
     437
     438/** @name RTPDBDBIHDR_VCVER_XXX - Possible RTPDBDBIHDR::uVcVersion values.
     439 * @{ */
     440#define RTPDBDBIHDR_VCVER       RTPDBDBIHDR_VCVER_70
     441#define RTPDBDBIHDR_VCVER_41    UINT32_C(  930803)  /**< Apparently too old for the new header. Go figure. */
     442#define RTPDBDBIHDR_VCVER_50    UINT32_C(19960307)
     443#define RTPDBDBIHDR_VCVER_60    UINT32_C(19970606)  /**< Used by Windows 2000 SP4 PDBs.*/
     444#define RTPDBDBIHDR_VCVER_70    UINT32_C(19990903)
     445#define RTPDBDBIHDR_VCVER_110   UINT32_C(20091201)
     446/** @} */
     447
     448/** @name RTPDBDBIHDR_F_XXX - DBI Header Flags.
     449 * @{ */
     450#define RTPDBDBIHDR_F_INCREMENTAL_LINK      UINT16_C(0x0001)
     451#define RTPDBDBIHDR_F_PRIVATE_SYMS_STRIPPED UINT16_C(0x0002)
     452#define RTPDBDBIHDR_F_CONFLICTING_TYPES     UINT16_C(0x0004)
     453#define RTPDBDBIHDR_F_RESERVED              UINT16_C(0xfff8)
     454/** @} */
     455
     456
     457/** @name RTPDBDBIOPT_IDX_XXX - DBI Optional Header Indexes.
     458 *
     459 * The optional DBI header follows after the edit & continue substream and
     460 * consists of an array of 16-bit stream indexes (uint16_t) that helps
     461 * identifying streams in the PDB.
     462 *
     463 * @{ */
     464/** Frame pointer optimization sections ('.debug$F' from MASM, apparently). */
     465#define RTPDBDBIOPT_IDX_FPO_MASM            0
     466/** Exception data - IMAGE_DEBUG_TYPE_EXCEPTION. */
     467#define RTPDBDBIOPT_IDX_EXCEPTION           1
     468/** Fixup data - IMAGE_DEBUG_TYPE_FIXUP. */
     469#define RTPDBDBIOPT_IDX_FIXUP               2
     470/** OMAP to source - IMAGE_DEBUG_TYPE_OMAP_TO_SRC. */
     471#define RTPDBDBIOPT_IDX_OMAP_TO_SRC         3
     472/** OMAP from source - IMAGE_DEBUG_TYPE_OMAP_FROM_SRC. */
     473#define RTPDBDBIOPT_IDX_OMAP_FROM_SRC       4
     474/** Section headers from the executable (array of IMAGE_SECTION_HEADER). */
     475#define RTPDBDBIOPT_IDX_SECTION_HEADERS     5
     476/** Something related to mapping CLR tokens to CLR record IDs. */
     477#define RTPDBDBIOPT_IDX_CLR_TOKEN_ID_MAP    6
     478/** Copy of the '.xdata' section. */
     479#define RTPDBDBIOPT_IDX_XDATA               7
     480/** Copy of the '.pdata' section. (Same purpose as RTPDBDBIOPT_IDX_EXCEPTION?) */
     481#define RTPDBDBIOPT_IDX_PDATA               8
     482/** Frame pointer optimization info - IMAGE_DEBUG_TYPE_FPO. */
     483#define RTPDBDBIOPT_IDX_FPO                 9
     484/** Original section headers from the executable (array of IMAGE_SECTION_HEADER). */
     485#define RTPDBDBIOPT_IDX_ORG_SECTION_HEADERS 10
     486
     487/** End of known indexes. */
     488#define RTPDBDBIOPT_IDX_END                 11
     489/** @} */
     490
    326491/** @} */
    327492
  • trunk/include/iprt/formats/pecoff.h

    r98103 r100914  
    7272
    7373
    74 /** @name PE & COFF machine types.
     74/** @name IMAGE_FILE_MACHINE_XXX - PE & COFF machine types.
    7575 * Used by IMAGE_FILE_HEADER::Machine and IMAGE_SEPARATE_DEBUG_HEADER::Machine.
    7676 * @{ */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette