VirtualBox

source: vbox/trunk/include/iprt/formats/codeview.h@ 100931

Last change on this file since 100931 was 100931, checked in by vboxsync, 16 months ago

IPRT/dbg: Early PDB support.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 27.9 KB
Line 
1/** @file
2 * IPRT - Microsoft CodeView Debug Information.
3 */
4
5/*
6 * Copyright (C) 2009-2023 Oracle and/or its affiliates.
7 *
8 * This file is part of VirtualBox base platform packages, as
9 * available from https://www.virtualbox.org.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation, in version 3 of the
14 * License.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, see <https://www.gnu.org/licenses>.
23 *
24 * The contents of this file may alternatively be used under the terms
25 * of the Common Development and Distribution License Version 1.0
26 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
27 * in the VirtualBox distribution, in which case the provisions of the
28 * CDDL are applicable instead of those of the GPL.
29 *
30 * You may elect to license modified versions of this file under the
31 * terms and conditions of either the GPL or the CDDL or both.
32 *
33 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
34 */
35
36#ifndef IPRT_INCLUDED_formats_codeview_h
37#define IPRT_INCLUDED_formats_codeview_h
38#ifndef RT_WITHOUT_PRAGMA_ONCE
39# pragma once
40#endif
41
42
43#include <iprt/types.h>
44#include <iprt/assertcompile.h>
45
46
47/** @defgroup grp_rt_fmt_codeview Microsoft CodeView Debug Information
48 * @{
49 */
50
51
52/**
53 * CodeView Header. There are two of this, base header at the start of the debug
54 * information and a trailing header at the end.
55 */
56typedef struct RTCVHDR
57{
58 /** The magic ('NBxx'), see RTCVHDR_MAGIC_XXX. */
59 uint32_t u32Magic;
60 /**
61 * Base header: Subsection directory offset relative to this header (start).
62 * Trailing header: Offset of the base header relative to the end of the file.
63 *
64 * Called lfoBase, lfaBase, lfoDirectory, lfoDir and probably other things in
65 * the various specs/docs available. */
66 uint32_t off;
67} RTCVHDR;
68/** Pointer to a CodeView header. */
69typedef RTCVHDR *PRTCVHDR;
70
71/** @name CodeView magic values (RTCVHDR::u32Magic).
72 * @{ */
73/** CodeView from Visual C++ 5.0. Specified in the 2001 MSDN specs.chm file. */
74#define RTCVHDR_MAGIC_NB11 RT_MAKE_U32_FROM_U8('N', 'B', '1', '1')
75/** External PDB reference (often referred to as PDB 2.0). */
76#define RTCVHDR_MAGIC_NB10 RT_MAKE_U32_FROM_U8('N', 'B', '1', '0')
77/** CodeView v4.10, packed. Specified in the TIS document. */
78#define RTCVHDR_MAGIC_NB09 RT_MAKE_U32_FROM_U8('N', 'B', '0', '9')
79/** CodeView v4.00 thru v4.05. Specified in the TIS document? */
80#define RTCVHDR_MAGIC_NB08 RT_MAKE_U32_FROM_U8('N', 'B', '0', '8')
81/** Quick C for Windows 1.0 debug info. */
82#define RTCVHDR_MAGIC_NB07 RT_MAKE_U32_FROM_U8('N', 'B', '0', '7')
83/** Emitted by ILINK indicating incremental link. Comparable to NB05? */
84#define RTCVHDR_MAGIC_NB06 RT_MAKE_U32_FROM_U8('N', 'B', '0', '6')
85/** Emitted by LINK version 5.20 and later before packing. */
86#define RTCVHDR_MAGIC_NB05 RT_MAKE_U32_FROM_U8('N', 'B', '0', '5')
87/** Emitted by IBM ILINK for HLL (similar to NB02 in many ways). */
88#define RTCVHDR_MAGIC_NB04 RT_MAKE_U32_FROM_U8('N', 'B', '0', '4')
89/** Emitted by LINK version 5.10 (or similar OMF linkers), as shipped with
90 * Microsoft C v6.0 for example. More or less entirely 16-bit. */
91#define RTCVHDR_MAGIC_NB02 RT_MAKE_U32_FROM_U8('N', 'B', '0', '2')
92/* No idea what NB03 might have been. */
93/** AIX debugger format according to "IBM OS/2 16/32-bit Object Module Format
94 * (OMF) and Linear eXecutable Module Format (LX)" revision 10 (LXOMF.PDF). */
95#define RTCVHDR_MAGIC_NB01 RT_MAKE_U32_FROM_U8('N', 'B', '0', '1')
96/** Ancient CodeView format according to LXOMF.PDF. */
97#define RTCVHDR_MAGIC_NB00 RT_MAKE_U32_FROM_U8('N', 'B', '0', '0')
98/** @} */
99
100
101/** @name CV directory headers.
102 * @{ */
103
104/**
105 * Really old CV directory header used with NB00 and NB02.
106 *
107 * Uses 16-bit directory entires (RTCVDIRENT16).
108 */
109typedef struct RTCVDIRHDR16
110{
111 /** The number of directory entries. */
112 uint16_t cEntries;
113} RTCVDIRHDR16;
114/** Pointer to a old CV directory header. */
115typedef RTCVDIRHDR16 *PRTCVDIRHDR16;
116
117/**
118 * Simple 32-bit CV directory base header, used by NB04 (aka IBM HLL).
119 */
120typedef struct RTCVDIRHDR32
121{
122 /** The number of bytes of this header structure. */
123 uint16_t cbHdr;
124 /** The number of bytes per entry. */
125 uint16_t cbEntry;
126 /** The number of directory entries. */
127 uint32_t cEntries;
128} RTCVDIRHDR32;
129/** Pointer to a 32-bit CV directory header. */
130typedef RTCVDIRHDR32 *PRTCVDIRHDR32;
131
132/**
133 * Extended 32-bit CV directory header as specified in the TIS doc.
134 * The two extra fields seems to never have been assigned any official purpose.
135 */
136typedef struct RTCVDIRHDR32EX
137{
138 /** This starts the same way as the NB04 header. */
139 RTCVDIRHDR32 Core;
140 /** Tentatively decleared as the offset to the next directory generated by
141 * the incremental linker. Haven't seen this used yet. */
142 uint32_t offNextDir;
143 /** Flags, non defined apparently, so MBZ. */
144 uint32_t fFlags;
145} RTCVDIRHDR32EX;
146/** Pointer to an extended 32-bit CV directory header. */
147typedef RTCVDIRHDR32EX *PRTCVDIRHDR32EX;
148
149/** @} */
150
151
152/**
153 * 16-bit CV directory entry used with NB00 and NB02.
154 */
155typedef struct RTCVDIRENT16
156{
157 /** Subsection type (RTCVSST). */
158 uint16_t uSubSectType;
159 /** Which module (1-based, 0xffff is special). */
160 uint16_t iMod;
161 /** The lowe offset of this subsection relative to the base CV header. */
162 uint16_t offLow;
163 /** The high part of the subsection offset. */
164 uint16_t offHigh;
165 /** The size of the subsection. */
166 uint16_t cb;
167} RTCVDIRENT16;
168AssertCompileSize(RTCVDIRENT16, 10);
169/** Pointer to a 16-bit CV directory entry. */
170typedef RTCVDIRENT16 *PRTCVDIRENT16;
171
172
173/**
174 * 32-bit CV directory entry used starting with NB04.
175 */
176typedef struct RTCVDIRENT32
177{
178 /** Subsection type (RTCVSST). */
179 uint16_t uSubSectType;
180 /** Which module (1-based, 0xffff is special). */
181 uint16_t iMod;
182 /** The offset of this subsection relative to the base CV header. */
183 uint32_t off;
184 /** The size of the subsection. */
185 uint32_t cb;
186} RTCVDIRENT32;
187AssertCompileSize(RTCVDIRENT32, 12);
188/** Pointer to a 32-bit CV directory entry. */
189typedef RTCVDIRENT32 *PRTCVDIRENT32;
190/** Pointer to a const 32-bit CV directory entry. */
191typedef RTCVDIRENT32 const *PCRTCVDIRENT32;
192
193
194/**
195 * CodeView subsection types.
196 */
197typedef enum RTCVSST
198{
199 /** @name NB00, NB02 and NB04 subsection types.
200 * The actual format of each subsection varies between NB04 and the others,
201 * and it may further vary in NB04 depending on the module type.
202 * @{ */
203 kCvSst_OldModule = 0x101,
204 kCvSst_OldPublic,
205 kCvSst_OldTypes,
206 kCvSst_OldSymbols,
207 kCvSst_OldSrcLines,
208 kCvSst_OldLibraries,
209 kCvSst_OldImports,
210 kCvSst_OldCompacted,
211 kCvSst_OldSrcLnSeg = 0x109,
212 kCvSst_OldSrcLines3 = 0x10b,
213 /** @} */
214
215 /** @name NB09, NB11 (and possibly NB05, NB06, NB07, and NB08) subsection types.
216 * @{ */
217 kCvSst_Module = 0x120,
218 kCvSst_Types,
219 kCvSst_Public,
220 kCvSst_PublicSym,
221 kCvSst_Symbols,
222 kCvSst_AlignSym,
223 kCvSst_SrcLnSeg,
224 kCvSst_SrcModule,
225 kCvSst_Libraries,
226 kCvSst_GlobalSym,
227 kCvSst_GlobalPub,
228 kCvSst_GlobalTypes,
229 kCvSst_MPC,
230 kCvSst_SegMap,
231 kCvSst_SegName,
232 kCvSst_PreComp,
233 kCvSst_PreCompMap,
234 kCvSst_OffsetMap16,
235 kCvSst_OffsetMap32,
236 kCvSst_FileIndex = 0x133,
237 kCvSst_StaticSym
238 /** @} */
239} RTCVSST;
240/** Pointer to a CV subsection type value. */
241typedef RTCVSST *PRTCVSST;
242/** Pointer to a const CV subsection type value. */
243typedef RTCVSST const *PCRTCVSST;
244
245
246/**
247 * CV4 module segment info.
248 */
249typedef struct RTCVMODSEGINFO32
250{
251 /** The segment number. */
252 uint16_t iSeg;
253 /** Explicit padding. */
254 uint16_t u16Padding;
255 /** Offset into the segment. */
256 uint32_t off;
257 /** The size of the contribution. */
258 uint32_t cb;
259} RTCVMODSEGINFO32;
260typedef RTCVMODSEGINFO32 *PRTCVMODSEGINFO32;
261typedef RTCVMODSEGINFO32 const *PCRTCVMODSEGINFO32;
262
263
264/**
265 * CV4 segment map header.
266 */
267typedef struct RTCVSEGMAPHDR
268{
269 /** Number of segments descriptors in the table. */
270 uint16_t cSegs;
271 /** Number of logical segment descriptors. */
272 uint16_t cLogSegs;
273} RTCVSEGMAPHDR;
274/** Pointer to a CV4 segment map header. */
275typedef RTCVSEGMAPHDR *PRTCVSEGMAPHDR;
276/** Pointer to a const CV4 segment map header. */
277typedef RTCVSEGMAPHDR const *PCRTCVSEGMAPHDR;
278
279/**
280 * CV4 Segment map descriptor entry.
281 */
282typedef struct RTCVSEGMAPDESC
283{
284 /** Segment flags. */
285 uint16_t fFlags;
286 /** The overlay number. */
287 uint16_t iOverlay;
288 /** Group index into this segment descriptor array. 0 if not relevant.
289 * The group descriptors are found in the second half of the table. */
290 uint16_t iGroup;
291 /** Complicated. */
292 uint16_t iFrame;
293 /** Offset (byte) into the kCvSst_SegName table of the segment name, or
294 * 0xffff. */
295 uint16_t offSegName;
296 /** Offset (byte) into the kCvSst_SegName table of the class name, or 0xffff. */
297 uint16_t offClassName;
298 /** Offset into the physical segment. */
299 uint32_t off;
300 /** Size of segment. */
301 uint32_t cb;
302} RTCVSEGMAPDESC;
303/** Pointer to a segment map descriptor entry. */
304typedef RTCVSEGMAPDESC *PRTCVSEGMAPDESC;
305/** Pointer to a const segment map descriptor entry. */
306typedef RTCVSEGMAPDESC const *PCRTCVSEGMAPDESC;
307
308/** @name RTCVSEGMAPDESC_F_XXX - RTCVSEGMAPDESC::fFlags values.
309 * @{ */
310#define RTCVSEGMAPDESC_F_READ UINT16_C(0x0001)
311#define RTCVSEGMAPDESC_F_WRITE UINT16_C(0x0002)
312#define RTCVSEGMAPDESC_F_EXECUTE UINT16_C(0x0004)
313#define RTCVSEGMAPDESC_F_32BIT UINT16_C(0x0008)
314#define RTCVSEGMAPDESC_F_SEL UINT16_C(0x0100)
315#define RTCVSEGMAPDESC_F_ABS UINT16_C(0x0200)
316#define RTCVSEGMAPDESC_F_GROUP UINT16_C(0x1000)
317#define RTCVSEGMAPDESC_F_RESERVED UINT16_C(0xecf0)
318/** @} */
319
320/**
321 * CV4 segment map subsection.
322 */
323typedef struct RTCVSEGMAP
324{
325 /** The header. */
326 RTCVSEGMAPHDR Hdr;
327 /** Descriptor array. */
328 RT_FLEXIBLE_ARRAY_EXTENSION
329 RTCVSEGMAPDESC aDescs[RT_FLEXIBLE_ARRAY];
330} RTCVSEGMAP;
331/** Pointer to a segment map subsection. */
332typedef RTCVSEGMAP *PRTCVSEGMAP;
333/** Pointer to a const segment map subsection. */
334typedef RTCVSEGMAP const *PCRTCVSEGMAP;
335
336
337/**
338 * CV4 line number segment contribution start/end table entry.
339 * Part of RTCVSRCMODULE.
340 */
341typedef struct RTCVSRCRANGE
342{
343 /** Start segment offset. */
344 uint32_t offStart;
345 /** End segment offset (inclusive?). */
346 uint32_t offEnd;
347} RTCVSRCRANGE;
348/** Pointer to a line number segment contributation. */
349typedef RTCVSRCRANGE *PRTCVSRCRANGE;
350/** Pointer to a const line number segment contributation. */
351typedef RTCVSRCRANGE const *PCRTCVSRCRANGE;
352
353/**
354 * CV4 header for a line number subsection, used by kCvSst_SrcModule.
355 *
356 * The aoffSrcFiles member is followed by an array of segment ranges
357 * (RTCVSRCRANGE), cSegs in length. This may contain zero entries if the
358 * information is not known or not possible to express in this manner.
359 *
360 * After the range table, a segment index (uint16_t) mapping table follows, also
361 * cSegs in length.
362 */
363typedef struct RTCVSRCMODULE
364{
365 /** The number of files described in this subsection. */
366 uint16_t cFiles;
367 /** The number of code segments this module contributes to. */
368 uint16_t cSegs;
369 /** Offsets of the RTCVSRCFILE entries in this subsection, length given by
370 * the above cFiles member. */
371 uint32_t aoffSrcFiles[1 /*cFiles*/];
372 /* RTCVSRCRANGE aSegRanges[cSegs]; */
373 /* uint16_t aidxSegs[cSegs]; */
374} RTCVSRCMODULE;
375/** Pointer to a source module subsection header. */
376typedef RTCVSRCMODULE *PRTCVSRCMODULE;
377/** Pointer to a const source module subsection header. */
378typedef RTCVSRCMODULE const *PCRTCVSRCMODULE;
379
380/**
381 * CV4 source file, inside a kCvSst_SrcModule (see RTCVSRCMODULE::aoffSrcFiles)
382 *
383 * The aoffSrcLines member is followed by an array of segment ranges
384 * (RTCVSRCRANGE), cSegs in length. Just like for RTCVSRCMODULE this may
385 * contain zero entries.
386 *
387 * After the range table is the filename, which is preceeded by a 8-bit length
388 * (actually documented to be 16-bit, but seeing 8-bit here with wlink).
389 */
390typedef struct RTCVSRCFILE
391{
392 /** The number segments that this source file contributed to. */
393 uint16_t cSegs;
394 /** Alignment padding. */
395 uint16_t uPadding;
396 /** Offsets of the RTCVSRCLN entries for this source file, length given by
397 * the above cSegs member. Relative to the start of the subsection. */
398 uint32_t aoffSrcLines[1 /*cSegs*/];
399 /* RTCVSRCRANGE aSegRanges[cSegs]; */
400 /* uint8_t/uint16_t cchName; */
401 /* char achName[cchName]; */
402} RTCVSRCFILE;
403/** Pointer to a source file. */
404typedef RTCVSRCFILE *PRTCVSRCFILE;
405/** Pointer to a const source file. */
406typedef RTCVSRCFILE const *PCRTCVSRCFILE;
407
408/**
409 * CV4 line numbers header.
410 *
411 * The aoffLines member is followed by an array of line numbers (uint16_t).
412 */
413typedef struct RTCVSRCLINE
414{
415 /** The index of the segment these line numbers belong to. */
416 uint16_t idxSeg;
417 /** The number of line number pairs the two following tables. */
418 uint16_t cPairs;
419 /** Segment offsets, cPairs long. */
420 uint32_t aoffLines[1 /*cPairs*/];
421 /* uint16_t aiLines[cPairs]; */
422} RTCVSRCLINE;
423/** Pointer to a line numbers header. */
424typedef RTCVSRCLINE *PRTCVSRCLINE;
425/** Pointer to a const line numbers header. */
426typedef RTCVSRCLINE const *PCRTCVSRCLINE;
427
428
429/**
430 * Global symbol table header, used by kCvSst_GlobalSym and kCvSst_GlobalPub.
431 */
432typedef struct RTCVGLOBALSYMTABHDR
433{
434 /** The symbol hash function. */
435 uint16_t uSymHash;
436 /** The address hash function. */
437 uint16_t uAddrHash;
438 /** The amount of symbol information following immediately after the header. */
439 uint32_t cbSymbols;
440 /** The amount of symbol hash tables following the symbols. */
441 uint32_t cbSymHash;
442 /** The amount of address hash tables following the symbol hash tables. */
443 uint32_t cbAddrHash;
444} RTCVGLOBALSYMTABHDR;
445/** Pointer to a global symbol table header. */
446typedef RTCVGLOBALSYMTABHDR *PRTCVGLOBALSYMTABHDR;
447/** Pointer to a const global symbol table header. */
448typedef RTCVGLOBALSYMTABHDR const *PCRTCVGLOBALSYMTABHDR;
449
450
451typedef enum RTCVSYMTYPE
452{
453 /** @name Symbols that doesn't change with compilation model or target machine.
454 * @{ */
455 kCvSymType_Compile = 0x0001,
456 kCvSymType_Register,
457 kCvSymType_Constant,
458 kCvSymType_UDT,
459 kCvSymType_SSearch,
460 kCvSymType_End,
461 kCvSymType_Skip,
462 kCvSymType_CVReserve,
463 kCvSymType_ObjName,
464 kCvSymType_EndArg,
465 kCvSymType_CobolUDT,
466 kCvSymType_ManyReg,
467 kCvSymType_Return,
468 kCvSymType_EntryThis,
469 /** @} */
470
471 /** @name Symbols with 16:16 addresses.
472 * @{ */
473 kCvSymType_BpRel16 = 0x0100,
474 kCvSymType_LData16,
475 kCvSymType_GData16,
476 kCvSymType_Pub16,
477 kCvSymType_LProc16,
478 kCvSymType_GProc16,
479 kCvSymType_Thunk16,
480 kCvSymType_BLock16,
481 kCvSymType_With16,
482 kCvSymType_Label16,
483 kCvSymType_CExModel16,
484 kCvSymType_VftPath16,
485 kCvSymType_RegRel16,
486 /** @} */
487
488 /** @name Symbols with 16:32 addresses.
489 * @{ */
490 kCvSymType_BpRel32 = 0x0200,
491 kCvSymType_LData32,
492 kCvSymType_GData32,
493 kCvSymType_Pub32,
494 kCvSymType_LProc32,
495 kCvSymType_GProc32,
496 kCvSymType_Thunk32,
497 kCvSymType_Block32,
498 kCvSymType_With32,
499 kCvSymType_Label32,
500 kCvSymType_CExModel32,
501 kCvSymType_VftPath32,
502 kCvSymType_RegRel32,
503 kCvSymType_LThread32,
504 kCvSymType_GThread32,
505 /** @} */
506
507 /** @name Symbols for MIPS.
508 * @{ */
509 kCvSymType_LProcMips = 0x0300,
510 kCvSymType_GProcMips,
511 /** @} */
512
513 /** @name Symbols for Microsoft CodeView.
514 * @{ */
515 kCvSymType_ProcRef = 0x0400,
516 kCvSymType_DataRef,
517 kCvSymType_Align,
518 kCvSymType_LProcRef,
519 /** @} */
520
521 /** @name Symbols with 32-bit address (I think) and 32-bit type indices.
522 * @{ */
523 kCvSymType_V2_Register = 0x1001,
524 kCvSymType_V2_Constant,
525 kCvSymType_V2_Udt,
526 kCvSymType_V2_CobolUdt,
527 kCvSymType_V2_ManyReg,
528 kCvSymType_V2_BpRel,
529 kCvSymType_V2_LData,
530 kCvSymType_V2_GData,
531 kCvSymType_V2_Pub,
532 kCvSymType_V2_LProc,
533 kCvSymType_V2_GProc,
534 kCvSymType_V2_VftTable,
535 kCvSymType_V2_RegRel,
536 kCvSymType_V2_LThread,
537 kCvSymType_V2_GThread,
538 kCvSymType_V2_LProcMips,
539 kCvSymType_V2_GProcMips,
540 kCvSymType_V2_FrameInfo,
541 kCvSymType_V2_Compliand,
542 /** @} */
543
544 /** @name Version 3 symbol types.
545 * @{ */
546 /** Name of the object file, preceded by a 4-byte language type (ASM=0) */
547 kCvSymType_V3_Compliand = 0x1101,
548 kCvSymType_V3_Thunk,
549 kCvSymType_V3_Block,
550 kCvSymType_V3_Unknown_1104,
551 kCvSymType_V3_Label, /**< RTCVSYMV3LABEL */
552 kCvSymType_V3_Register,
553 kCvSymType_V3_Constant,
554 kCvSymType_V3_Udt,
555 kCvSymType_V3_Unknown_1109,
556 kCvSymType_V3_Unknown_110a,
557 kCvSymType_V3_BpRel,
558 kCvSymType_V3_LData, /**< RTCVSYMV3TYPEDNAME */
559 kCvSymType_V3_GData, /**< RTCVSYMV3TYPEDNAME */
560 kCvSymType_V3_Pub,
561 kCvSymType_V3_LProc,
562 kCvSymType_V3_GProc,
563 kCvSymType_V3_RegRel,
564 kCvSymType_V3_LThread,
565 kCvSymType_V3_GThread,
566 kCvSymType_V3_Unknown_1114,
567 kCvSymType_V3_Unknown_1115,
568 kCvSymType_V3_MSTool, /**< RTCVSYMV3MSTOOL */
569
570 kCvSymType_V3_ProcRef = 0x1125,
571 kCvSymType_V3_LProcRef = 0x1127,
572 kCvSymType_V3_Unknown_1128,
573 kCvSymType_V3_SectInfo = 0x1136,
574 kCvSymType_V3_SubSectInfo,
575 kCvSymType_V3_Entrypoint,
576 kCvSymType_V3_Unknown_1139,
577 kCvSymType_V3_SecuCookie,
578 kCvSymType_V3_Unknown_113b,
579 kCvSymType_V3_MsToolInfo,
580 kCvSymType_V3_MsToolEnv,
581
582 kCvSymType_VS2013_Local,
583 kCvSymType_VS2013_FpOff = 0x1144,
584 kCvSymType_VS2013_LProc32 = 0x1146,
585 kCvSymType_VS2013_GProc32,
586 /** @} */
587
588 kCvSymType_EndOfValues
589} RTCVSYMTYPE;
590AssertCompile(kCvSymType_V3_Udt == 0x1108);
591AssertCompile(kCvSymType_V3_GProc == 0x1110);
592AssertCompile(kCvSymType_V3_MSTool == 0x1116);
593AssertCompile(kCvSymType_VS2013_Local == 0x113E);
594typedef RTCVSYMTYPE *PRTCVSYMTYPE;
595typedef RTCVSYMTYPE const *PCRTCVSYMTYPE;
596
597
598/**
599 * kCvSymType_V3_MSTool format.
600 */
601typedef struct RTCVSYMV3MSTOOL
602{
603 /** Language or tool ID (3 == masm). */
604 uint32_t uLanguage;
605 /** Target CPU (0xd0 == AMD64). */
606 uint32_t uTargetCpu;
607 /** Flags. */
608 uint32_t fFlags;
609 /** Version. */
610 uint32_t uVersion;
611 /** The creator name, zero terminated.
612 *
613 * It is followed by key/value pairs of zero terminated strings giving more
614 * details about the current directory ('cwd'), compiler executable ('cl'),
615 * full command line ('cmd'), source path relative to cwd ('src'), the
616 * full program database path ('pdb'), and possibly others. Terminated by a
617 * pair of empty strings, usually. */
618 char szCreator[1];
619} RTCVSYMV3MSTOOL;
620typedef RTCVSYMV3MSTOOL *PRTCVSYMV3MSTOOL;
621typedef RTCVSYMV3MSTOOL const *PCRTCVSYMV3MSTOOL;
622
623/**
624 * kCvSymType_V3_Label format.
625 */
626typedef struct RTCVSYMV3LABEL
627{
628 /** Offset into iSection of this symbol. */
629 uint32_t offSection;
630 /** The index of the section where the symbol lives. */
631 uint16_t iSection;
632 /** Flags or something. */
633 uint8_t fFlags;
634 /** Zero terminated symbol name (variable length). */
635 char szName[1];
636} RTCVSYMV3LABEL;
637AssertCompileSize(RTCVSYMV3LABEL, 8);
638typedef RTCVSYMV3LABEL *PRTCVSYMV3LABEL;
639typedef RTCVSYMV3LABEL const *PCRTCVSYMV3LABEL;
640
641/**
642 * kCvSymType_V2_LData, kCvSymType_V2_GData and kCvSymType_V2_Pub format.
643 *
644 * Same as RTCVSYMV3TYPEDNAME but with pascal string name, rather than C.
645 */
646typedef struct RTCVSYMV2TYPEDNAME
647{
648 /** The type ID. */
649 uint32_t idType;
650 /** Offset into iSection of this symbol. */
651 uint32_t offSection;
652 /** The index of the section where the symbol lives. */
653 uint16_t iSection;
654 /** Name length. */
655 uint8_t cchName;
656 /** Zero terminated symbol name (variable length). */
657 RT_FLEXIBLE_ARRAY_EXTENSION
658 char achName[RT_FLEXIBLE_ARRAY];
659} RTCVSYMV2TYPEDNAME;
660AssertCompileMemberOffset(RTCVSYMV2TYPEDNAME, achName, 11);
661typedef RTCVSYMV2TYPEDNAME *PRTCVSYMV2TYPEDNAME;
662typedef RTCVSYMV2TYPEDNAME const *PCRTCVSYMV2TYPEDNAME;
663
664/**
665 * kCvSymType_V3_LData and kCvSymType_V3_GData format.
666 */
667typedef struct RTCVSYMV3TYPEDNAME
668{
669 /** The type ID. */
670 uint32_t idType;
671 /** Offset into iSection of this symbol. */
672 uint32_t offSection;
673 /** The index of the section where the symbol lives. */
674 uint16_t iSection;
675 /** Zero terminated symbol name (variable length). */
676 char szName[2];
677} RTCVSYMV3TYPEDNAME;
678AssertCompileSize(RTCVSYMV3TYPEDNAME, 12);
679typedef RTCVSYMV3TYPEDNAME *PRTCVSYMV3TYPEDNAME;
680typedef RTCVSYMV3TYPEDNAME const *PCRTCVSYMV3TYPEDNAME;
681
682/**
683 * kCvSymType_V3_LProc and kCvSymType_V3_GProc format.
684 */
685typedef struct RTCVSYMV3PROC
686{
687 /** Lexical scope linking: Parent. */
688 uint32_t uParent;
689 /** Lexical scope linking: End. */
690 uint32_t uEnd;
691 /** Lexical scope linking: Next. */
692 uint32_t uNext;
693 /** The procedure length. */
694 uint32_t cbProc;
695 /** Offset into the procedure where the stack frame has been setup and is an
696 * excellent position for a function breakpoint. */
697 uint32_t offDebugStart;
698 /** Offset into the procedure where the procedure is ready to return and has a
699 * return value (if applicable). */
700 uint32_t offDebugEnd;
701 /** The type ID for the procedure. */
702 uint32_t idType;
703 /** Offset into iSection of this procedure. */
704 uint32_t offSection;
705 /** The index of the section where the procedure lives. */
706 uint16_t iSection;
707 /** Flags. */
708 uint8_t fFlags;
709 /** Zero terminated procedure name (variable length). */
710 char szName[1];
711} RTCVSYMV3PROC;
712AssertCompileSize(RTCVSYMV3PROC, 36);
713typedef RTCVSYMV3PROC *PRTCVSYMV3PROC;
714typedef RTCVSYMV3PROC const *PCRTCVSYMV3PROC;
715
716
717/** @name $$SYMBOLS signatures.
718 * @{ */
719/** The $$SYMBOL table signature for CV4. */
720#define RTCVSYMBOLS_SIGNATURE_CV4 UINT32_C(0x00000001)
721/** The $$SYMBOL table signature for CV8 (MSVC 8/2005).
722 * Also seen with MSVC 2010 using -Z7, so maybe more appropriate to call it
723 * CV7? */
724#define RTCVSYMBOLS_SIGNATURE_CV8 UINT32_C(0x00000004)
725/** @} */
726
727
728/**
729 * CV8 $$SYMBOLS block header.
730 */
731typedef struct RTCV8SYMBOLSBLOCK
732{
733 /** BLock type (RTCV8SYMBLOCK_TYPE_XXX). */
734 uint32_t uType;
735 /** The block length, including this header? */
736 uint32_t cb;
737} RTCV8SYMBOLSBLOCK;
738AssertCompileSize(RTCV8SYMBOLSBLOCK, 8);
739typedef RTCV8SYMBOLSBLOCK *PRTCV8SYMBOLSBLOCK;
740typedef RTCV8SYMBOLSBLOCK const *PCRTCV8SYMBOLSBLOCK;
741
742/** @name RTCV8SYMBLOCK_TYPE_XXX - CV8 (MSVC 8/2005) $$SYMBOL table types.
743 * @{ */
744/** Symbol information.
745 * Sequence of types. Each type entry starts with a 16-bit length followed
746 * by a 16-bit RTCVSYMTYPE value. Just like CV4/5, but with C-strings
747 * instead of pascal. */
748#define RTCV8SYMBLOCK_TYPE_SYMBOLS UINT32_C(0x000000f1)
749/** Line numbers for a section. */
750#define RTCV8SYMBLOCK_TYPE_SECT_LINES UINT32_C(0x000000f2)
751/** Source file string table.
752 * The strings are null terminated. Indexed by RTCV8SYMBLOCK_TYPE_SRC_INFO. */
753#define RTCV8SYMBLOCK_TYPE_SRC_STR UINT32_C(0x000000f3)
754/** Source file information. */
755#define RTCV8SYMBLOCK_TYPE_SRC_INFO UINT32_C(0x000000f4)
756/** @} */
757
758/**
759 * Line number header found in a RTCV8SYMBLOCK_TYPE_SECT_LINES block.
760 *
761 * This is followed by a sequence of RTCV8LINESSRCMAP structures.
762 */
763typedef struct RTCV8LINESHDR
764{
765 /** Offset into the section. */
766 uint32_t offSection;
767 /** The section number. */
768 uint16_t iSection;
769 /** Padding/zero/maybe-previous-member-is-a-32-bit-value. */
770 uint16_t u16Padding;
771 /** Number of bytes covered by this table, starting at offSection. */
772 uint32_t cbSectionCovered;
773} RTCV8LINESHDR;
774AssertCompileSize(RTCV8LINESHDR, 12);
775typedef RTCV8LINESHDR *PRTCV8LINESHDR;
776typedef RTCV8LINESHDR const *PCRTCV8LINESHDR;
777
778/**
779 * CV8 (MSVC 8/2005) line number source map.
780 *
781 * This is followed by an array of RTCV8LINEPAIR.
782 */
783typedef struct RTCV8LINESSRCMAP
784{
785 /** The source file, given as an offset (byte) into the source file
786 * information table (RTCV8SYMBLOCK_TYPE_SRC_INFO). */
787 uint32_t offSourceInfo;
788 /** Number of line numbers following this structure. */
789 uint32_t cLines;
790 /** The size of this source map. */
791 uint32_t cb;
792} RTCV8LINESSRCMAP;
793AssertCompileSize(RTCV8LINESSRCMAP, 12);
794typedef RTCV8LINESSRCMAP *PRTCV8LINESSRCMAP;
795typedef RTCV8LINESSRCMAP const *PCRTCV8LINESSRCMAP;
796
797/**
798 * One line number.
799 */
800typedef struct RTCV8LINEPAIR
801{
802 /** Offset into the section of this line number. */
803 uint32_t offSection;
804 /** The line number. */
805 uint32_t uLineNumber : 30;
806 /** Indicates that it's not possible to set breakpoint? */
807 uint32_t fEndOfStatement : 1;
808} RTCV8LINEPAIR;
809AssertCompileSize(RTCV8LINEPAIR, 8);
810typedef RTCV8LINEPAIR *PRTCV8LINEPAIR;
811typedef RTCV8LINEPAIR const *PCRTCV8LINEPAIR;
812
813/**
814 * Source file information found in a RTCV8SYMBLOCK_TYPE_SRC_INFO block.
815 */
816typedef struct RTCV8SRCINFO
817{
818 /** The source file name, given as an offset into the string table
819 * (RTCV8SYMBLOCK_TYPE_SRC_STR). */
820 uint32_t offSourceName;
821 /** Digest/checksum type. */
822 uint16_t uDigestType;
823 union
824 {
825 /** RTCV8SRCINFO_DIGEST_TYPE_MD5. */
826 struct
827 {
828 /** The digest. */
829 uint8_t ab[16];
830 /** Structur alignment padding. */
831 uint8_t abPadding[2];
832 } md5;
833 /** RTCV8SRCINFO_DIGEST_TYPE_NONE: Padding. */
834 uint8_t abNone[2];
835 } Digest;
836} RTCV8SRCINFO;
837AssertCompileSize(RTCV8SRCINFO, 24);
838typedef RTCV8SRCINFO *PRTCV8SRCINFO;
839typedef RTCV8SRCINFO const *PCRTCV8SRCINFO;
840
841/** @name RTCV8SRCINFO_DIGEST_TYPE_XXX - CV8 source digest types.
842 * Used by RTCV8SRCINFO::uDigestType.
843 * @{ */
844#define RTCV8SRCINFO_DIGEST_TYPE_NONE UINT16_C(0x0000)
845#define RTCV8SRCINFO_DIGEST_TYPE_MD5 UINT16_C(0x0110)
846/** @} */
847
848
849
850/**
851 * PDB v2.0 in image debug info.
852 * The URL is constructed from the timestamp and age?
853 */
854typedef struct CVPDB20INFO
855{
856 uint32_t u32Magic; /**< CVPDB20INFO_SIGNATURE. */
857 int32_t offDbgInfo; /**< Always 0. Used to be the offset to the real debug info. */
858 uint32_t uTimestamp;
859 uint32_t uAge;
860 uint8_t szPdbFilename[4];
861} CVPDB20INFO;
862/** Pointer to in executable image PDB v2.0 info. */
863typedef CVPDB20INFO *PCVPDB20INFO;
864/** Pointer to read only in executable image PDB v2.0 info. */
865typedef CVPDB20INFO const *PCCVPDB20INFO;
866/** The CVPDB20INFO magic value. */
867#define CVPDB20INFO_MAGIC RT_MAKE_U32_FROM_U8('N','B','1','0')
868
869/**
870 * PDB v7.0 in image debug info.
871 * The URL is constructed from the signature and the age.
872 */
873#pragma pack(4)
874typedef struct CVPDB70INFO
875{
876 uint32_t u32Magic; /**< CVPDB70INFO_SIGNATURE. */
877 RTUUID PdbUuid;
878 uint32_t uAge;
879 uint8_t szPdbFilename[4];
880} CVPDB70INFO;
881#pragma pack()
882AssertCompileMemberOffset(CVPDB70INFO, PdbUuid, 4);
883AssertCompileMemberOffset(CVPDB70INFO, uAge, 4 + 16);
884/** Pointer to in executable image PDB v7.0 info. */
885typedef CVPDB70INFO *PCVPDB70INFO;
886/** Pointer to read only in executable image PDB v7.0 info. */
887typedef CVPDB70INFO const *PCCVPDB70INFO;
888/** The CVPDB70INFO magic value. */
889#define CVPDB70INFO_MAGIC RT_MAKE_U32_FROM_U8('R','S','D','S')
890
891
892/** @} */
893
894#endif /* !IPRT_INCLUDED_formats_codeview_h */
895
Note: See TracBrowser for help on using the repository browser.

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