VirtualBox

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

Last change on this file since 77807 was 76585, checked in by vboxsync, 6 years ago

*: scm --fix-header-guard-endif

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