dbgmodcodeview.cpp revision 2ff6a39e35f5f089938f9fe97937590c912e7ceb
/* $Id: dbgmoddeferred.cpp 85864 2013-05-19 16:58:01Z bird $ */
/** @file
* IPRT - Debug Module Reader For Microsoft CodeView and COFF.
*
* Based on the following documentation (plus guess work and googling):
*
* - "Tools Interface Standard (TIS) Formats Specification for Windows",
* dated February 1993, version 1.0.
*
* - "Visual C++ 5.0 Symbolic Debug Information Specification" chapter of
* SPECS.CHM from MSDN Library October 2001.
*
* - "High Level Languages Debug Table Documentation", aka HLLDBG.HTML, aka
* IBMHLL.HTML, last changed 1996-07-08.
*/
/*
* Copyright (C) 2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#define LOG_GROUP RTLOGGROUP_DBG
#include <iprt/strcache.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. */
/**
* 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
} RTCVHDR;
/** Pointer to a CodeView header. */
/** @name CodeView magic values (RTCVHDR::u32Magic).
* @{ */
/** CodeView from Visual C++ 5.0. Specified in the 2001 MSDN specs.chm file. */
/** External PDB reference (often referred to as PDB 2.0). */
/** CodeView v4.10, packed. Specified in the TIS document. */
/** CodeView v4.00 thru v4.05. Specified in the TIS document? */
/** Quick C for Windows 1.0 debug info. */
/** Emitted by ILINK indicating incremental link. Comparable to NB05? */
/** Emitted by LINK version 5.20 and later before packing. */
/** Emitted by IBM ILINK for HLL (similar to NB02 in many ways). */
/** 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. */
/* 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). */
/** Ancient CodeView format according to LXOMF.PDF. */
/** @} */
/** @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. */
} 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. */
/** The number of bytes per entry. */
/** The number of directory entries. */
} 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. */
/** Tentatively decleared as the offset to the next directory generated by
* the incremental linker. Haven't seen this used yet. */
/** Flags, non defined apparently, so MBZ. */
/** 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). */
/** Which module (1-based, 0xffff is special). */
/** The lowe offset of this subsection relative to the base CV header. */
/** The high part of the subsection offset. */
/** The size of the subsection. */
} RTCVDIRENT16;
/** 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). */
/** Which module (1-based, 0xffff is special). */
/** The offset of this subsection relative to the base CV header. */
/** The size of the subsection. */
} RTCVDIRENT32;
/** 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_OldSrcLnSeg = 0x109,
kCvSst_OldSrcLines3 = 0x10b,
/** @} */
/** @name NB09, NB11 (and possibly NB05, NB06, NB07, and NB08) subsection types.
* @{ */
kCvSst_Module = 0x120,
kCvSst_FileIndex = 0x133,
/** @} */
} RTCVSST;
/** Pointer to a CV subsection type value. */
/** Pointer to a const CV subsection type value. */
/**
* CV4 module segment info.
*/
typedef struct RTCVMODSEGINFO32
{
/** The segment number. */
/** Explicit padding. */
/** Offset into the segment. */
/** The size of the contribution. */
typedef RTCVMODSEGINFO32 *PRTCVMODSEGINFO32;
typedef RTCVMODSEGINFO32 const *PCRTCVMODSEGINFO32;
/**
* CV4 segment map header.
*/
typedef struct RTCVSEGMAPHDR
{
/** Number of segments descriptors in the table. */
/** Number of logical segment descriptors. */
/** 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. */
/** The overlay number. */
/** Group index into this segment descriptor array. 0 if not relevant.
* The group descriptors are found in the second half of the table. */
/** Complicated. */
/** Offset (byte) into the kCvSst_SegName table of the segment name, or
* 0xffff. */
/** Offset (byte) into the kCvSst_SegName table of the class name, or 0xffff. */
/** Offset into the physical segment. */
/** Size of segment. */
/** 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.
* @{ */
/** @} */
/**
* CV4 segment map subsection.
*/
typedef struct RTCVSEGMAP
{
/** The header. */
/** Descriptor array. */
} 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. */
/** The address hash function. */
/** The amount of symbol information following immediately after the header. */
/** The amount of symbol hash tables following the symbols. */
/** The amount of address hash tables following the symbol hash tables. */
/** 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,
/** @} */
/** @name Symbols with 16:16 addresses.
* @{ */
kCvSymType_BpRel16 = 0x0100,
/** @} */
/** @name Symbols with 16:32 addresses.
* @{ */
kCvSymType_BpRel32 = 0x0200,
/** @} */
/** @name Symbols for MIPS.
* @{ */
kCvSymType_LProcMips = 0x0300,
/** @} */
/** @name Symbols for Microsoft CodeView.
* @{ */
/** @} */
} RTCVSYMTYPE;
typedef RTCVSYMTYPE *PRTCVSYMTYPE;
typedef RTCVSYMTYPE const *PCRTCVSYMTYPE;
/** The $$SYMBOL table signature for CV4. */
/**
* File type.
*/
typedef enum RTCVFILETYPE
{
RTCVFILETYPE_INVALID = 0,
/** Executable image. */
/** A DBG-file with a IMAGE_SEPARATE_DEBUG_HEADER. */
/** A PDB file. */
/** Some other kind of file with CV at the end. */
/** The end of the valid values. */
/** Type blowup. */
RTCVFILETYPE_32BIT_HACK = 0x7fffffff
} RTCVFILETYPE;
/**
* CodeView debug info reader instance.
*/
typedef struct RTDBGMODCV
{
/** Using a container for managing the debug info. */
/** @name Codeview details
* @{ */
/** The code view magic (used as format indicator). */
/** The offset of the CV debug info in the file. */
/** The size of the CV debug info. */
/** The offset of the subsection directory (relative to offBase). */
/** @} */
/** @name COFF details.
* @{ */
/** Offset of the COFF header. */
/** The size of the COFF debug info. */
/** The COFF debug info header. */
/** @} */
/** The file type. */
/** The file handle (if external). */
/** Pointer to the module (no reference retained). */
/** The image size, if we know it. This is 0 if we don't know it. */
/** Indicates that we've loaded segments intot he container already. */
bool fHaveLoadedSegments;
/** @name Codeview Parsing state.
* @{ */
/** Number of directory entries. */
/** The directory (converted to 32-bit). */
/** Current debugging style when parsing modules. */
/** Current debugging style version (HLL only). */
/** The segment map (if present). */
/** Segment names. */
char *pszzSegNames;
/** The size of the segment names. */
/** @} */
} RTDBGMODCV;
/** Pointer to a codeview debug info reader instance. */
typedef RTDBGMODCV *PRTDBGMODCV;
/** Pointer to a const codeview debug info reader instance. */
typedef RTDBGMODCV *PCRTDBGMODCV;
/**
* Subsection callback.
*
* @returns IPRT status code.
* @param pThis The CodeView debug info reader instance.
* @param pvSubSect Pointer to the subsection data.
* @param cbSubSect The size of the subsection data.
* @param pDirEnt The directory entry.
*/
typedef DECLCALLBACK(int) FNDBGMODCVSUBSECTCALLBACK(PRTDBGMODCV pThis, void const *pvSubSect, size_t cbSubSect,
/** Pointer to a subsection callback. */
/*******************************************************************************
* Defined Constants And Macros *
*******************************************************************************/
/** Light weight assert + return w/ fixed status code. */
do { \
if (!(a_Expr)) \
{ \
return VERR_CV_BAD_FORMAT; \
} \
} while (0)
/** Light weight assert + return w/ fixed status code. */
#define RTDBGMODCV_CHECK_NOMSG_RET_BF(a_Expr) \
do { \
if (!(a_Expr)) \
{ \
return VERR_CV_BAD_FORMAT; \
} \
} while (0)
/**
* Reads CodeView information.
*
* @returns IPRT status.
* @param pThis The CodeView reader instance.
* @param off The offset to start reading at, relative to the
* CodeView base header.
* @param pvBuf The buffer to read into.
* @param cb How many bytes to read.
*/
{
int rc;
else
return rc;
}
/**
* Reads CodeView information into an allocated buffer.
*
* @returns IPRT status.
* @param pThis The CodeView reader instance.
* @param off The offset to start reading at, relative to the
* CodeView base header.
* @param ppvBuf Where to return the allocated buffer on success.
* @param cb How many bytes to read.
*/
{
int rc;
if (pvBuf)
{
else
if (RT_SUCCESS(rc))
return VINF_SUCCESS;
}
else
rc = VERR_NO_MEMORY;
return rc;
}
/**
* Gets a name string for a subsection type.
*
* @returns Section name (read only).
* @param uSubSectType The subsection type.
*/
{
switch (uSubSectType)
{
case kCvSst_OldModule: return "sstOldModule";
case kCvSst_OldPublic: return "sstOldPublic";
case kCvSst_OldTypes: return "sstOldTypes";
case kCvSst_OldSymbols: return "sstOldSymbols";
case kCvSst_OldSrcLines: return "sstOldSrcLines";
case kCvSst_OldLibraries: return "sstOldLibraries";
case kCvSst_OldImports: return "sstOldImports";
case kCvSst_OldCompacted: return "sstOldCompacted";
case kCvSst_OldSrcLnSeg: return "sstOldSrcLnSeg";
case kCvSst_OldSrcLines3: return "sstOldSrcLines3";
case kCvSst_Module: return "sstModule";
case kCvSst_Types: return "sstTypes";
case kCvSst_Public: return "sstPublic";
case kCvSst_PublicSym: return "sstPublicSym";
case kCvSst_Symbols: return "sstSymbols";
case kCvSst_AlignSym: return "sstAlignSym";
case kCvSst_SrcLnSeg: return "sstSrcLnSeg";
case kCvSst_SrcModule: return "sstSrcModule";
case kCvSst_Libraries: return "sstLibraries";
case kCvSst_GlobalSym: return "sstGlobalSym";
case kCvSst_GlobalPub: return "sstGlobalPub";
case kCvSst_GlobalTypes: return "sstGlobalTypes";
case kCvSst_MPC: return "sstMPC";
case kCvSst_SegMap: return "sstSegMap";
case kCvSst_SegName: return "sstSegName";
case kCvSst_PreComp: return "sstPreComp";
case kCvSst_PreCompMap: return "sstPreCompMap";
case kCvSst_OffsetMap16: return "sstOffsetMap16";
case kCvSst_OffsetMap32: return "sstOffsetMap32";
case kCvSst_FileIndex: return "sstFileIndex";
case kCvSst_StaticSym: return "sstStaticSym";
}
static char s_sz[32];
return s_sz;
}
/**
* Adds a symbol to the container.
*
* @returns IPRT status code
* @param pThis The CodeView debug info reader instance.
* @param iSeg Segment number.
* @param off Offset into the segment
* @param pchName The symbol name (not necessarily terminated).
* @param cchName The symbol name length.
* @param fFlags Flags reserved for future exploits, MBZ.
*/
{
if (!pszName)
return VERR_NO_STR_MEMORY;
#if 1
if (iSeg == 0)
{
|| iSeg == 0
{
return VERR_CV_BAD_FORMAT;
}
else
}
rc = VINF_SUCCESS;
return rc;
#else
return VINF_SUCCESS;
#endif
}
/**
* Parses a CV4 symbol table, adding symbols to the container.
*
* @returns IPRT status code
* @param pThis The CodeView debug info reader instance.
* @param pbSymTab The symbol table.
* @param cbSymTab The size of the symbol table.
* @param fFlags Flags reserved for future exploits, MBZ.
*/
static int rtDbgModCvSsProcessV4SymTab(PRTDBGMODCV pThis, void const *pvSymTab, size_t cbSymTab, uint32_t fFlags)
{
int rc = VINF_SUCCESS;
{
if (cbRec >= 2)
{
RTDBGMODCV_CHECK_RET_BF(cbRec >= 2 && cbRec <= cbSymTab, ("cbRec=%#x cbSymTab=%#x\n", cbRec, cbSymTab));
switch (uSymType)
{
case kCvSymType_LData16:
case kCvSymType_GData16:
case kCvSymType_Pub16:
{
break;
}
case kCvSymType_LData32:
case kCvSymType_GData32:
case kCvSymType_Pub32:
{
break;
}
/** @todo add GProc and LProc so we can gather sizes as well as just symbols. */
}
}
/*else: shorter records can be used for alignment, I guess. */
/* next */
}
return rc;
}
/** @callback_method_impl{FNDBGMODCVSUBSECTCALLBACK,
* Parses kCvSst_GlobalPub, kCvSst_GlobalSym and kCvSst_StaticSym subsections,
* adding symbols it finds to the container.} */
static DECLCALLBACK(int)
rtDbgModCvSs_GlobalPub_GlobalSym_StaticSym(PRTDBGMODCV pThis, void const *pvSubSect, size_t cbSubSect, PCRTCVDIRENT32 pDirEnt)
{
/*
* Quick data validation.
*/
Log2(("RTDbgModCv: %s: uSymHash=%#x uAddrHash=%#x cbSymbols=%#x cbSymHash=%#x cbAddrHash=%#x\n",
RTDBGMODCV_CHECK_NOMSG_RET_BF((uint64_t)pHdr->cbSymbols + pHdr->cbSymHash + pHdr->cbAddrHash <= cbSubSect - sizeof(*pHdr));
return VINF_SUCCESS;
/*
* Parse the symbols.
*/
}
/** @callback_method_impl{FNDBGMODCVSUBSECTCALLBACK,
* Parses kCvSst_Module subsection, storing the debugging style in pThis.} */
static DECLCALLBACK(int)
rtDbgModCvSs_Module(PRTDBGMODCV pThis, void const *pvSubSect, size_t cbSubSect, PCRTCVDIRENT32 pDirEnt)
{
pThis->uCurStyleVer = 0;
Log2(("RTDbgModCv: Module: iOverlay=%#x iLib=%#x cSegs=%#x Style=%c%c (%#x) %.*s\n", iOverlay, iLib, cSegs,
return VINF_SUCCESS;
}
/** @callback_method_impl{FNDBGMODCVSUBSECTCALLBACK,
* Parses kCvSst_Symbols, kCvSst_PublicSym and kCvSst_AlignSym subsections,
* adding symbols it finds to the container.} */
static DECLCALLBACK(int)
rtDbgModCvSs_Symbols_PublicSym_AlignSym(PRTDBGMODCV pThis, void const *pvSubSect, size_t cbSubSect, PCRTCVDIRENT32 pDirEnt)
{
}
{
/*
* Search for the segment map and segment names. They will be at the end of the directory.
*/
while (i-- > 0)
{
break;
iSegMap = i;
iSegNames = i;
}
if (iSegMap == UINT32_MAX)
{
Log(("RTDbgModCv: No segment map present, using segment indexes as is then...\n"));
return VINF_SUCCESS;
}
/*
* Read them into memory.
*/
{
}
if (RT_FAILURE(rc))
return rc;
RTDBGMODCV_CHECK_NOMSG_RET_BF(!pThis->pszzSegNames || !pThis->pszzSegNames[pThis->cbSegNames - 1]); /* must be terminated */
/* Use local pointers to avoid lots of indirection and typing. */
/*
* If there are only logical segments, assume a direct mapping.
* PE images, like the NT4 kernel, does it like this.
*/
/*
* Validate and display it all.
*/
Log2(("RTDbgModCv: SegMap: cSegs=%#x cLogSegs=%#x (cbSegNames=%#x)\n", pHdr->cSegs, pHdr->cLogSegs, pThis->cbSegNames));
RTDBGMODCV_CHECK_RET_BF(pThis->paDirEnts[iSegMap].cb >= sizeof(*pHdr) + pHdr->cSegs * sizeof(paDescs[0]),
{
char szFlags[16];
szFlags[0] = 'R';
Log2((" #%02u: %#010x LB %#010x flags=%#06x ovl=%#06x group=%#06x frame=%#06x iSegName=%#06x iClassName=%#06x %s\n",
RTDBGMODCV_CHECK_NOMSG_RET_BF(paDescs[i].offSegName == UINT16_MAX || paDescs[i].offSegName < pThis->cbSegNames);
RTDBGMODCV_CHECK_NOMSG_RET_BF(paDescs[i].offClassName == UINT16_MAX || paDescs[i].offClassName < pThis->cbSegNames);
: NULL;
: NULL;
/* Validate the group link. */
RTDBGMODCV_CHECK_NOMSG_RET_BF(paDescs[i].iGroup == 0 || !(paDescs[i].fFlags & RTCVSEGMAPDESC_F_GROUP));
RTDBGMODCV_CHECK_NOMSG_RET_BF(!(paDescs[i].fFlags & RTCVSEGMAPDESC_F_GROUP) || paDescs[i].off == 0); /* assumed below */
if (fNoGroups)
{
}
}
/*
* Modify the groups index to be the loader segment index instead, also
* add the segments to the container if we haven't done that already.
*/
/* Guess work: Group can be implicit if used. Observed Visual C++ v1.5,
omitting the CODE group. */
if (!fNoGroups)
{
{
}
}
/* Add the segments.
Note! The RVAs derived from this exercise are all wrong. :-/
Note! We don't have an image loader, so we cannot add any fake sections. */
/** @todo Try see if we can figure something out from the frame value later. */
if (!pThis->fHaveLoadedSegments)
{
{
rc = RTDbgModSegmentAdd(pThis->hCnt, 0, cbGroup0, pszGroup0 ? pszGroup0 : "Seg00", 0 /*fFlags*/, NULL);
iSeg++;
}
{
char szName[16];
else
iSeg++;
}
if (RT_FAILURE(rc))
{
return rc;
}
pThis->fHaveLoadedSegments = true;
}
/* Pass one: Fixate the group segment indexes. */
/* Pass two: Resolve group references in to segment indexes. */
Log2(("Mapped segments (both kinds):\n"));
{
Log2((" #%02u: %#010x LB %#010x -> %#06x (flags=%#06x ovl=%#06x frame=%#06x)\n",
}
return VINF_SUCCESS;
}
/**
* Loads the directory into memory (RTDBGMODCV::paDirEnts and
* RTDBGMODCV::cDirEnts).
*
* Converting old format version into the newer format to simplifying the code
* using the directory.
*
*
* @returns IPRT status code. (May leave with paDirEnts allocated on failure.)
* @param pThis The CV reader instance.
*/
{
/*
* Read in the CV directory.
*/
int rc;
{
/*
* 16-bit type.
*/
if (RT_SUCCESS(rc))
{
{
{
if (RT_SUCCESS(rc))
{
/* Convert the entries (from the end). */
while (cLeft--)
{
pDst--;
pSrc--;
}
}
}
else
rc = VERR_NO_MEMORY;
}
else
{
}
}
}
else
{
/*
* 32-bit type (reading too much for NB04 is no problem).
*/
if (RT_SUCCESS(rc))
{
{
}
&& ( DirHdr.offNextDir != 0
{
Log(("Extended CV directory headers fields are not zero: fFlags=%#x offNextDir=%#x\n",
}
{
Log(("Unexpected CV directory entry size: %#x (expected %#x)\n", DirHdr.Core.cbEntry, sizeof(RTCVDIRENT32)));
}
{
}
if (RT_SUCCESS(rc))
{
else
rc = VERR_NO_MEMORY;
}
}
}
/*
* Validate the information in the directory a little.
*/
if (RT_SUCCESS(rc))
{
{
Log2((" #%04u mod=%#06x sst=%#06x at %#010x LB %#07x %s\n",
{
Log(("CV directory entry #%u is out of bounds: %#x LB %#x, max %#x\n", i, pDirEnt->off, pDirEnt->cb, cbDbgInfo));
}
{
Log(("CV directory entry #%u uses module index 0 (uSubSectType=%#x)\n", i, pDirEnt->iMod, pDirEnt->uSubSectType));
}
{
Log(("CV directory entry #%u is out of module order, this mod %u, prev mod %#u\n", i, pDirEnt->iMod, iMod));
}
{
if ( iMod != 0
&& iMod != 0xffff
{
Log(("CV directory entry #%u: expected module subsection first, found %s (%#x)\n",
}
}
}
}
return rc;
}
{
/*
* Load the directory, the segment map (if any) and then scan for segments
* if necessary.
*/
if (RT_SUCCESS(rc))
{
rc = VERR_CV_TODO; /** @todo Scan anything containing address, in particular sstSegMap and sstModule,
* and reconstruct the segments from that information. */
rc = VINF_SUCCESS;
}
/*
* Process the directory.
*/
{
switch (pDirEnt->uSubSectType)
{
case kCvSst_GlobalPub:
case kCvSst_GlobalSym:
case kCvSst_StaticSym:
break;
case kCvSst_Module:
break;
case kCvSst_PublicSym:
case kCvSst_Symbols:
case kCvSst_AlignSym:
break;
case kCvSst_OldModule:
case kCvSst_OldPublic:
case kCvSst_OldTypes:
case kCvSst_OldSymbols:
case kCvSst_OldSrcLines:
case kCvSst_OldLibraries:
case kCvSst_OldImports:
case kCvSst_OldCompacted:
case kCvSst_OldSrcLnSeg:
case kCvSst_OldSrcLines3:
case kCvSst_Types:
case kCvSst_Public:
case kCvSst_SrcLnSeg:
case kCvSst_SrcModule:
case kCvSst_Libraries:
case kCvSst_GlobalTypes:
case kCvSst_MPC:
case kCvSst_PreComp:
case kCvSst_PreCompMap:
case kCvSst_OffsetMap16:
case kCvSst_OffsetMap32:
case kCvSst_FileIndex:
default:
/** @todo implement more. */
break;
/* Skip because we've already processed them: */
case kCvSst_SegMap:
case kCvSst_SegName:
pfnCallback = NULL;
break;
}
if (pfnCallback)
{
void *pvSubSect;
if (RT_SUCCESS(rc))
{
}
}
}
return rc;
}
/*
*
* COFF Debug Info Parsing.
* COFF Debug Info Parsing.
* COFF Debug Info Parsing.
*
*/
{
switch (bStorageClass)
{
case IMAGE_SYM_CLASS_END_OF_FUNCTION: return "END_OF_FUNCTION";
case IMAGE_SYM_CLASS_NULL: return "NULL";
case IMAGE_SYM_CLASS_AUTOMATIC: return "AUTOMATIC";
case IMAGE_SYM_CLASS_EXTERNAL: return "EXTERNAL";
case IMAGE_SYM_CLASS_STATIC: return "STATIC";
case IMAGE_SYM_CLASS_REGISTER: return "REGISTER";
case IMAGE_SYM_CLASS_EXTERNAL_DEF: return "EXTERNAL_DEF";
case IMAGE_SYM_CLASS_LABEL: return "LABEL";
case IMAGE_SYM_CLASS_UNDEFINED_LABEL: return "UNDEFINED_LABEL";
case IMAGE_SYM_CLASS_MEMBER_OF_STRUCT: return "MEMBER_OF_STRUCT";
case IMAGE_SYM_CLASS_ARGUMENT: return "ARGUMENT";
case IMAGE_SYM_CLASS_STRUCT_TAG: return "STRUCT_TAG";
case IMAGE_SYM_CLASS_MEMBER_OF_UNION: return "MEMBER_OF_UNION";
case IMAGE_SYM_CLASS_UNION_TAG: return "UNION_TAG";
case IMAGE_SYM_CLASS_TYPE_DEFINITION: return "TYPE_DEFINITION";
case IMAGE_SYM_CLASS_UNDEFINED_STATIC: return "UNDEFINED_STATIC";
case IMAGE_SYM_CLASS_ENUM_TAG: return "ENUM_TAG";
case IMAGE_SYM_CLASS_MEMBER_OF_ENUM: return "MEMBER_OF_ENUM";
case IMAGE_SYM_CLASS_REGISTER_PARAM: return "REGISTER_PARAM";
case IMAGE_SYM_CLASS_BIT_FIELD: return "BIT_FIELD";
case IMAGE_SYM_CLASS_FAR_EXTERNAL: return "FAR_EXTERNAL";
case IMAGE_SYM_CLASS_BLOCK: return "BLOCK";
case IMAGE_SYM_CLASS_FUNCTION: return "FUNCTION";
case IMAGE_SYM_CLASS_END_OF_STRUCT: return "END_OF_STRUCT";
case IMAGE_SYM_CLASS_FILE: return "FILE";
case IMAGE_SYM_CLASS_SECTION: return "SECTION";
case IMAGE_SYM_CLASS_WEAK_EXTERNAL: return "WEAK_EXTERNAL";
case IMAGE_SYM_CLASS_CLR_TOKEN: return "CLR_TOKEN";
}
static char s_szName[32];
return s_szName;
}
/**
* Adds a chunk of COFF line numbers.
*
* @param pszFile The source file name.
* @param iSection The section number.
* @param paLines Pointer to the first line number table entry.
* @param cLines The number of line number table entries to add.
*/
{
while (cLines-- > 0)
{
if (pCur->Linenumber)
{
int rc = RTDbgModLineAdd(pThis->hCnt, pszFile, pCur->Linenumber, RTDBGSEGIDX_RVA, pCur->Type.VirtualAddress, NULL);
}
pCur++;
}
}
/**
* Adds a COFF symbol.
*
* @returns IPRT status (ignored)
* @param idxSeg IPRT RVA or ABS segment index indicator.
* @param uValue The symbol value.
* @param pszName The symbol name.
*/
static int rtDbgModCvAddCoffSymbol(PRTDBGMODCV pThis, uint32_t idxSeg, uint32_t uValue, const char *pszName)
{
Log(("Symbol: %s:%08x %s [%Rrc]\n", idxSeg == RTDBGSEGIDX_RVA ? "rva" : "abs", uValue, pszName, rc));
rc = VINF_SUCCESS;
return rc;
}
/**
* Processes the COFF symbol table.
*
* @returns IPRT status code
* @param paSymbols Pointer to the symbol table.
* @param cSymbols The number of entries in the symbol table.
* @param paLines Pointer to the line number table.
* @param cLines The number of entires in the line number table.
* @param pszzStrTab Pointer to the string table.
* @param cbStrTab Size of the string table.
*/
{
/*
* Making some bold assumption that the line numbers for the section in
* the file are allocated sequentially, we do multiple passes until we've
* gathered them all.
*/
int rc = VINF_SUCCESS;
do
{
/*
* Process the symbols.
*/
char szShort[9];
char szFile[RTPATH_MAX];
szFile[0] = '\0';
{
/* Copy the symbol in and hope it works around the misalignment
issues everywhere. */
/* Calc a zero terminated symbol name. */
const char *pszName;
else
{
}
/* Only log stuff and count sections the in the first pass.*/
if (iLineSect == 1)
{
Log3(("%04x: s=%#06x v=%#010x t=%#06x a=%#04x c=%#04x (%s) name='%s'\n",
}
/*
* Use storage class to pick what we need (which isn't much because,
* MS only provides a very restricted set of symbols).
*/
switch (Sym.StorageClass)
{
case IMAGE_SYM_CLASS_NULL:
/* a NOP */
break;
case IMAGE_SYM_CLASS_FILE:
{
/* Change the current file name (for line numbers). Pretend
ANSI and ISO-8859-1 are similar enough for out purposes... */
rc = RTLatin1ToUtf8Ex(pszFile, Sym.NumberOfAuxSymbols * sizeof(IMAGE_SYMBOL), &pszDst, sizeof(szFile), NULL);
if (RT_FAILURE(rc))
else if (iLineSect == 1)
break;
}
case IMAGE_SYM_CLASS_STATIC:
&& ( iLineSect == 1
{
if (iLineSect == 1)
Log3((" section: cb=%#010x #relocs=%#06x #lines=%#06x csum=%#x num=%#x sel=%x rvd=%u\n",
{
iLine += cLinesToAdd;
}
}
/* Not so sure about the quality here, but might be useful. */
else if ( iLineSect == 1
&& Sym.NumberOfAuxSymbols == 0
&& *pszName)
break;
case IMAGE_SYM_CLASS_EXTERNAL:
/* Add functions (first pass only). */
if ( iLineSect == 1
&& Sym.NumberOfAuxSymbols == 0
&& *pszName )
{
}
break;
case IMAGE_SYM_CLASS_FUNCTION:
/* Not sure this is really used. */
break;
case IMAGE_SYM_CLASS_REGISTER:
case IMAGE_SYM_CLASS_LABEL:
case IMAGE_SYM_CLASS_ARGUMENT:
case IMAGE_SYM_CLASS_ENUM_TAG:
case IMAGE_SYM_CLASS_BLOCK:
case IMAGE_SYM_CLASS_SECTION:
/* Not used by MS, I think. */
break;
default:
break;
}
/* next symbol */
}
/* Next section with line numbers. */
iLineSect++;
return rc;
}
/**
* Loads COFF debug information into the container.
*
* @returns IPRT status code.
*/
{
/*
* Read the whole section into memory.
* Note! Cannot use rtDbgModCvReadAt or rtDbgModCvReadAtAlloc here.
*/
int rc;
if (pbDbgSect)
{
rc = pThis->pMod->pImgVt->pfnReadAt(pThis->pMod, UINT32_MAX, pThis->offCoffDbgInfo, pbDbgSect, pThis->cbCoffDbgInfo);
else
if (RT_SUCCESS(rc))
{
/* The string table follows after the symbol table. */
const char *pszzStrTab = (const char *)( pbDbgSect
uint32_t cbStrTab = (uint32_t)((uintptr_t)(pbDbgSect + pThis->cbCoffDbgInfo) - (uintptr_t)pszzStrTab);
/** @todo The symbol table starts with a size. Read it and checking. Also verify
* that the symtab ends with a terminator character. */
}
}
else
rc = VERR_NO_MEMORY;
return rc;
}
/*
*
* CodeView Debug module implementation.
* CodeView Debug module implementation.
* CodeView Debug module implementation.
*
*/
/** @interface_method_impl{RTDBGMODVTDBG,pfnLineByAddr} */
{
}
/** @interface_method_impl{RTDBGMODVTDBG,pfnLineByOrdinal} */
static DECLCALLBACK(int) rtDbgModCv_LineByOrdinal(PRTDBGMODINT pMod, uint32_t iOrdinal, PRTDBGLINE pLineInfo)
{
}
/** @interface_method_impl{RTDBGMODVTDBG,pfnLineCount} */
{
}
/** @interface_method_impl{RTDBGMODVTDBG,pfnLineAdd} */
static DECLCALLBACK(int) rtDbgModCv_LineAdd(PRTDBGMODINT pMod, const char *pszFile, size_t cchFile, uint32_t uLineNo,
{
}
/** @interface_method_impl{RTDBGMODVTDBG,pfnSymbolByAddr} */
static DECLCALLBACK(int) rtDbgModCv_SymbolByAddr(PRTDBGMODINT pMod, RTDBGSEGIDX iSeg, RTUINTPTR off, uint32_t fFlags,
{
}
/** @interface_method_impl{RTDBGMODVTDBG,pfnSymbolByName} */
static DECLCALLBACK(int) rtDbgModCv_SymbolByName(PRTDBGMODINT pMod, const char *pszSymbol, size_t cchSymbol,
{
}
/** @interface_method_impl{RTDBGMODVTDBG,pfnSymbolByOrdinal} */
static DECLCALLBACK(int) rtDbgModCv_SymbolByOrdinal(PRTDBGMODINT pMod, uint32_t iOrdinal, PRTDBGSYMBOL pSymInfo)
{
}
/** @interface_method_impl{RTDBGMODVTDBG,pfnSymbolCount} */
{
}
/** @interface_method_impl{RTDBGMODVTDBG,pfnSymbolAdd} */
static DECLCALLBACK(int) rtDbgModCv_SymbolAdd(PRTDBGMODINT pMod, const char *pszSymbol, size_t cchSymbol,
{
}
/** @interface_method_impl{RTDBGMODVTDBG,pfnSegmentByIndex} */
static DECLCALLBACK(int) rtDbgModCv_SegmentByIndex(PRTDBGMODINT pMod, RTDBGSEGIDX iSeg, PRTDBGSEGMENT pSegInfo)
{
}
/** @interface_method_impl{RTDBGMODVTDBG,pfnSegmentCount} */
{
}
/** @interface_method_impl{RTDBGMODVTDBG,pfnSegmentAdd} */
static DECLCALLBACK(int) rtDbgModCv_SegmentAdd(PRTDBGMODINT pMod, RTUINTPTR uRva, RTUINTPTR cb, const char *pszName, size_t cchName,
{
}
/** @interface_method_impl{RTDBGMODVTDBG,pfnImageSize} */
{
}
/** @interface_method_impl{RTDBGMODVTDBG,pfnRvaToSegOff} */
static DECLCALLBACK(RTDBGSEGIDX) rtDbgModCv_RvaToSegOff(PRTDBGMODINT pMod, RTUINTPTR uRva, PRTUINTPTR poffSeg)
{
}
/** @interface_method_impl{RTDBGMODVTDBG,pfnClose} */
{
return VINF_SUCCESS;
}
/*
*
* Probing code used by rtDbgModCv_TryOpen.
* Probing code used by rtDbgModCv_TryOpen.
*
*/
/** @callback_method_impl{FNRTLDRENUMSEGS,
* Used to add segments from the image.} */
static DECLCALLBACK(int) rtDbgModCvAddSegmentsCallback(RTLDRMOD hLdrMod, PCRTLDRSEG pSeg, void *pvUser)
{
Log(("Segment %s: LinkAddress=%#llx RVA=%#llx cb=%#llx\n",
/* If the segment doesn't have a mapping, just add a dummy so the indexing
works out correctly (same as for the image). */
}
/**
* Copies the sections over from the DBG file.
*
* Called if we don't have an associated executable image.
*
* @returns IPRT status code.
* @param pThis The CV module instance.
* @param pDbgHdr The DBG file header.
* @param pszFilename The filename (for logging).
*/
static int rtDbgModCvAddSegmentsFromDbg(PRTDBGMODCV pThis, PCIMAGE_SEPARATE_DEBUG_HEADER pDbgHdr, const char *pszFilename)
{
/*
* Validate the header fields a little.
*/
{
return VERR_CV_BAD_FORMAT;
}
{
return VERR_CV_BAD_FORMAT;
}
/*
* Read the section table.
*/
if (!paShs)
return VERR_NO_MEMORY;
if (RT_SUCCESS(rc))
{
/*
* Do some basic validation.
*/
{
Log3(("RTDbgModCv: Section #%02u %#010x LB %#010x %.*s\n",
continue;
{
Log(("RTDbgModCv: %s: Overlap or soring error, VirtualAddress=%#x uRvaPrev=%#x - section #%d '%.*s'!!!\n",
}
{
Log(("RTDbgModCv: %s: VirtualAddress=%#x VirtualSize=%#x (total %x) - beyond image size (%#x) - section #%d '%.*s'!!!\n",
}
{
Log(("RTDbgModCv: %s: VirtualAddress=%#x misaligned (%#x) - section #%d '%.*s'!!!\n",
pszFilename, paShs[i].VirtualAddress, pDbgHdr->SectionAlignment, i, sizeof(paShs[i].Name), paShs[i].Name));
}
else
{
if (uRvaPrev == 0)
continue;
}
}
{
}
{
}
if (RT_SUCCESS(rc))
{
/*
* Add sections.
*/
{
else
0 /*fFlags*/, NULL);
}
if (RT_SUCCESS(rc))
pThis->fHaveLoadedSegments = true;
}
}
return rc;
}
/**
*
* @returns IPRT status code
* @param pDbgMod The debug module instance.
* @param enmFileType The type of input file.
* @param hFile The file handle, NIL_RTFILE of image.
* @param ppThis Where to return the reader instance.
*/
static int rtDbgModCvCreateInstance(PRTDBGMODINT pDbgMod, RTCVFILETYPE enmFileType, RTFILE hFile, PRTDBGMODCV *ppThis)
{
/*
* Do we already have an instance? Happens if we find multiple debug
* formats we support.
*/
if (pThis)
{
return VINF_SUCCESS;
}
/*
* Create a new instance.
*/
if (!pThis)
return VERR_NO_MEMORY;
if (RT_SUCCESS(rc))
{
return VINF_SUCCESS;
}
return rc;
}
/**
* Common part of the COFF probing.
*
* @returns status code.
* @param pDbgMod The debug module instance. On success pvDbgPriv
* will point to a valid RTDBGMODCV.
* @param hFile The file with debug info in it.
* @param off The offset where to expect CV debug info.
* @param cb The number of bytes of debug info.
* @param enmArch The desired image architecture.
* @param pszFilename The path to the file (for logging).
*/
{
/*
* Check that there is sufficient data for a header, then read it.
*/
if (cb < sizeof(IMAGE_COFF_SYMBOLS_HEADER))
{
Log(("RTDbgModCv: Not enough room for COFF header.\n"));
return VERR_BAD_EXE_FORMAT;
}
{
return VERR_BAD_EXE_FORMAT;
}
int rc;
if (hFile == NIL_RTFILE)
else
if (RT_FAILURE(rc))
{
return rc;
}
/*
* Validate the COFF header.
*/
{
Log(("RTDbgModCv: Bad COFF symbol count or/and offset: LvaToFirstSymbol=%#x, NumberOfSymbols=%#x cbCoff=%#x\n",
return VERR_BAD_EXE_FORMAT;
}
if ( (uint64_t)Hdr.LvaToFirstLinenumber + (uint64_t)Hdr.NumberOfLinenumbers * sizeof(IMAGE_LINENUMBER) > cb
{
Log(("RTDbgModCv: Bad COFF symbol count or/and offset: LvaToFirstSymbol=%#x, NumberOfSymbols=%#x cbCoff=%#x\n",
return VERR_BAD_EXE_FORMAT;
}
{
Log(("RTDbgModCv: The COFF symbol table is too short to be of any worth... (%u syms)\n", Hdr.NumberOfSymbols));
return VERR_NO_DATA;
}
/*
* What we care about looks fine, use it.
*/
if (RT_SUCCESS(rc))
{
}
return rc;
}
/**
* Common part of the CodeView probing.
*
* @returns status code.
* @param pDbgMod The debug module instance. On success pvDbgPriv
* will point to a valid RTDBGMODCV.
* @param pCvHdr The CodeView base header.
* @param enmFileType The kind of file this is we're probing.
* @param hFile The file with debug info in it.
* @param off The offset where to expect CV debug info.
* @param cb The number of bytes of debug info.
* @param pszFilename The path to the file (for logging).
*/
static int rtDbgModCvProbeCommon(PRTDBGMODINT pDbgMod, PRTCVHDR pCvHdr, RTCVFILETYPE enmFileType, RTFILE hFile,
{
/* Is a codeview format we (wish to) support? */
)
{
/* We're assuming it's a base header, so the offset must be within
the area defined by the debug info we got from the loader. */
{
Log(("RTDbgModCv: Found %c%c%c%c at %#RTfoff - size %#x, directory at %#x. file type %d\n",
RT_BYTE1(pCvHdr->u32Magic), RT_BYTE2(pCvHdr->u32Magic), RT_BYTE3(pCvHdr->u32Magic), RT_BYTE4(pCvHdr->u32Magic),
/*
* Create a module instance, if not already done.
*/
if (RT_SUCCESS(rc))
{
return VINF_SUCCESS;
}
}
}
return rc;
}
/** @callback_method_impl{FNRTLDRENUMDBG} */
static DECLCALLBACK(int) rtDbgModCvEnumCallback(RTLDRMOD hLdrMod, PCRTLDRDBGINFO pDbgInfo, void *pvUser)
{
/* Skip external files, RTDbgMod will deal with those
via RTDBGMODINT::pszDbgFile. */
if (pDbgInfo->pszExtFile)
return VINF_SUCCESS;
/* We only handle the codeview sections. */
{
/* Read the specified header and check if we like it. */
int rc = pDbgMod->pImgVt->pfnReadAt(pDbgMod, pDbgInfo->iDbgInfo, pDbgInfo->offFile, &CvHdr, sizeof(CvHdr));
if (RT_SUCCESS(rc))
rc = rtDbgModCvProbeCommon(pDbgMod, &CvHdr, RTCVFILETYPE_IMAGE, NIL_RTFILE, pDbgInfo->offFile, pDbgInfo->cb,
}
{
/* Join paths with the DBG code. */
rtDbgModCvProbeCoff(pDbgMod, RTCVFILETYPE_IMAGE, NIL_RTFILE, pDbgInfo->offFile, pDbgInfo->cb, pDbgMod->pszImgFile);
}
return VINF_SUCCESS;
}
/**
* Part two of the external file probing.
*
* @returns status code.
* @param pDbgMod The debug module instance. On success pvDbgPriv
* will point to a valid RTDBGMODCV.
* @param enmFileType The kind of file this is we're probing.
* @param hFile The file with debug info in it.
* @param off The offset where to expect CV debug info.
* @param cb The number of bytes of debug info.
* @param enmArch The desired image architecture.
* @param pszFilename The path to the file (for logging).
*/
static int rtDbgModCvProbeFile2(PRTDBGMODINT pThis, RTCVFILETYPE enmFileType, RTFILE hFile, uint32_t off, uint32_t cb,
{
if (RT_SUCCESS(rc))
return rc;
}
/**
* Probes an external file for CodeView information.
*
* @returns status code.
* @param pDbgMod The debug module instance. On success pvDbgPriv
* will point to a valid RTDBGMODCV.
* @param pszFilename The path to the file to probe.
* @param enmArch The desired image architecture.
*/
{
if (RT_FAILURE(rc))
return rc;
/*
* Check for .DBG file
*/
if ( RT_SUCCESS(rc)
{
/*
* Match up the architecture if specified.
*/
switch (enmArch)
{
case RTLDRARCH_X86_32:
break;
case RTLDRARCH_AMD64:
break;
default:
case RTLDRARCH_HOST:
AssertFailed();
case RTLDRARCH_WHATEVER:
break;
}
if (RT_FAILURE(rc))
{
return rc;
}
/*
* Probe for readable debug info in the debug directory.
*/
{
if (RT_FAILURE(rc))
break;
}
/*
* If we get down here with an instance, it prooves that we've found
* something, regardless of any errors. Add the sections and such.
*/
if (pThis)
{
rc = VINF_SUCCESS;
else
{
if (RT_FAILURE(rc))
}
return rc;
}
/* Failed to find CV or smth, look at the end of the file just to be sure... */
}
/*
* Look for CV tail header.
*/
if (RT_SUCCESS(rc))
{
if (RT_SUCCESS(rc))
}
if (RT_FAILURE(rc))
return rc;
}
/** @interface_method_impl{RTDBGMODVTDBG,pfnTryOpen} */
{
/*
* Look for debug info.
*/
if (pMod->pszDbgFile)
{
if (RT_FAILURE(rc2))
{
/* Try the executable in case it has a NBxx tail header. */
}
}
if (!pThis)
/*
* Load the debug info.
*/
{
pThis->fHaveLoadedSegments = true;
}
if (RT_SUCCESS(rc))
{
Log(("RTDbgCv: Successfully loaded debug info\n"));
return VINF_SUCCESS;
}
return rc;
}
/** Virtual function table for the CodeView debug info reader. */
{
/*.u32Magic = */ RTDBGMODVTDBG_MAGIC,
/*.fSupports = */ RT_DBGTYPE_CODEVIEW,
/*.pszName = */ "codeview",
/*.pfnTryOpen = */ rtDbgModCv_TryOpen,
/*.pfnClose = */ rtDbgModCv_Close,
/*.pfnRvaToSegOff = */ rtDbgModCv_RvaToSegOff,
/*.pfnImageSize = */ rtDbgModCv_ImageSize,
/*.pfnSegmentAdd = */ rtDbgModCv_SegmentAdd,
/*.pfnSegmentCount = */ rtDbgModCv_SegmentCount,
/*.pfnSegmentByIndex = */ rtDbgModCv_SegmentByIndex,
/*.pfnSymbolAdd = */ rtDbgModCv_SymbolAdd,
/*.pfnSymbolCount = */ rtDbgModCv_SymbolCount,
/*.pfnSymbolByOrdinal = */ rtDbgModCv_SymbolByOrdinal,
/*.pfnSymbolByName = */ rtDbgModCv_SymbolByName,
/*.pfnSymbolByAddr = */ rtDbgModCv_SymbolByAddr,
/*.pfnLineAdd = */ rtDbgModCv_LineAdd,
/*.pfnLineCount = */ rtDbgModCv_LineCount,
/*.pfnLineByOrdinal = */ rtDbgModCv_LineByOrdinal,
/*.pfnLineByAddr = */ rtDbgModCv_LineByAddr,
/*.u32EndMagic = */ RTDBGMODVTDBG_MAGIC
};