Index: /trunk/include/iprt/formats/codeview.h
===================================================================
--- /trunk/include/iprt/formats/codeview.h	(revision 58661)
+++ /trunk/include/iprt/formats/codeview.h	(revision 58662)
@@ -35,4 +35,687 @@
  * @{
  */
+
+
+/**
+ * CodeView Header.  There are two of this, base header at the start of the debug
+ * information and a trailing header at the end.
+ */
+typedef struct RTCVHDR
+{
+    /** The magic ('NBxx'), see RTCVHDR_MAGIC_XXX. */
+    uint32_t    u32Magic;
+    /**
+     * Base header: Subsection directory offset relative to this header (start).
+     * Trailing header: Offset of the base header relative to the end of the file.
+     *
+     * Called lfoBase, lfaBase, lfoDirectory, lfoDir and probably other things in
+     * the various specs/docs available. */
+    uint32_t    off;
+} RTCVHDR;
+/** Pointer to a CodeView header. */
+typedef RTCVHDR *PRTCVHDR;
+
+/** @name CodeView magic values (RTCVHDR::u32Magic).
+ * @{  */
+/** CodeView from Visual C++ 5.0.  Specified in the 2001 MSDN specs.chm file. */
+#define RTCVHDR_MAGIC_NB11  RT_MAKE_U32_FROM_U8('N', 'B', '1', '1')
+/** External PDB reference (often referred to as PDB 2.0). */
+#define RTCVHDR_MAGIC_NB10  RT_MAKE_U32_FROM_U8('N', 'B', '1', '0')
+/** CodeView v4.10, packed. Specified in the TIS document. */
+#define RTCVHDR_MAGIC_NB09  RT_MAKE_U32_FROM_U8('N', 'B', '0', '9')
+/** CodeView v4.00 thru v4.05.  Specified in the TIS document?  */
+#define RTCVHDR_MAGIC_NB08  RT_MAKE_U32_FROM_U8('N', 'B', '0', '8')
+/** Quick C for Windows 1.0 debug info. */
+#define RTCVHDR_MAGIC_NB07  RT_MAKE_U32_FROM_U8('N', 'B', '0', '7')
+/** Emitted by ILINK indicating incremental link. Comparable to NB05?  */
+#define RTCVHDR_MAGIC_NB06  RT_MAKE_U32_FROM_U8('N', 'B', '0', '6')
+/** Emitted by LINK version 5.20 and later before packing. */
+#define RTCVHDR_MAGIC_NB05  RT_MAKE_U32_FROM_U8('N', 'B', '0', '5')
+/** Emitted by IBM ILINK for HLL (similar to NB02 in many ways). */
+#define RTCVHDR_MAGIC_NB04  RT_MAKE_U32_FROM_U8('N', 'B', '0', '4')
+/** Emitted by LINK version 5.10 (or similar OMF linkers), as shipped with
+ * Microsoft C v6.0 for example.  More or less entirely 16-bit. */
+#define RTCVHDR_MAGIC_NB02  RT_MAKE_U32_FROM_U8('N', 'B', '0', '2')
+/* No idea what NB03 might have been. */
+/** AIX debugger format according to "IBM OS/2 16/32-bit Object Module Format
+ *  (OMF) and Linear eXecutable Module Format (LX)" revision 10 (LXOMF.PDF). */
+#define RTCVHDR_MAGIC_NB01  RT_MAKE_U32_FROM_U8('N', 'B', '0', '1')
+/** Ancient CodeView format according to LXOMF.PDF. */
+#define RTCVHDR_MAGIC_NB00  RT_MAKE_U32_FROM_U8('N', 'B', '0', '0')
+/** @} */
+
+
+/** @name CV directory headers.
+ * @{ */
+
+/**
+ * Really old CV directory header used with NB00 and NB02.
+ *
+ * Uses 16-bit directory entires (RTCVDIRENT16).
+ */
+typedef struct RTCVDIRHDR16
+{
+    /** The number of directory entries. */
+    uint16_t        cEntries;
+} RTCVDIRHDR16;
+/** Pointer to a old CV directory header. */
+typedef RTCVDIRHDR16 *PRTCVDIRHDR16;
+
+/**
+ * Simple 32-bit CV directory base header, used by NB04 (aka IBM HLL).
+ */
+typedef struct RTCVDIRHDR32
+{
+    /** The number of bytes of this header structure. */
+    uint16_t        cbHdr;
+    /** The number of bytes per entry. */
+    uint16_t        cbEntry;
+    /** The number of directory entries. */
+    uint32_t        cEntries;
+} RTCVDIRHDR32;
+/** Pointer to a 32-bit CV directory header. */
+typedef RTCVDIRHDR32 *PRTCVDIRHDR32;
+
+/**
+ * Extended 32-bit CV directory header as specified in the TIS doc.
+ * The two extra fields seems to never have been assigned any official purpose.
+ */
+typedef struct RTCVDIRHDR32EX
+{
+    /** This starts the same way as the NB04 header. */
+    RTCVDIRHDR32    Core;
+    /** Tentatively decleared as the offset to the next directory generated by
+     * the incremental linker.  Haven't seen this used yet. */
+    uint32_t        offNextDir;
+    /** Flags, non defined apparently, so MBZ. */
+    uint32_t        fFlags;
+} RTCVDIRHDR32EX;
+/** Pointer to an extended 32-bit CV directory header. */
+typedef RTCVDIRHDR32EX *PRTCVDIRHDR32EX;
+
+/** @} */
+
+
+/**
+ * 16-bit CV directory entry used with NB00 and NB02.
+ */
+typedef struct RTCVDIRENT16
+{
+    /** Subsection type (RTCVSST). */
+    uint16_t        uSubSectType;
+    /** Which module (1-based, 0xffff is special). */
+    uint16_t        iMod;
+    /** The lowe offset of this subsection relative to the base CV header. */
+    uint16_t        offLow;
+    /** The high part of the subsection offset. */
+    uint16_t        offHigh;
+    /** The size of the subsection. */
+    uint16_t        cb;
+} RTCVDIRENT16;
+AssertCompileSize(RTCVDIRENT16, 10);
+/** Pointer to a 16-bit CV directory entry. */
+typedef RTCVDIRENT16 *PRTCVDIRENT16;
+
+
+/**
+ * 32-bit CV directory entry used starting with NB04.
+ */
+typedef struct RTCVDIRENT32
+{
+    /** Subsection type (RTCVSST). */
+    uint16_t        uSubSectType;
+    /** Which module (1-based, 0xffff is special). */
+    uint16_t        iMod;
+    /** The offset of this subsection relative to the base CV header. */
+    uint32_t        off;
+    /** The size of the subsection. */
+    uint32_t        cb;
+} RTCVDIRENT32;
+AssertCompileSize(RTCVDIRENT32, 12);
+/** Pointer to a 32-bit CV directory entry. */
+typedef RTCVDIRENT32 *PRTCVDIRENT32;
+/** Pointer to a const 32-bit CV directory entry. */
+typedef RTCVDIRENT32 const *PCRTCVDIRENT32;
+
+
+/**
+ * CodeView subsection types.
+ */
+typedef enum RTCVSST
+{
+    /** @name NB00, NB02 and NB04 subsection types.
+     * The actual format of each subsection varies between NB04 and the others,
+     * and it may further vary in NB04 depending on the module type.
+     * @{ */
+    kCvSst_OldModule    = 0x101,
+    kCvSst_OldPublic,
+    kCvSst_OldTypes,
+    kCvSst_OldSymbols,
+    kCvSst_OldSrcLines,
+    kCvSst_OldLibraries,
+    kCvSst_OldImports,
+    kCvSst_OldCompacted,
+    kCvSst_OldSrcLnSeg = 0x109,
+    kCvSst_OldSrcLines3 = 0x10b,
+    /** @} */
+
+    /** @name NB09, NB11 (and possibly NB05, NB06, NB07, and NB08) subsection types.
+     * @{ */
+    kCvSst_Module    = 0x120,
+    kCvSst_Types,
+    kCvSst_Public,
+    kCvSst_PublicSym,
+    kCvSst_Symbols,
+    kCvSst_AlignSym,
+    kCvSst_SrcLnSeg,
+    kCvSst_SrcModule,
+    kCvSst_Libraries,
+    kCvSst_GlobalSym,
+    kCvSst_GlobalPub,
+    kCvSst_GlobalTypes,
+    kCvSst_MPC,
+    kCvSst_SegMap,
+    kCvSst_SegName,
+    kCvSst_PreComp,
+    kCvSst_PreCompMap,
+    kCvSst_OffsetMap16,
+    kCvSst_OffsetMap32,
+    kCvSst_FileIndex = 0x133,
+    kCvSst_StaticSym
+    /** @} */
+} RTCVSST;
+/** Pointer to a CV subsection type value.  */
+typedef RTCVSST *PRTCVSST;
+/** Pointer to a const CV subsection type value.  */
+typedef RTCVSST const *PCRTCVSST;
+
+
+/**
+ * CV4 module segment info.
+ */
+typedef struct RTCVMODSEGINFO32
+{
+    /** The segment number. */
+    uint16_t        iSeg;
+    /** Explicit padding. */
+    uint16_t        u16Padding;
+    /** Offset into the segment. */
+    uint32_t        off;
+    /** The size of the contribution. */
+    uint32_t        cb;
+} RTCVMODSEGINFO32;
+typedef RTCVMODSEGINFO32 *PRTCVMODSEGINFO32;
+typedef RTCVMODSEGINFO32 const *PCRTCVMODSEGINFO32;
+
+
+/**
+ * CV4 segment map header.
+ */
+typedef struct RTCVSEGMAPHDR
+{
+    /** Number of segments descriptors in the table. */
+    uint16_t        cSegs;
+    /** Number of logical segment descriptors. */
+    uint16_t        cLogSegs;
+} RTCVSEGMAPHDR;
+/** Pointer to a CV4 segment map header. */
+typedef RTCVSEGMAPHDR *PRTCVSEGMAPHDR;
+/** Pointer to a const CV4 segment map header. */
+typedef RTCVSEGMAPHDR const *PCRTCVSEGMAPHDR;
+
+/**
+ * CV4 Segment map descriptor entry.
+ */
+typedef struct RTCVSEGMAPDESC
+{
+    /** Segment flags. */
+    uint16_t        fFlags;
+    /** The overlay number. */
+    uint16_t        iOverlay;
+    /** Group index into this segment descriptor array. 0 if not relevant.
+     * The group descriptors are found in the second half of the table.  */
+    uint16_t        iGroup;
+    /** Complicated. */
+    uint16_t        iFrame;
+    /** Offset (byte) into the kCvSst_SegName table of the segment name, or
+     * 0xffff. */
+    uint16_t        offSegName;
+    /** Offset (byte) into the kCvSst_SegName table of the class name, or 0xffff. */
+    uint16_t        offClassName;
+    /** Offset into the physical segment. */
+    uint32_t        off;
+    /** Size of segment. */
+    uint32_t        cb;
+} RTCVSEGMAPDESC;
+/** Pointer to a segment map descriptor entry. */
+typedef RTCVSEGMAPDESC *PRTCVSEGMAPDESC;
+/** Pointer to a const segment map descriptor entry. */
+typedef RTCVSEGMAPDESC const *PCRTCVSEGMAPDESC;
+
+/** @name RTCVSEGMAPDESC_F_XXX - RTCVSEGMAPDESC::fFlags values.
+ * @{ */
+#define RTCVSEGMAPDESC_F_READ       UINT16_C(0x0001)
+#define RTCVSEGMAPDESC_F_WRITE      UINT16_C(0x0002)
+#define RTCVSEGMAPDESC_F_EXECUTE    UINT16_C(0x0004)
+#define RTCVSEGMAPDESC_F_32BIT      UINT16_C(0x0008)
+#define RTCVSEGMAPDESC_F_SEL        UINT16_C(0x0100)
+#define RTCVSEGMAPDESC_F_ABS        UINT16_C(0x0200)
+#define RTCVSEGMAPDESC_F_GROUP      UINT16_C(0x1000)
+#define RTCVSEGMAPDESC_F_RESERVED   UINT16_C(0xecf0)
+/** @} */
+
+/**
+ * CV4 segment map subsection.
+ */
+typedef struct RTCVSEGMAP
+{
+    /** The header. */
+    RTCVSEGMAPHDR   Hdr;
+    /** Descriptor array. */
+    RTCVSEGMAPDESC  aDescs[1];
+} RTCVSEGMAP;
+/** Pointer to a segment map subsection. */
+typedef RTCVSEGMAP *PRTCVSEGMAP;
+/** Pointer to a const segment map subsection. */
+typedef RTCVSEGMAP const *PCRTCVSEGMAP;
+
+
+/**
+ * Global symbol table header, used by kCvSst_GlobalSym and kCvSst_GlobalPub.
+ */
+typedef struct RTCVGLOBALSYMTABHDR
+{
+    /** The symbol hash function. */
+    uint16_t        uSymHash;
+    /** The address hash function. */
+    uint16_t        uAddrHash;
+    /** The amount of symbol information following immediately after the header. */
+    uint32_t        cbSymbols;
+    /** The amount of symbol hash tables following the symbols. */
+    uint32_t        cbSymHash;
+    /** The amount of address hash tables following the symbol hash tables. */
+    uint32_t        cbAddrHash;
+} RTCVGLOBALSYMTABHDR;
+/** Pointer to a global symbol table header. */
+typedef RTCVGLOBALSYMTABHDR *PRTCVGLOBALSYMTABHDR;
+/** Pointer to a const global symbol table header. */
+typedef RTCVGLOBALSYMTABHDR const *PCRTCVGLOBALSYMTABHDR;
+
+
+typedef enum RTCVSYMTYPE
+{
+    /** @name Symbols that doesn't change with compilation model or target machine.
+     * @{ */
+    kCvSymType_Compile = 0x0001,
+    kCvSymType_Register,
+    kCvSymType_Constant,
+    kCvSymType_UDT,
+    kCvSymType_SSearch,
+    kCvSymType_End,
+    kCvSymType_Skip,
+    kCvSymType_CVReserve,
+    kCvSymType_ObjName,
+    kCvSymType_EndArg,
+    kCvSymType_CobolUDT,
+    kCvSymType_ManyReg,
+    kCvSymType_Return,
+    kCvSymType_EntryThis,
+    /** @}  */
+
+    /** @name Symbols with 16:16 addresses.
+     * @{ */
+    kCvSymType_BpRel16 = 0x0100,
+    kCvSymType_LData16,
+    kCvSymType_GData16,
+    kCvSymType_Pub16,
+    kCvSymType_LProc16,
+    kCvSymType_GProc16,
+    kCvSymType_Thunk16,
+    kCvSymType_BLock16,
+    kCvSymType_With16,
+    kCvSymType_Label16,
+    kCvSymType_CExModel16,
+    kCvSymType_VftPath16,
+    kCvSymType_RegRel16,
+    /** @}  */
+
+    /** @name Symbols with 16:32 addresses.
+     * @{ */
+    kCvSymType_BpRel32 = 0x0200,
+    kCvSymType_LData32,
+    kCvSymType_GData32,
+    kCvSymType_Pub32,
+    kCvSymType_LProc32,
+    kCvSymType_GProc32,
+    kCvSymType_Thunk32,
+    kCvSymType_Block32,
+    kCvSymType_With32,
+    kCvSymType_Label32,
+    kCvSymType_CExModel32,
+    kCvSymType_VftPath32,
+    kCvSymType_RegRel32,
+    kCvSymType_LThread32,
+    kCvSymType_GThread32,
+    /** @}  */
+
+    /** @name Symbols for MIPS.
+     * @{ */
+    kCvSymType_LProcMips = 0x0300,
+    kCvSymType_GProcMips,
+    /** @} */
+
+    /** @name Symbols for Microsoft CodeView.
+     * @{ */
+    kCvSymType_ProcRef = 0x0400,
+    kCvSymType_DataRef,
+    kCvSymType_Align,
+    kCvSymType_LProcRef,
+    /** @} */
+
+    /** @name Symbols with 32-bit address (I think) and 32-bit type indices.
+     * @{ */
+    kCvSymType_V2_Register = 0x1001,
+    kCvSymType_V2_Constant,
+    kCvSymType_V2_Udt,
+    kCvSymType_V2_CobolUdt,
+    kCvSymType_V2_ManyReg,
+    kCvSymType_V2_BpRel,
+    kCvSymType_V2_LData,
+    kCvSymType_V2_GData,
+    kCvSymType_V2_Pub,
+    kCvSymType_V2_LProc,
+    kCvSymType_V2_GProc,
+    kCvSymType_V2_VftTable,
+    kCvSymType_V2_RegRel,
+    kCvSymType_V2_LThread,
+    kCvSymType_V2_GThread,
+    kCvSymType_V2_Unknown_1010,
+    kCvSymType_V2_Unknown_1011,
+    kCvSymType_V2_FrameInfo,
+    kCvSymType_V2_Compliand,
+    /** @} */
+
+    /** @name Version 3 symbol types.
+     * @{ */
+    /** Name of the object file, preceded by a 4-byte language type (ASM=0) */
+    kCvSymType_V3_Compliand = 0x1101,
+    kCvSymType_V3_Thunk,
+    kCvSymType_V3_Block,
+    kCvSymType_V3_Unknown_1104,
+    kCvSymType_V3_Label,                /**< RTCVSYMV3LABEL */
+    kCvSymType_V3_Register,
+    kCvSymType_V3_Constant,
+    kCvSymType_V3_Udt,
+    kCvSymType_V3_Unknown_1109,
+    kCvSymType_V3_Unknown_110a,
+    kCvSymType_V3_BpRel,
+    kCvSymType_V3_LData,               /**< RTCVSYMV3TYPEDNAME */
+    kCvSymType_V3_GData,               /**< RTCVSYMV3TYPEDNAME */
+    kCvSymType_V3_Pub,
+    kCvSymType_V3_LProc,
+    kCvSymType_V3_GProc,
+    kCvSymType_V3_RegRel,
+    kCvSymType_V3_LThread,
+    kCvSymType_V3_GThread,
+    kCvSymType_V3_Unknown_1114,
+    kCvSymType_V3_Unknown_1115,
+    kCvSymType_V3_MSTool,               /**< RTCVSYMV3MSTOOL */
+
+    kCvSymType_V3_PubFunc1 = 0x1125,
+    kCvSymType_V3_PubFunc2 = 0x1127,
+    kCvSymType_V3_SectInfo = 0x1136,
+    kCvSymType_V3_SubSectInfo,
+    kCvSymType_V3_Entrypoint,
+    kCvSymType_V3_Unknown_1139,
+    kCvSymType_V3_SecuCookie,
+    kCvSymType_V3_Unknown_113b,
+    kCvSymType_V3_MsToolInfo,
+    kCvSymType_V3_MsToolEnv,
+
+    kCvSymType_VS2013_Local,
+    kCvSymType_VS2013_FpOff = 0x1144,
+    kCvSymType_VS2013_LProc32 = 0x1146,
+    kCvSymType_VS2013_GProc32,
+    /** @} */
+
+    kCvSymType_EndOfValues
+} RTCVSYMTYPE;
+AssertCompile(kCvSymType_V3_Udt == 0x1108);
+AssertCompile(kCvSymType_V3_GProc == 0x1110);
+AssertCompile(kCvSymType_V3_MSTool == 0x1116);
+AssertCompile(kCvSymType_VS2013_Local == 0x113E);
+typedef RTCVSYMTYPE *PRTCVSYMTYPE;
+typedef RTCVSYMTYPE const *PCRTCVSYMTYPE;
+
+
+/**
+ * kCvSymType_V3_MSTool format.
+ */
+typedef struct RTCVSYMV3MSTOOL
+{
+    /** Language or tool ID (3 == masm). */
+    uint32_t    uLanguage;
+    /** Target CPU (0xd0 == AMD64). */
+    uint32_t    uTargetCpu;
+    /** Flags. */
+    uint32_t    fFlags;
+    /** Version.   */
+    uint32_t    uVersion;
+    /** The creator name, zero terminated.
+     *
+     * It is followed by key/value pairs of zero terminated strings giving more
+     * details about the current directory ('cwd'), compiler executable ('cl'),
+     * full command line ('cmd'), source path relative to cwd ('src'), the
+     * full program database path ('pdb'), and possibly others.  Terminated by a
+     * pair of empty strings, usually. */
+    char        szCreator[1];
+} RTCVSYMV3MSTOOL;
+typedef RTCVSYMV3MSTOOL *PRTCVSYMV3MSTOOL;
+typedef RTCVSYMV3MSTOOL const *PCRTCVSYMV3MSTOOL;
+
+/**
+ * kCvSymType_V3_Label format.
+ */
+typedef struct RTCVSYMV3LABEL
+{
+    /** Offset into iSection of this symbol. */
+    uint32_t        offSection;
+    /** The index of the section where the symbol lives. */
+    uint16_t        iSection;
+    /** Flags or something. */
+    uint8_t         fFlags;
+    /** Zero terminated symbol name (variable length). */
+    char            szName[1];
+} RTCVSYMV3LABEL;
+AssertCompileSize(RTCVSYMV3LABEL, 8);
+typedef RTCVSYMV3LABEL *PRTCVSYMV3LABEL;
+typedef RTCVSYMV3LABEL const *PCRTCVSYMV3LABEL;
+
+/**
+ * kCvSymType_V3_LData and kCvSymType_V3_GData format.
+ */
+typedef struct RTCVSYMV3TYPEDNAME
+{
+    /** The type ID. */
+    uint32_t        idType;
+    /** Offset into iSection of this symbol. */
+    uint32_t        offSection;
+    /** The index of the section where the symbol lives. */
+    uint16_t        iSection;
+    /** Zero terminated symbol name (variable length). */
+    char            szName[2];
+} RTCVSYMV3TYPEDNAME;
+AssertCompileSize(RTCVSYMV3TYPEDNAME, 12);
+typedef RTCVSYMV3TYPEDNAME *PRTCVSYMV3TYPEDNAME;
+typedef RTCVSYMV3TYPEDNAME const *PCRTCVSYMV3TYPEDNAME;
+
+/**
+ * kCvSymType_V3_LProc and kCvSymType_V3_GProc format.
+ */
+typedef struct RTCVSYMV3PROC
+{
+    /** Lexical scope linking: Parent. */
+    uint32_t        uParent;
+    /** Lexical scope linking: End. */
+    uint32_t        uEnd;
+    /** Lexical scope linking: Next. */
+    uint32_t        uNext;
+    /** The procedure length. */
+    uint32_t        cbProc;
+    /** Offset into the procedure where the stack frame has been setup and is an
+     * excellent position for a function breakpoint. */
+    uint32_t        offDebugStart;
+    /** Offset into the procedure where the procedure is ready to return and has a
+     * return value (if applicable). */
+    uint32_t        offDebugEnd;
+    /** The type ID for the procedure. */
+    uint32_t        idType;
+    /** Offset into iSection of this procedure. */
+    uint32_t        offSection;
+    /** The index of the section where the procedure lives. */
+    uint16_t        iSection;
+    /** Flags.   */
+    uint8_t         fFlags;
+    /** Zero terminated procedure name (variable length). */
+    char            szName[1];
+} RTCVSYMV3PROC;
+AssertCompileSize(RTCVSYMV3PROC, 36);
+typedef RTCVSYMV3PROC *PRTCVSYMV3PROC;
+typedef RTCVSYMV3PROC const *PCRTCVSYMV3PROC;
+
+
+/** @name $$SYMBOLS signatures.
+ * @{ */
+/** The $$SYMBOL table signature for CV4. */
+#define RTCVSYMBOLS_SIGNATURE_CV4   UINT32_C(0x00000001)
+/** The $$SYMBOL table signature for CV8 (MSVC 8/2005).
+ * Also seen with MSVC 2010 using -Z7, so maybe more appropriate to call it
+ * CV7? */
+#define RTCVSYMBOLS_SIGNATURE_CV8   UINT32_C(0x00000004)
+/** @} */
+
+
+/**
+ * CV8 $$SYMBOLS block header.
+ */
+typedef struct RTCV8SYMBOLSBLOCK
+{
+    /** BLock type (RTCV8SYMBLOCK_TYPE_XXX). */
+    uint32_t    uType;
+    /** The block length, including this header? */
+    uint32_t    cb;
+} RTCV8SYMBOLSBLOCK;
+AssertCompileSize(RTCV8SYMBOLSBLOCK, 8);
+typedef RTCV8SYMBOLSBLOCK *PRTCV8SYMBOLSBLOCK;
+typedef RTCV8SYMBOLSBLOCK const *PCRTCV8SYMBOLSBLOCK;
+
+/** @name RTCV8SYMBLOCK_TYPE_XXX - CV8 (MSVC 8/2005) $$SYMBOL table types.
+ * @{ */
+/** Symbol information.
+ * Sequence of types.  Each type entry starts with a 16-bit length followed
+ * by a 16-bit RTCVSYMTYPE value.  Just like CV4/5, but with C-strings
+ * instead of pascal. */
+#define RTCV8SYMBLOCK_TYPE_SYMBOLS        UINT32_C(0x000000f1)
+/** Line numbers for a section. */
+#define RTCV8SYMBLOCK_TYPE_SECT_LINES     UINT32_C(0x000000f2)
+/** Source file string table.
+ * The strings are null terminated. Indexed by RTCV8SYMBLOCK_TYPE_SRC_INFO. */
+#define RTCV8SYMBLOCK_TYPE_SRC_STR        UINT32_C(0x000000f3)
+/** Source file information. */
+#define RTCV8SYMBLOCK_TYPE_SRC_INFO       UINT32_C(0x000000f4)
+/** @} */
+
+/**
+ * Line number header found in a RTCV8SYMBLOCK_TYPE_SECT_LINES block.
+ *
+ * This is followed by a sequence of RTCV8LINESSRCMAP structures.
+ */
+typedef struct RTCV8LINESHDR
+{
+    /** Offset into the section. */
+    uint32_t    offSection;
+    /** The section number.  */
+    uint16_t    iSection;
+    /** Padding/zero/maybe-previous-member-is-a-32-bit-value. */
+    uint16_t    u16Padding;
+    /** Number of bytes covered by this table, starting at offSection. */
+    uint32_t    cbSectionCovered;
+} RTCV8LINESHDR;
+AssertCompileSize(RTCV8LINESHDR, 12);
+typedef RTCV8LINESHDR *PRTCV8LINESHDR;
+typedef RTCV8LINESHDR const *PCRTCV8LINESHDR;
+
+/**
+ * CV8 (MSVC 8/2005) line number source map.
+ *
+ * This is followed by an array of RTCV8LINEPAIR.
+ */
+typedef struct RTCV8LINESSRCMAP
+{
+    /** The source file name, given as an offset into the string table
+     * (RTCV8SYMBLOCK_TYPE_SRC_STR). */
+    uint32_t    offSourceName;
+    /** Number of line numbers following this structure. */
+    uint32_t    cLines;
+    /** The size of this source map. */
+    uint32_t    cb;
+} RTCV8LINESSRCMAP;
+AssertCompileSize(RTCV8LINESSRCMAP, 12);
+typedef RTCV8LINESSRCMAP *PRTCV8LINESSRCMAP;
+typedef RTCV8LINESSRCMAP const *PCRTCV8LINESSRCMAP;
+
+/**
+ * One line number.
+ */
+typedef struct RTCV8LINEPAIR
+{
+    /** Offset into the section of this line number. */
+    uint32_t    offSection;
+    /** The line number. */
+    uint32_t    uLineNumber : 30;
+    /** Indicates that it's not possible to set breakpoint? */
+    uint32_t    fEndOfStatement : 1;
+} RTCV8LINEPAIR;
+AssertCompileSize(RTCV8LINEPAIR, 8);
+typedef RTCV8LINEPAIR *PRTCV8LINEPAIR;
+typedef RTCV8LINEPAIR const *PCRTCV8LINEPAIR;
+
+/**
+ * Source file information found in a RTCV8SYMBLOCK_TYPE_SRC_INFO block.
+ */
+typedef struct RTCV8SRCINFO
+{
+    /** The source file name, given as an offset into the string table
+     * (RTCV8SYMBLOCK_TYPE_SRC_STR). */
+    uint32_t    offSourceName;
+    /** Digest/checksum type. */
+    uint16_t    uDigestType;
+    union
+    {
+        /** RTCV8SRCINFO_DIGEST_TYPE_MD5. */
+        struct
+        {
+            /** The digest. */
+            uint8_t ab[16];
+            /** Structur alignment padding. */
+            uint8_t abPadding[2];
+        } md5;
+        /** RTCV8SRCINFO_DIGEST_TYPE_NONE: Padding. */
+        uint8_t abNone[2];
+    } Digest;
+} RTCV8SRCINFO;
+AssertCompileSize(RTCV8SRCINFO, 24);
+typedef RTCV8SRCINFO *PRTCV8SRCINFO;
+typedef RTCV8SRCINFO const *PCRTCV8SRCINFO;
+
+/** @name  RTCV8SRCINFO_DIGEST_TYPE_XXX - CV8 source digest types.
+ * Used by RTCV8SRCINFO::uDigestType.
+ * @{ */
+#define RTCV8SRCINFO_DIGEST_TYPE_NONE   UINT16_C(0x0000)
+#define RTCV8SRCINFO_DIGEST_TYPE_MD5    UINT16_C(0x0110)
+/** @} */
+
+
+
 /**
  * PDB v2.0 in image debug info.
Index: /trunk/src/VBox/Runtime/common/dbg/dbgmodcodeview.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/dbg/dbgmodcodeview.cpp	(revision 58661)
+++ /trunk/src/VBox/Runtime/common/dbg/dbgmodcodeview.cpp	(revision 58662)
@@ -63,391 +63,10 @@
 #include "internal/magics.h"
 
+#include <iprt/formats/codeview.h>
+
 
 /*********************************************************************************************************************************
 *   Structures and Typedefs                                                                                                      *
 *********************************************************************************************************************************/
-/**
- * CodeView Header.  There are two of this, base header at the start of the debug
- * information and a trailing header at the end.
- */
-typedef struct RTCVHDR
-{
-    /** The magic ('NBxx'), see RTCVHDR_MAGIC_XXX. */
-    uint32_t    u32Magic;
-    /**
-     * Base header: Subsection directory offset relative to this header (start).
-     * Trailing header: Offset of the base header relative to the end of the file.
-     *
-     * Called lfoBase, lfaBase, lfoDirectory, lfoDir and probably other things in
-     * the various specs/docs available. */
-    uint32_t    off;
-} RTCVHDR;
-/** Pointer to a CodeView header. */
-typedef RTCVHDR *PRTCVHDR;
-
-/** @name CodeView magic values (RTCVHDR::u32Magic).
- * @{  */
-/** CodeView from Visual C++ 5.0.  Specified in the 2001 MSDN specs.chm file. */
-#define RTCVHDR_MAGIC_NB11  RT_MAKE_U32_FROM_U8('N', 'B', '1', '1')
-/** External PDB reference (often referred to as PDB 2.0). */
-#define RTCVHDR_MAGIC_NB10  RT_MAKE_U32_FROM_U8('N', 'B', '1', '0')
-/** CodeView v4.10, packed. Specified in the TIS document. */
-#define RTCVHDR_MAGIC_NB09  RT_MAKE_U32_FROM_U8('N', 'B', '0', '9')
-/** CodeView v4.00 thru v4.05.  Specified in the TIS document?  */
-#define RTCVHDR_MAGIC_NB08  RT_MAKE_U32_FROM_U8('N', 'B', '0', '8')
-/** Quick C for Windows 1.0 debug info. */
-#define RTCVHDR_MAGIC_NB07  RT_MAKE_U32_FROM_U8('N', 'B', '0', '7')
-/** Emitted by ILINK indicating incremental link. Comparable to NB05?  */
-#define RTCVHDR_MAGIC_NB06  RT_MAKE_U32_FROM_U8('N', 'B', '0', '6')
-/** Emitted by LINK version 5.20 and later before packing. */
-#define RTCVHDR_MAGIC_NB05  RT_MAKE_U32_FROM_U8('N', 'B', '0', '5')
-/** Emitted by IBM ILINK for HLL (similar to NB02 in many ways). */
-#define RTCVHDR_MAGIC_NB04  RT_MAKE_U32_FROM_U8('N', 'B', '0', '4')
-/** Emitted by LINK version 5.10 (or similar OMF linkers), as shipped with
- * Microsoft C v6.0 for example.  More or less entirely 16-bit. */
-#define RTCVHDR_MAGIC_NB02  RT_MAKE_U32_FROM_U8('N', 'B', '0', '2')
-/* No idea what NB03 might have been. */
-/** AIX debugger format according to "IBM OS/2 16/32-bit Object Module Format
- *  (OMF) and Linear eXecutable Module Format (LX)" revision 10 (LXOMF.PDF). */
-#define RTCVHDR_MAGIC_NB01  RT_MAKE_U32_FROM_U8('N', 'B', '0', '1')
-/** Ancient CodeView format according to LXOMF.PDF. */
-#define RTCVHDR_MAGIC_NB00  RT_MAKE_U32_FROM_U8('N', 'B', '0', '0')
-/** @} */
-
-
-/** @name CV directory headers.
- * @{ */
-
-/**
- * Really old CV directory header used with NB00 and NB02.
- *
- * Uses 16-bit directory entires (RTCVDIRENT16).
- */
-typedef struct RTCVDIRHDR16
-{
-    /** The number of directory entries. */
-    uint16_t        cEntries;
-} RTCVDIRHDR16;
-/** Pointer to a old CV directory header. */
-typedef RTCVDIRHDR16 *PRTCVDIRHDR16;
-
-/**
- * Simple 32-bit CV directory base header, used by NB04 (aka IBM HLL).
- */
-typedef struct RTCVDIRHDR32
-{
-    /** The number of bytes of this header structure. */
-    uint16_t        cbHdr;
-    /** The number of bytes per entry. */
-    uint16_t        cbEntry;
-    /** The number of directory entries. */
-    uint32_t        cEntries;
-} RTCVDIRHDR32;
-/** Pointer to a 32-bit CV directory header. */
-typedef RTCVDIRHDR32 *PRTCVDIRHDR32;
-
-/**
- * Extended 32-bit CV directory header as specified in the TIS doc.
- * The two extra fields seems to never have been assigned any official purpose.
- */
-typedef struct RTCVDIRHDR32EX
-{
-    /** This starts the same way as the NB04 header. */
-    RTCVDIRHDR32    Core;
-    /** Tentatively decleared as the offset to the next directory generated by
-     * the incremental linker.  Haven't seen this used yet. */
-    uint32_t        offNextDir;
-    /** Flags, non defined apparently, so MBZ. */
-    uint32_t        fFlags;
-} RTCVDIRHDR32EX;
-/** Pointer to an extended 32-bit CV directory header. */
-typedef RTCVDIRHDR32EX *PRTCVDIRHDR32EX;
-
-/** @} */
-
-
-/**
- * 16-bit CV directory entry used with NB00 and NB02.
- */
-typedef struct RTCVDIRENT16
-{
-    /** Subsection type (RTCVSST). */
-    uint16_t        uSubSectType;
-    /** Which module (1-based, 0xffff is special). */
-    uint16_t        iMod;
-    /** The lowe offset of this subsection relative to the base CV header. */
-    uint16_t        offLow;
-    /** The high part of the subsection offset. */
-    uint16_t        offHigh;
-    /** The size of the subsection. */
-    uint16_t        cb;
-} RTCVDIRENT16;
-AssertCompileSize(RTCVDIRENT16, 10);
-/** Pointer to a 16-bit CV directory entry. */
-typedef RTCVDIRENT16 *PRTCVDIRENT16;
-
-
-/**
- * 32-bit CV directory entry used starting with NB04.
- */
-typedef struct RTCVDIRENT32
-{
-    /** Subsection type (RTCVSST). */
-    uint16_t        uSubSectType;
-    /** Which module (1-based, 0xffff is special). */
-    uint16_t        iMod;
-    /** The offset of this subsection relative to the base CV header. */
-    uint32_t        off;
-    /** The size of the subsection. */
-    uint32_t        cb;
-} RTCVDIRENT32;
-AssertCompileSize(RTCVDIRENT32, 12);
-/** Pointer to a 32-bit CV directory entry. */
-typedef RTCVDIRENT32 *PRTCVDIRENT32;
-/** Pointer to a const 32-bit CV directory entry. */
-typedef RTCVDIRENT32 const *PCRTCVDIRENT32;
-
-
-/**
- * CodeView subsection types.
- */
-typedef enum RTCVSST
-{
-    /** @name NB00, NB02 and NB04 subsection types.
-     * The actual format of each subsection varies between NB04 and the others,
-     * and it may further vary in NB04 depending on the module type.
-     * @{ */
-    kCvSst_OldModule    = 0x101,
-    kCvSst_OldPublic,
-    kCvSst_OldTypes,
-    kCvSst_OldSymbols,
-    kCvSst_OldSrcLines,
-    kCvSst_OldLibraries,
-    kCvSst_OldImports,
-    kCvSst_OldCompacted,
-    kCvSst_OldSrcLnSeg = 0x109,
-    kCvSst_OldSrcLines3 = 0x10b,
-    /** @} */
-
-    /** @name NB09, NB11 (and possibly NB05, NB06, NB07, and NB08) subsection types.
-     * @{ */
-    kCvSst_Module    = 0x120,
-    kCvSst_Types,
-    kCvSst_Public,
-    kCvSst_PublicSym,
-    kCvSst_Symbols,
-    kCvSst_AlignSym,
-    kCvSst_SrcLnSeg,
-    kCvSst_SrcModule,
-    kCvSst_Libraries,
-    kCvSst_GlobalSym,
-    kCvSst_GlobalPub,
-    kCvSst_GlobalTypes,
-    kCvSst_MPC,
-    kCvSst_SegMap,
-    kCvSst_SegName,
-    kCvSst_PreComp,
-    kCvSst_PreCompMap,
-    kCvSst_OffsetMap16,
-    kCvSst_OffsetMap32,
-    kCvSst_FileIndex = 0x133,
-    kCvSst_StaticSym
-    /** @} */
-} RTCVSST;
-/** Pointer to a CV subsection type value.  */
-typedef RTCVSST *PRTCVSST;
-/** Pointer to a const CV subsection type value.  */
-typedef RTCVSST const *PCRTCVSST;
-
-
-/**
- * CV4 module segment info.
- */
-typedef struct RTCVMODSEGINFO32
-{
-    /** The segment number. */
-    uint16_t        iSeg;
-    /** Explicit padding. */
-    uint16_t        u16Padding;
-    /** Offset into the segment. */
-    uint32_t        off;
-    /** The size of the contribution. */
-    uint32_t        cb;
-} RTCVMODSEGINFO32;
-typedef RTCVMODSEGINFO32 *PRTCVMODSEGINFO32;
-typedef RTCVMODSEGINFO32 const *PCRTCVMODSEGINFO32;
-
-
-/**
- * CV4 segment map header.
- */
-typedef struct RTCVSEGMAPHDR
-{
-    /** Number of segments descriptors in the table. */
-    uint16_t        cSegs;
-    /** Number of logical segment descriptors. */
-    uint16_t        cLogSegs;
-} RTCVSEGMAPHDR;
-/** Pointer to a CV4 segment map header. */
-typedef RTCVSEGMAPHDR *PRTCVSEGMAPHDR;
-/** Pointer to a const CV4 segment map header. */
-typedef RTCVSEGMAPHDR const *PCRTCVSEGMAPHDR;
-
-/**
- * CV4 Segment map descriptor entry.
- */
-typedef struct RTCVSEGMAPDESC
-{
-    /** Segment flags. */
-    uint16_t        fFlags;
-    /** The overlay number. */
-    uint16_t        iOverlay;
-    /** Group index into this segment descriptor array. 0 if not relevant.
-     * The group descriptors are found in the second half of the table.  */
-    uint16_t        iGroup;
-    /** Complicated. */
-    uint16_t        iFrame;
-    /** Offset (byte) into the kCvSst_SegName table of the segment name, or
-     * 0xffff. */
-    uint16_t        offSegName;
-    /** Offset (byte) into the kCvSst_SegName table of the class name, or 0xffff. */
-    uint16_t        offClassName;
-    /** Offset into the physical segment. */
-    uint32_t        off;
-    /** Size of segment. */
-    uint32_t        cb;
-} RTCVSEGMAPDESC;
-/** Pointer to a segment map descriptor entry. */
-typedef RTCVSEGMAPDESC *PRTCVSEGMAPDESC;
-/** Pointer to a const segment map descriptor entry. */
-typedef RTCVSEGMAPDESC const *PCRTCVSEGMAPDESC;
-
-/** @name RTCVSEGMAPDESC_F_XXX - RTCVSEGMAPDESC::fFlags values.
- * @{ */
-#define RTCVSEGMAPDESC_F_READ       UINT16_C(0x0001)
-#define RTCVSEGMAPDESC_F_WRITE      UINT16_C(0x0002)
-#define RTCVSEGMAPDESC_F_EXECUTE    UINT16_C(0x0004)
-#define RTCVSEGMAPDESC_F_32BIT      UINT16_C(0x0008)
-#define RTCVSEGMAPDESC_F_SEL        UINT16_C(0x0100)
-#define RTCVSEGMAPDESC_F_ABS        UINT16_C(0x0200)
-#define RTCVSEGMAPDESC_F_GROUP      UINT16_C(0x1000)
-#define RTCVSEGMAPDESC_F_RESERVED   UINT16_C(0xecf0)
-/** @} */
-
-/**
- * CV4 segment map subsection.
- */
-typedef struct RTCVSEGMAP
-{
-    /** The header. */
-    RTCVSEGMAPHDR   Hdr;
-    /** Descriptor array. */
-    RTCVSEGMAPDESC  aDescs[1];
-} RTCVSEGMAP;
-/** Pointer to a segment map subsection. */
-typedef RTCVSEGMAP *PRTCVSEGMAP;
-/** Pointer to a const segment map subsection. */
-typedef RTCVSEGMAP const *PCRTCVSEGMAP;
-
-
-/**
- * Global symbol table header, used by kCvSst_GlobalSym and kCvSst_GlobalPub.
- */
-typedef struct RTCVGLOBALSYMTABHDR
-{
-    /** The symbol hash function. */
-    uint16_t        uSymHash;
-    /** The address hash function. */
-    uint16_t        uAddrHash;
-    /** The amount of symbol information following immediately after the header. */
-    uint32_t        cbSymbols;
-    /** The amount of symbol hash tables following the symbols. */
-    uint32_t        cbSymHash;
-    /** The amount of address hash tables following the symbol hash tables. */
-    uint32_t        cbAddrHash;
-} RTCVGLOBALSYMTABHDR;
-/** Pointer to a global symbol table header. */
-typedef RTCVGLOBALSYMTABHDR *PRTCVGLOBALSYMTABHDR;
-/** Pointer to a const global symbol table header. */
-typedef RTCVGLOBALSYMTABHDR const *PCRTCVGLOBALSYMTABHDR;
-
-
-typedef enum RTCVSYMTYPE
-{
-    /** @name Symbols that doesn't change with compilation model or target machine.
-     * @{ */
-    kCvSymType_Compile = 0x0001,
-    kCvSymType_Register,
-    kCvSymType_Constant,
-    kCvSymType_UDT,
-    kCvSymType_SSearch,
-    kCvSymType_End,
-    kCvSymType_Skip,
-    kCvSymType_CVReserve,
-    kCvSymType_ObjName,
-    kCvSymType_EndArg,
-    kCvSymType_CobolUDT,
-    kCvSymType_ManyReg,
-    kCvSymType_Return,
-    kCvSymType_EntryThis,
-    /** @}  */
-
-    /** @name Symbols with 16:16 addresses.
-     * @{ */
-    kCvSymType_BpRel16 = 0x0100,
-    kCvSymType_LData16,
-    kCvSymType_GData16,
-    kCvSymType_Pub16,
-    kCvSymType_LProc16,
-    kCvSymType_GProc16,
-    kCvSymType_Thunk16,
-    kCvSymType_BLock16,
-    kCvSymType_With16,
-    kCvSymType_Label16,
-    kCvSymType_CExModel16,
-    kCvSymType_VftPath16,
-    kCvSymType_RegRel16,
-    /** @}  */
-
-    /** @name Symbols with 16:32 addresses.
-     * @{ */
-    kCvSymType_BpRel32 = 0x0200,
-    kCvSymType_LData32,
-    kCvSymType_GData32,
-    kCvSymType_Pub32,
-    kCvSymType_LProc32,
-    kCvSymType_GProc32,
-    kCvSymType_Thunk32,
-    kCvSymType_Block32,
-    kCvSymType_With32,
-    kCvSymType_Label32,
-    kCvSymType_CExModel32,
-    kCvSymType_VftPath32,
-    kCvSymType_RegRel32,
-    kCvSymType_LThread32,
-    kCvSymType_GThread32,
-    /** @}  */
-
-    /** @name Symbols for MIPS.
-     * @{ */
-    kCvSymType_LProcMips = 0x0300,
-    kCvSymType_GProcMips,
-    /** @} */
-
-    /** @name Symbols for Microsoft CodeView.
-     * @{ */
-    kCvSymType_ProcRef,
-    kCvSymType_DataRef,
-    kCvSymType_Align
-    /** @} */
-} RTCVSYMTYPE;
-typedef RTCVSYMTYPE *PRTCVSYMTYPE;
-typedef RTCVSYMTYPE const *PCRTCVSYMTYPE;
-
-
-/** The $$SYMBOL table signature for CV4. */
-#define RTCVSYMBOLS_SIGNATURE_CV4   UINT32_C(0x00000001)
-
-
 /**
  * Directory sorting order.
@@ -587,5 +206,6 @@
             Log(("RTDbgCv: Check failed on line %d: " #a_Expr "\n", __LINE__)); \
             Log(a_LogArgs); \
-            /*return VERR_CV_BAD_FORMAT;*/ \
+            /*AssertFailed();*/ \
+            return VERR_CV_BAD_FORMAT; \
         } \
     } while (0)
@@ -598,5 +218,6 @@
         { \
             Log(("RTDbgCv: Check failed on line %d: " #a_Expr "\n", __LINE__)); \
-            /*return VERR_CV_BAD_FORMAT;*/ \
+            /*AssertFailed();*/ \
+            return VERR_CV_BAD_FORMAT; \
         } \
     } while (0)
@@ -709,4 +330,126 @@
 
 /**
+ * Gets a name string for a symbol type.
+ *
+ * @returns symbol type name (read only).
+ * @param   enmSymType      The symbol type to name.
+ */
+static const char *rtDbgModCvSsSymTypeName(RTCVSYMTYPE enmSymType)
+{
+    switch (enmSymType)
+    {
+#define CASE_RET_STR(Name)  case kCvSymType_##Name: return #Name;
+        CASE_RET_STR(Compile);
+        CASE_RET_STR(Register);
+        CASE_RET_STR(Constant);
+        CASE_RET_STR(UDT);
+        CASE_RET_STR(SSearch);
+        CASE_RET_STR(End);
+        CASE_RET_STR(Skip);
+        CASE_RET_STR(CVReserve);
+        CASE_RET_STR(ObjName);
+        CASE_RET_STR(EndArg);
+        CASE_RET_STR(CobolUDT);
+        CASE_RET_STR(ManyReg);
+        CASE_RET_STR(Return);
+        CASE_RET_STR(EntryThis);
+        CASE_RET_STR(BpRel16);
+        CASE_RET_STR(LData16);
+        CASE_RET_STR(GData16);
+        CASE_RET_STR(Pub16);
+        CASE_RET_STR(LProc16);
+        CASE_RET_STR(GProc16);
+        CASE_RET_STR(Thunk16);
+        CASE_RET_STR(BLock16);
+        CASE_RET_STR(With16);
+        CASE_RET_STR(Label16);
+        CASE_RET_STR(CExModel16);
+        CASE_RET_STR(VftPath16);
+        CASE_RET_STR(RegRel16);
+        CASE_RET_STR(BpRel32);
+        CASE_RET_STR(LData32);
+        CASE_RET_STR(GData32);
+        CASE_RET_STR(Pub32);
+        CASE_RET_STR(LProc32);
+        CASE_RET_STR(GProc32);
+        CASE_RET_STR(Thunk32);
+        CASE_RET_STR(Block32);
+        CASE_RET_STR(With32);
+        CASE_RET_STR(Label32);
+        CASE_RET_STR(CExModel32);
+        CASE_RET_STR(VftPath32);
+        CASE_RET_STR(RegRel32);
+        CASE_RET_STR(LThread32);
+        CASE_RET_STR(GThread32);
+        CASE_RET_STR(LProcMips);
+        CASE_RET_STR(GProcMips);
+        CASE_RET_STR(ProcRef);
+        CASE_RET_STR(DataRef);
+        CASE_RET_STR(Align);
+        CASE_RET_STR(LProcRef);
+        CASE_RET_STR(V2_Register);
+        CASE_RET_STR(V2_Constant);
+        CASE_RET_STR(V2_Udt);
+        CASE_RET_STR(V2_CobolUdt);
+        CASE_RET_STR(V2_ManyReg);
+        CASE_RET_STR(V2_BpRel);
+        CASE_RET_STR(V2_LData);
+        CASE_RET_STR(V2_GData);
+        CASE_RET_STR(V2_Pub);
+        CASE_RET_STR(V2_LProc);
+        CASE_RET_STR(V2_GProc);
+        CASE_RET_STR(V2_VftTable);
+        CASE_RET_STR(V2_RegRel);
+        CASE_RET_STR(V2_LThread);
+        CASE_RET_STR(V2_GThread);
+        CASE_RET_STR(V2_Unknown_1010);
+        CASE_RET_STR(V2_Unknown_1011);
+        CASE_RET_STR(V2_FrameInfo);
+        CASE_RET_STR(V2_Compliand);
+        CASE_RET_STR(V3_Compliand);
+        CASE_RET_STR(V3_Thunk);
+        CASE_RET_STR(V3_Block);
+        CASE_RET_STR(V3_Unknown_1104);
+        CASE_RET_STR(V3_Label);
+        CASE_RET_STR(V3_Register);
+        CASE_RET_STR(V3_Constant);
+        CASE_RET_STR(V3_Udt);
+        CASE_RET_STR(V3_Unknown_1109);
+        CASE_RET_STR(V3_Unknown_110a);
+        CASE_RET_STR(V3_BpRel);
+        CASE_RET_STR(V3_LData);
+        CASE_RET_STR(V3_GData);
+        CASE_RET_STR(V3_Pub);
+        CASE_RET_STR(V3_LProc);
+        CASE_RET_STR(V3_GProc);
+        CASE_RET_STR(V3_RegRel);
+        CASE_RET_STR(V3_LThread);
+        CASE_RET_STR(V3_GThread);
+        CASE_RET_STR(V3_Unknown_1114);
+        CASE_RET_STR(V3_Unknown_1115);
+        CASE_RET_STR(V3_MSTool);
+        CASE_RET_STR(V3_PubFunc1);
+        CASE_RET_STR(V3_PubFunc2);
+        CASE_RET_STR(V3_SectInfo);
+        CASE_RET_STR(V3_SubSectInfo);
+        CASE_RET_STR(V3_Entrypoint);
+        CASE_RET_STR(V3_Unknown_1139);
+        CASE_RET_STR(V3_SecuCookie);
+        CASE_RET_STR(V3_Unknown_113b);
+        CASE_RET_STR(V3_MsToolInfo);
+        CASE_RET_STR(V3_MsToolEnv);
+        CASE_RET_STR(VS2013_Local);
+        CASE_RET_STR(VS2013_FpOff);
+        CASE_RET_STR(VS2013_LProc32);
+        CASE_RET_STR(VS2013_GProc32);
+#undef CASE_RET_STR
+        case kCvSymType_EndOfValues: break;
+    }
+    return "<unknown type>";
+}
+
+
+
+/**
  * Adds a symbol to the container.
  *
@@ -718,7 +461,8 @@
  * @param   cchName             The symbol name length.
  * @param   fFlags              Flags reserved for future exploits, MBZ.
+ * @param   cbSym               Symbol size, 0 if not avaiable.
  */
 static int rtDbgModCvAddSymbol(PRTDBGMODCV pThis, uint32_t iSeg, uint64_t off, const char *pchName,
-                               uint8_t cchName, uint32_t fFlags)
+                               uint32_t cchName, uint32_t fFlags, uint32_t cbSym)
 {
     const char *pszName = RTStrCacheEnterN(g_hDbgModStrCache, pchName, cchName);
@@ -783,5 +527,5 @@
     }
 
-    int rc = RTDbgModSymbolAdd(pThis->hCnt, pszName, iSeg, off, 0, 0 /*fFlags*/, NULL);
+    int rc = RTDbgModSymbolAdd(pThis->hCnt, pszName, iSeg, off, cbSym, 0 /*fFlags*/, NULL);
     Log(("Symbol: %04x:%08x %.*s [%Rrc]\n", iSeg, off, cchName, pchName, rc));
     if (rc == VERR_DBG_ADDRESS_CONFLICT || rc == VERR_DBG_DUPLICATE_SYMBOL)
@@ -797,4 +541,29 @@
 
 /**
+ * Validates the a zero terminated string.
+ *
+ * @returns String length if valid, UINT16_MAX if invalid.
+ * @param   pszString   The string to validate.
+ * @param   pvRec       The pointer to the record containing the string.
+ * @param   cbRec       The record length.
+ */
+static uint16_t rtDbgModCvValidateZeroString(const char *pszString, void const *pvRec, uint16_t cbRec)
+{
+    size_t   offStrMember = (uintptr_t)pszString - (uintptr_t)pvRec;
+    AssertReturn(offStrMember < _1K, UINT16_MAX);
+    AssertReturn(offStrMember <= cbRec, UINT16_MAX);
+    cbRec -= (uint16_t)offStrMember;
+
+    const char *pchEnd = RTStrEnd(pszString, cbRec);
+    AssertReturn(pchEnd, UINT16_MAX);
+
+    int rc = RTStrValidateEncoding(pszString);
+    AssertRCReturn(rc, UINT16_MAX);
+
+    return (uint16_t)(pchEnd - pszString);
+}
+
+
+/**
  * Parses a CV4 symbol table, adding symbols to the container.
  *
@@ -805,5 +574,5 @@
  * @param   fFlags              Flags reserved for future exploits, MBZ.
  */
-static int rtDbgModCvSsProcessV4SymTab(PRTDBGMODCV pThis, void const *pvSymTab, size_t cbSymTab, uint32_t fFlags)
+static int rtDbgModCvSsProcessV4PlusSymTab(PRTDBGMODCV pThis, void const *pvSymTab, size_t cbSymTab, uint32_t fFlags)
 {
     int         rc = VINF_SUCCESS;
@@ -819,5 +588,6 @@
             uint16_t uSymType = *uCursor.pu16++;
 
-            Log3(("    %p: uSymType=%#06x LB %#x\n", pbRecStart - (uint8_t *)pvSymTab, uSymType, cbRec));
+            Log3(("    %p: uSymType=%#06x LB %#x %s\n",
+                  pbRecStart - (uint8_t *)pvSymTab, uSymType, cbRec, rtDbgModCvSsSymTypeName((RTCVSYMTYPE)uSymType)));
             RTDBGMODCV_CHECK_RET_BF(cbRec >= 2 && cbRec <= cbSymTab, ("cbRec=%#x cbSymTab=%#x\n", cbRec, cbSymTab));
 
@@ -836,5 +606,5 @@
                     RTDBGMODCV_CHECK_NOMSG_RET_BF(cbRec >= 2 + 2+2+2+1 + cchName);
 
-                    rc = rtDbgModCvAddSymbol(pThis, iSeg, off, uCursor.pch, cchName, 0);
+                    rc = rtDbgModCvAddSymbol(pThis, iSeg, off, uCursor.pch, cchName, 0, 0);
                     break;
                 }
@@ -852,9 +622,34 @@
                     RTDBGMODCV_CHECK_NOMSG_RET_BF(cbRec >= 2 + 4+2+2+1 + cchName);
 
-                    rc = rtDbgModCvAddSymbol(pThis, iSeg, off, uCursor.pch, cchName, 0);
+                    rc = rtDbgModCvAddSymbol(pThis, iSeg, off, uCursor.pch, cchName, 0, 0);
                     break;
                 }
 
                 /** @todo add GProc and LProc so we can gather sizes as well as just symbols. */
+
+                case kCvSymType_V3_LData:
+                case kCvSymType_V3_GData:
+                case kCvSymType_V3_Pub:
+                {
+                    PCRTCVSYMV3LABEL pLabel = (PCRTCVSYMV3LABEL)uCursor.pv;
+                    RTDBGMODCV_CHECK_NOMSG_RET_BF(cbRec >= sizeof(*pLabel));
+                    uint16_t cchName = rtDbgModCvValidateZeroString(pLabel->szName, pLabel, cbRec);
+                    if (cchName != UINT16_MAX && cchName > 0)
+                        rc = rtDbgModCvAddSymbol(pThis, pLabel->iSection, pLabel->offSection, pLabel->szName, cchName, 0, 0);
+                    break;
+                }
+
+                case kCvSymType_V3_LProc:
+                case kCvSymType_V3_GProc:
+                {
+                    PCRTCVSYMV3PROC pProc = (PCRTCVSYMV3PROC)uCursor.pv;
+                    RTDBGMODCV_CHECK_NOMSG_RET_BF(cbRec >= sizeof(*pProc));
+                    uint16_t cchName = rtDbgModCvValidateZeroString(pProc->szName, pProc, cbRec);
+                    if (cchName != UINT16_MAX && cchName > 0)
+                        rc = rtDbgModCvAddSymbol(pThis, pProc->iSection, pProc->offSection, pProc->szName, cchName,
+                                                 0, pProc->cbProc);
+                    break;
+                }
+
             }
         }
@@ -864,4 +659,63 @@
         uCursor.pu8 = pbRecStart + cbRec + 2;
         cbSymTab   -= cbRec + 2;
+    }
+    return rc;
+}
+
+
+/**
+ * Parses a CV8 symbol table, adding symbols to the container.
+ *
+ * @returns IPRT status code
+ * @param   pThis               The CodeView debug info reader instance.
+ * @param   pvSymTab            The symbol table.
+ * @param   cbSymTab            The size of the symbol table.
+ * @param   fFlags              Flags reserved for future exploits, MBZ.
+ */
+static int rtDbgModCvSsProcessV8SymTab(PRTDBGMODCV pThis, void const *pvSymTab, size_t cbSymTab, uint32_t fFlags)
+{
+    int         rc = VINF_SUCCESS;
+    RTCPTRUNION uCursor;
+    uCursor.pv = pvSymTab;
+
+    for (;;)
+    {
+        RTDBGMODCV_CHECK_RET_BF(cbSymTab > sizeof(RTCV8SYMBOLSBLOCK), ("cbSymTab=%zu\n", cbSymTab));
+        PCRTCV8SYMBOLSBLOCK pBlockHdr = (PCRTCV8SYMBOLSBLOCK)uCursor.pv;
+        Log3(("    %p: uType=%#04x LB %#x\n", (uint8_t *)pBlockHdr - (uint8_t *)pvSymTab, pBlockHdr->uType, pBlockHdr->cb));
+        RTDBGMODCV_CHECK_RET_BF(pBlockHdr->cb <= cbSymTab - sizeof(RTCV8SYMBOLSBLOCK),
+                                ("cb=%#u cbSymTab=%zu\n", pBlockHdr->cb, cbSymTab));
+
+        switch (pBlockHdr->uType)
+        {
+            case RTCV8SYMBLOCK_TYPE_SYMBOLS:
+                rc = rtDbgModCvSsProcessV4PlusSymTab(pThis, pBlockHdr + 1, pBlockHdr->cb, fFlags);
+                break;
+
+            case RTCV8SYMBLOCK_TYPE_SRC_STR:
+                /** @todo would have to cache the string table as the line numbers using it
+                 *        may be in a different .debug$S section and wlinking will therefore
+                 *        issue two sstSymbols entries for the module. */
+                break;
+
+            case RTCV8SYMBLOCK_TYPE_SECT_LINES:
+                break;
+
+            case RTCV8SYMBLOCK_TYPE_SRC_INFO:
+                /* Not something we currently care about.  Could be useful later
+                   for checking if a source file has changed. */
+                break;
+            default:
+                Log(("rtDbgModCvSsProcessV8SymTab: Unknown block type %#x (LB %#x)\n", pBlockHdr->uType, pBlockHdr->cb));
+                break;
+        }
+        uint32_t cbAligned = RT_ALIGN_32(sizeof(*pBlockHdr) + pBlockHdr->cb, 4);
+        if (RT_SUCCESS(rc) && cbSymTab > cbAligned)
+        {
+            uCursor.pu8 += cbAligned;
+            cbSymTab    -= cbAligned;
+        }
+        else
+            break;
     }
     return rc;
@@ -893,5 +747,5 @@
      * Parse the symbols.
      */
-    return rtDbgModCvSsProcessV4SymTab(pThis, pHdr + 1, pHdr->cbSymbols, 0);
+    return rtDbgModCvSsProcessV4PlusSymTab(pThis, pHdr + 1, pHdr->cbSymbols, 0);
 }
 
@@ -938,8 +792,9 @@
 
     uint32_t u32Signature = *(uint32_t const *)pvSubSect;
-    RTDBGMODCV_CHECK_RET_BF(u32Signature == RTCVSYMBOLS_SIGNATURE_CV4,
+    RTDBGMODCV_CHECK_RET_BF(u32Signature == RTCVSYMBOLS_SIGNATURE_CV4 || u32Signature == RTCVSYMBOLS_SIGNATURE_CV8,
                             ("%#x, expected %#x\n", u32Signature, RTCVSYMBOLS_SIGNATURE_CV4));
-
-    return rtDbgModCvSsProcessV4SymTab(pThis, (uint8_t const *)pvSubSect + 4, cbSubSect - 4, 0);
+    if (u32Signature == RTCVSYMBOLS_SIGNATURE_CV8)
+        return rtDbgModCvSsProcessV8SymTab(pThis, (uint8_t const *)pvSubSect + 4, cbSubSect - 4, 0);
+    return rtDbgModCvSsProcessV4PlusSymTab(pThis, (uint8_t const *)pvSubSect + 4, cbSubSect - 4, 0);
 }
 
@@ -1552,5 +1407,6 @@
                 {
                     PCRTCVDIRENT32 pDirEnt = &pThis->paDirEnts[i];
-                    if (pDirEnt->iMod > iMod)
+                    if (   pDirEnt->iMod > iMod
+                        || pDirEnt->iMod == iMod) /* wlink subjected to MSVC 2010 /Z7 files with multiple .debug$S. */
                     {
                         if (pDirEnt->uSubSectType != uSst)
Index: /trunk/src/VBox/Runtime/tools/RTLdrFlt.cpp
===================================================================
--- /trunk/src/VBox/Runtime/tools/RTLdrFlt.cpp	(revision 58661)
+++ /trunk/src/VBox/Runtime/tools/RTLdrFlt.cpp	(revision 58662)
@@ -292,8 +292,24 @@
                 {
                     if (aMappings[iMapping].iSeg == NIL_RTDBGSEGIDX)
+                    {
                         RTPrintf("  mapping #%u: %RTptr-%RTptr\n",
                                  iMapping,
                                  aMappings[iMapping].Address,
                                  aMappings[iMapping].Address + RTDbgModImageSize(hDbgMod) - 1);
+                        if (cVerbosityLevel > 2)
+                        {
+                            uint32_t cSegments = RTDbgModSegmentCount(hDbgMod);
+                            for (uint32_t iSeg = 0; iSeg < cSegments; iSeg++)
+                            {
+                                RTDBGSEGMENT SegInfo;
+                                rc = RTDbgModSegmentByIndex(hDbgMod, iSeg, &SegInfo);
+                                if (RT_SUCCESS(rc))
+                                    RTPrintf("      seg #%u: %RTptr LB %RTptr '%s'\n",
+                                             iSeg, SegInfo.uRva, SegInfo.cb, SegInfo.szName);
+                                else
+                                    RTPrintf("      seg #%u: %Rrc\n", iSeg, rc);
+                            }
+                        }
+                    }
                     else
                     {
@@ -301,5 +317,5 @@
                         rc = RTDbgModSegmentByIndex(hDbgMod, aMappings[iMapping].iSeg, &SegInfo);
                         if (RT_SUCCESS(rc))
-                            RTPrintf("  mapping #%u: %RTptr-%RTptr (segment #%u - '%s')",
+                            RTPrintf("  mapping #%u: %RTptr-%RTptr (segment #%u - '%s')\n",
                                      iMapping,
                                      aMappings[iMapping].Address,
@@ -307,6 +323,6 @@
                                      SegInfo.iSeg, SegInfo.szName);
                         else
-                            RTPrintf("  mapping #%u: %RTptr-???????? (segment #%u)",
-                                     iMapping, aMappings[iMapping].Address, aMappings[iMapping].iSeg);
+                            RTPrintf("  mapping #%u: %RTptr-???????? (segment #%u) rc=%Rrc\n",
+                                     iMapping, aMappings[iMapping].Address, aMappings[iMapping].iSeg, rc);
                     }
 
@@ -320,6 +336,6 @@
                             rc = RTDbgModSymbolByOrdinal(hDbgMod, iSymbol, &SymInfo);
                             if (RT_SUCCESS(rc))
-                                RTPrintf("    #%04u at %08x:%RTptr %05llx %s\n",
-                                         SymInfo.iOrdinal, SymInfo.iSeg, SymInfo.offSeg,
+                                RTPrintf("    #%04u at %08x:%RTptr (%RTptr) %05llx %s\n",
+                                         SymInfo.iOrdinal, SymInfo.iSeg, SymInfo.offSeg, SymInfo.Value,
                                          (uint64_t)SymInfo.cb, SymInfo.szName);
                         }
