VirtualBox

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

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

IPRT/vfs: Reverted r158866 after committing too much.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 27.0 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 RTCVSEGMAPDESC aDescs[1];
329} RTCVSEGMAP;
330/** Pointer to a segment map subsection. */
331typedef RTCVSEGMAP *PRTCVSEGMAP;
332/** Pointer to a const segment map subsection. */
333typedef RTCVSEGMAP const *PCRTCVSEGMAP;
334
335
336/**
337 * CV4 line number segment contribution start/end table entry.
338 * Part of RTCVSRCMODULE.
339 */
340typedef struct RTCVSRCRANGE
341{
342 /** Start segment offset. */
343 uint32_t offStart;
344 /** End segment offset (inclusive?). */
345 uint32_t offEnd;
346} RTCVSRCRANGE;
347/** Pointer to a line number segment contributation. */
348typedef RTCVSRCRANGE *PRTCVSRCRANGE;
349/** Pointer to a const line number segment contributation. */
350typedef RTCVSRCRANGE const *PCRTCVSRCRANGE;
351
352/**
353 * CV4 header for a line number subsection, used by kCvSst_SrcModule.
354 *
355 * The aoffSrcFiles member is followed by an array of segment ranges
356 * (RTCVSRCRANGE), cSegs in length. This may contain zero entries if the
357 * information is not known or not possible to express in this manner.
358 *
359 * After the range table, a segment index (uint16_t) mapping table follows, also
360 * cSegs in length.
361 */
362typedef struct RTCVSRCMODULE
363{
364 /** The number of files described in this subsection. */
365 uint16_t cFiles;
366 /** The number of code segments this module contributes to. */
367 uint16_t cSegs;
368 /** Offsets of the RTCVSRCFILE entries in this subsection, length given by
369 * the above cFiles member. */
370 uint32_t aoffSrcFiles[1 /*cFiles*/];
371 /* RTCVSRCRANGE aSegRanges[cSegs]; */
372 /* uint16_t aidxSegs[cSegs]; */
373} RTCVSRCMODULE;
374/** Pointer to a source module subsection header. */
375typedef RTCVSRCMODULE *PRTCVSRCMODULE;
376/** Pointer to a const source module subsection header. */
377typedef RTCVSRCMODULE const *PCRTCVSRCMODULE;
378
379/**
380 * CV4 source file, inside a kCvSst_SrcModule (see RTCVSRCMODULE::aoffSrcFiles)
381 *
382 * The aoffSrcLines member is followed by an array of segment ranges
383 * (RTCVSRCRANGE), cSegs in length. Just like for RTCVSRCMODULE this may
384 * contain zero entries.
385 *
386 * After the range table is the filename, which is preceeded by a 8-bit length
387 * (actually documented to be 16-bit, but seeing 8-bit here with wlink).
388 */
389typedef struct RTCVSRCFILE
390{
391 /** The number segments that this source file contributed to. */
392 uint16_t cSegs;
393 /** Alignment padding. */
394 uint16_t uPadding;
395 /** Offsets of the RTCVSRCLN entries for this source file, length given by
396 * the above cSegs member. Relative to the start of the subsection. */
397 uint32_t aoffSrcLines[1 /*cSegs*/];
398 /* RTCVSRCRANGE aSegRanges[cSegs]; */
399 /* uint8_t/uint16_t cchName; */
400 /* char achName[cchName]; */
401} RTCVSRCFILE;
402/** Pointer to a source file. */
403typedef RTCVSRCFILE *PRTCVSRCFILE;
404/** Pointer to a const source file. */
405typedef RTCVSRCFILE const *PCRTCVSRCFILE;
406
407/**
408 * CV4 line numbers header.
409 *
410 * The aoffLines member is followed by an array of line numbers (uint16_t).
411 */
412typedef struct RTCVSRCLINE
413{
414 /** The index of the segment these line numbers belong to. */
415 uint16_t idxSeg;
416 /** The number of line number pairs the two following tables. */
417 uint16_t cPairs;
418 /** Segment offsets, cPairs long. */
419 uint32_t aoffLines[1 /*cPairs*/];
420 /* uint16_t aiLines[cPairs]; */
421} RTCVSRCLINE;
422/** Pointer to a line numbers header. */
423typedef RTCVSRCLINE *PRTCVSRCLINE;
424/** Pointer to a const line numbers header. */
425typedef RTCVSRCLINE const *PCRTCVSRCLINE;
426
427
428/**
429 * Global symbol table header, used by kCvSst_GlobalSym and kCvSst_GlobalPub.
430 */
431typedef struct RTCVGLOBALSYMTABHDR
432{
433 /** The symbol hash function. */
434 uint16_t uSymHash;
435 /** The address hash function. */
436 uint16_t uAddrHash;
437 /** The amount of symbol information following immediately after the header. */
438 uint32_t cbSymbols;
439 /** The amount of symbol hash tables following the symbols. */
440 uint32_t cbSymHash;
441 /** The amount of address hash tables following the symbol hash tables. */
442 uint32_t cbAddrHash;
443} RTCVGLOBALSYMTABHDR;
444/** Pointer to a global symbol table header. */
445typedef RTCVGLOBALSYMTABHDR *PRTCVGLOBALSYMTABHDR;
446/** Pointer to a const global symbol table header. */
447typedef RTCVGLOBALSYMTABHDR const *PCRTCVGLOBALSYMTABHDR;
448
449
450typedef enum RTCVSYMTYPE
451{
452 /** @name Symbols that doesn't change with compilation model or target machine.
453 * @{ */
454 kCvSymType_Compile = 0x0001,
455 kCvSymType_Register,
456 kCvSymType_Constant,
457 kCvSymType_UDT,
458 kCvSymType_SSearch,
459 kCvSymType_End,
460 kCvSymType_Skip,
461 kCvSymType_CVReserve,
462 kCvSymType_ObjName,
463 kCvSymType_EndArg,
464 kCvSymType_CobolUDT,
465 kCvSymType_ManyReg,
466 kCvSymType_Return,
467 kCvSymType_EntryThis,
468 /** @} */
469
470 /** @name Symbols with 16:16 addresses.
471 * @{ */
472 kCvSymType_BpRel16 = 0x0100,
473 kCvSymType_LData16,
474 kCvSymType_GData16,
475 kCvSymType_Pub16,
476 kCvSymType_LProc16,
477 kCvSymType_GProc16,
478 kCvSymType_Thunk16,
479 kCvSymType_BLock16,
480 kCvSymType_With16,
481 kCvSymType_Label16,
482 kCvSymType_CExModel16,
483 kCvSymType_VftPath16,
484 kCvSymType_RegRel16,
485 /** @} */
486
487 /** @name Symbols with 16:32 addresses.
488 * @{ */
489 kCvSymType_BpRel32 = 0x0200,
490 kCvSymType_LData32,
491 kCvSymType_GData32,
492 kCvSymType_Pub32,
493 kCvSymType_LProc32,
494 kCvSymType_GProc32,
495 kCvSymType_Thunk32,
496 kCvSymType_Block32,
497 kCvSymType_With32,
498 kCvSymType_Label32,
499 kCvSymType_CExModel32,
500 kCvSymType_VftPath32,
501 kCvSymType_RegRel32,
502 kCvSymType_LThread32,
503 kCvSymType_GThread32,
504 /** @} */
505
506 /** @name Symbols for MIPS.
507 * @{ */
508 kCvSymType_LProcMips = 0x0300,
509 kCvSymType_GProcMips,
510 /** @} */
511
512 /** @name Symbols for Microsoft CodeView.
513 * @{ */
514 kCvSymType_ProcRef = 0x0400,
515 kCvSymType_DataRef,
516 kCvSymType_Align,
517 kCvSymType_LProcRef,
518 /** @} */
519
520 /** @name Symbols with 32-bit address (I think) and 32-bit type indices.
521 * @{ */
522 kCvSymType_V2_Register = 0x1001,
523 kCvSymType_V2_Constant,
524 kCvSymType_V2_Udt,
525 kCvSymType_V2_CobolUdt,
526 kCvSymType_V2_ManyReg,
527 kCvSymType_V2_BpRel,
528 kCvSymType_V2_LData,
529 kCvSymType_V2_GData,
530 kCvSymType_V2_Pub,
531 kCvSymType_V2_LProc,
532 kCvSymType_V2_GProc,
533 kCvSymType_V2_VftTable,
534 kCvSymType_V2_RegRel,
535 kCvSymType_V2_LThread,
536 kCvSymType_V2_GThread,
537 kCvSymType_V2_Unknown_1010,
538 kCvSymType_V2_Unknown_1011,
539 kCvSymType_V2_FrameInfo,
540 kCvSymType_V2_Compliand,
541 /** @} */
542
543 /** @name Version 3 symbol types.
544 * @{ */
545 /** Name of the object file, preceded by a 4-byte language type (ASM=0) */
546 kCvSymType_V3_Compliand = 0x1101,
547 kCvSymType_V3_Thunk,
548 kCvSymType_V3_Block,
549 kCvSymType_V3_Unknown_1104,
550 kCvSymType_V3_Label, /**< RTCVSYMV3LABEL */
551 kCvSymType_V3_Register,
552 kCvSymType_V3_Constant,
553 kCvSymType_V3_Udt,
554 kCvSymType_V3_Unknown_1109,
555 kCvSymType_V3_Unknown_110a,
556 kCvSymType_V3_BpRel,
557 kCvSymType_V3_LData, /**< RTCVSYMV3TYPEDNAME */
558 kCvSymType_V3_GData, /**< RTCVSYMV3TYPEDNAME */
559 kCvSymType_V3_Pub,
560 kCvSymType_V3_LProc,
561 kCvSymType_V3_GProc,
562 kCvSymType_V3_RegRel,
563 kCvSymType_V3_LThread,
564 kCvSymType_V3_GThread,
565 kCvSymType_V3_Unknown_1114,
566 kCvSymType_V3_Unknown_1115,
567 kCvSymType_V3_MSTool, /**< RTCVSYMV3MSTOOL */
568
569 kCvSymType_V3_PubFunc1 = 0x1125,
570 kCvSymType_V3_PubFunc2 = 0x1127,
571 kCvSymType_V3_SectInfo = 0x1136,
572 kCvSymType_V3_SubSectInfo,
573 kCvSymType_V3_Entrypoint,
574 kCvSymType_V3_Unknown_1139,
575 kCvSymType_V3_SecuCookie,
576 kCvSymType_V3_Unknown_113b,
577 kCvSymType_V3_MsToolInfo,
578 kCvSymType_V3_MsToolEnv,
579
580 kCvSymType_VS2013_Local,
581 kCvSymType_VS2013_FpOff = 0x1144,
582 kCvSymType_VS2013_LProc32 = 0x1146,
583 kCvSymType_VS2013_GProc32,
584 /** @} */
585
586 kCvSymType_EndOfValues
587} RTCVSYMTYPE;
588AssertCompile(kCvSymType_V3_Udt == 0x1108);
589AssertCompile(kCvSymType_V3_GProc == 0x1110);
590AssertCompile(kCvSymType_V3_MSTool == 0x1116);
591AssertCompile(kCvSymType_VS2013_Local == 0x113E);
592typedef RTCVSYMTYPE *PRTCVSYMTYPE;
593typedef RTCVSYMTYPE const *PCRTCVSYMTYPE;
594
595
596/**
597 * kCvSymType_V3_MSTool format.
598 */
599typedef struct RTCVSYMV3MSTOOL
600{
601 /** Language or tool ID (3 == masm). */
602 uint32_t uLanguage;
603 /** Target CPU (0xd0 == AMD64). */
604 uint32_t uTargetCpu;
605 /** Flags. */
606 uint32_t fFlags;
607 /** Version. */
608 uint32_t uVersion;
609 /** The creator name, zero terminated.
610 *
611 * It is followed by key/value pairs of zero terminated strings giving more
612 * details about the current directory ('cwd'), compiler executable ('cl'),
613 * full command line ('cmd'), source path relative to cwd ('src'), the
614 * full program database path ('pdb'), and possibly others. Terminated by a
615 * pair of empty strings, usually. */
616 char szCreator[1];
617} RTCVSYMV3MSTOOL;
618typedef RTCVSYMV3MSTOOL *PRTCVSYMV3MSTOOL;
619typedef RTCVSYMV3MSTOOL const *PCRTCVSYMV3MSTOOL;
620
621/**
622 * kCvSymType_V3_Label format.
623 */
624typedef struct RTCVSYMV3LABEL
625{
626 /** Offset into iSection of this symbol. */
627 uint32_t offSection;
628 /** The index of the section where the symbol lives. */
629 uint16_t iSection;
630 /** Flags or something. */
631 uint8_t fFlags;
632 /** Zero terminated symbol name (variable length). */
633 char szName[1];
634} RTCVSYMV3LABEL;
635AssertCompileSize(RTCVSYMV3LABEL, 8);
636typedef RTCVSYMV3LABEL *PRTCVSYMV3LABEL;
637typedef RTCVSYMV3LABEL const *PCRTCVSYMV3LABEL;
638
639/**
640 * kCvSymType_V3_LData and kCvSymType_V3_GData format.
641 */
642typedef struct RTCVSYMV3TYPEDNAME
643{
644 /** The type ID. */
645 uint32_t idType;
646 /** Offset into iSection of this symbol. */
647 uint32_t offSection;
648 /** The index of the section where the symbol lives. */
649 uint16_t iSection;
650 /** Zero terminated symbol name (variable length). */
651 char szName[2];
652} RTCVSYMV3TYPEDNAME;
653AssertCompileSize(RTCVSYMV3TYPEDNAME, 12);
654typedef RTCVSYMV3TYPEDNAME *PRTCVSYMV3TYPEDNAME;
655typedef RTCVSYMV3TYPEDNAME const *PCRTCVSYMV3TYPEDNAME;
656
657/**
658 * kCvSymType_V3_LProc and kCvSymType_V3_GProc format.
659 */
660typedef struct RTCVSYMV3PROC
661{
662 /** Lexical scope linking: Parent. */
663 uint32_t uParent;
664 /** Lexical scope linking: End. */
665 uint32_t uEnd;
666 /** Lexical scope linking: Next. */
667 uint32_t uNext;
668 /** The procedure length. */
669 uint32_t cbProc;
670 /** Offset into the procedure where the stack frame has been setup and is an
671 * excellent position for a function breakpoint. */
672 uint32_t offDebugStart;
673 /** Offset into the procedure where the procedure is ready to return and has a
674 * return value (if applicable). */
675 uint32_t offDebugEnd;
676 /** The type ID for the procedure. */
677 uint32_t idType;
678 /** Offset into iSection of this procedure. */
679 uint32_t offSection;
680 /** The index of the section where the procedure lives. */
681 uint16_t iSection;
682 /** Flags. */
683 uint8_t fFlags;
684 /** Zero terminated procedure name (variable length). */
685 char szName[1];
686} RTCVSYMV3PROC;
687AssertCompileSize(RTCVSYMV3PROC, 36);
688typedef RTCVSYMV3PROC *PRTCVSYMV3PROC;
689typedef RTCVSYMV3PROC const *PCRTCVSYMV3PROC;
690
691
692/** @name $$SYMBOLS signatures.
693 * @{ */
694/** The $$SYMBOL table signature for CV4. */
695#define RTCVSYMBOLS_SIGNATURE_CV4 UINT32_C(0x00000001)
696/** The $$SYMBOL table signature for CV8 (MSVC 8/2005).
697 * Also seen with MSVC 2010 using -Z7, so maybe more appropriate to call it
698 * CV7? */
699#define RTCVSYMBOLS_SIGNATURE_CV8 UINT32_C(0x00000004)
700/** @} */
701
702
703/**
704 * CV8 $$SYMBOLS block header.
705 */
706typedef struct RTCV8SYMBOLSBLOCK
707{
708 /** BLock type (RTCV8SYMBLOCK_TYPE_XXX). */
709 uint32_t uType;
710 /** The block length, including this header? */
711 uint32_t cb;
712} RTCV8SYMBOLSBLOCK;
713AssertCompileSize(RTCV8SYMBOLSBLOCK, 8);
714typedef RTCV8SYMBOLSBLOCK *PRTCV8SYMBOLSBLOCK;
715typedef RTCV8SYMBOLSBLOCK const *PCRTCV8SYMBOLSBLOCK;
716
717/** @name RTCV8SYMBLOCK_TYPE_XXX - CV8 (MSVC 8/2005) $$SYMBOL table types.
718 * @{ */
719/** Symbol information.
720 * Sequence of types. Each type entry starts with a 16-bit length followed
721 * by a 16-bit RTCVSYMTYPE value. Just like CV4/5, but with C-strings
722 * instead of pascal. */
723#define RTCV8SYMBLOCK_TYPE_SYMBOLS UINT32_C(0x000000f1)
724/** Line numbers for a section. */
725#define RTCV8SYMBLOCK_TYPE_SECT_LINES UINT32_C(0x000000f2)
726/** Source file string table.
727 * The strings are null terminated. Indexed by RTCV8SYMBLOCK_TYPE_SRC_INFO. */
728#define RTCV8SYMBLOCK_TYPE_SRC_STR UINT32_C(0x000000f3)
729/** Source file information. */
730#define RTCV8SYMBLOCK_TYPE_SRC_INFO UINT32_C(0x000000f4)
731/** @} */
732
733/**
734 * Line number header found in a RTCV8SYMBLOCK_TYPE_SECT_LINES block.
735 *
736 * This is followed by a sequence of RTCV8LINESSRCMAP structures.
737 */
738typedef struct RTCV8LINESHDR
739{
740 /** Offset into the section. */
741 uint32_t offSection;
742 /** The section number. */
743 uint16_t iSection;
744 /** Padding/zero/maybe-previous-member-is-a-32-bit-value. */
745 uint16_t u16Padding;
746 /** Number of bytes covered by this table, starting at offSection. */
747 uint32_t cbSectionCovered;
748} RTCV8LINESHDR;
749AssertCompileSize(RTCV8LINESHDR, 12);
750typedef RTCV8LINESHDR *PRTCV8LINESHDR;
751typedef RTCV8LINESHDR const *PCRTCV8LINESHDR;
752
753/**
754 * CV8 (MSVC 8/2005) line number source map.
755 *
756 * This is followed by an array of RTCV8LINEPAIR.
757 */
758typedef struct RTCV8LINESSRCMAP
759{
760 /** The source file, given as an offset (byte) into the source file
761 * information table (RTCV8SYMBLOCK_TYPE_SRC_INFO). */
762 uint32_t offSourceInfo;
763 /** Number of line numbers following this structure. */
764 uint32_t cLines;
765 /** The size of this source map. */
766 uint32_t cb;
767} RTCV8LINESSRCMAP;
768AssertCompileSize(RTCV8LINESSRCMAP, 12);
769typedef RTCV8LINESSRCMAP *PRTCV8LINESSRCMAP;
770typedef RTCV8LINESSRCMAP const *PCRTCV8LINESSRCMAP;
771
772/**
773 * One line number.
774 */
775typedef struct RTCV8LINEPAIR
776{
777 /** Offset into the section of this line number. */
778 uint32_t offSection;
779 /** The line number. */
780 uint32_t uLineNumber : 30;
781 /** Indicates that it's not possible to set breakpoint? */
782 uint32_t fEndOfStatement : 1;
783} RTCV8LINEPAIR;
784AssertCompileSize(RTCV8LINEPAIR, 8);
785typedef RTCV8LINEPAIR *PRTCV8LINEPAIR;
786typedef RTCV8LINEPAIR const *PCRTCV8LINEPAIR;
787
788/**
789 * Source file information found in a RTCV8SYMBLOCK_TYPE_SRC_INFO block.
790 */
791typedef struct RTCV8SRCINFO
792{
793 /** The source file name, given as an offset into the string table
794 * (RTCV8SYMBLOCK_TYPE_SRC_STR). */
795 uint32_t offSourceName;
796 /** Digest/checksum type. */
797 uint16_t uDigestType;
798 union
799 {
800 /** RTCV8SRCINFO_DIGEST_TYPE_MD5. */
801 struct
802 {
803 /** The digest. */
804 uint8_t ab[16];
805 /** Structur alignment padding. */
806 uint8_t abPadding[2];
807 } md5;
808 /** RTCV8SRCINFO_DIGEST_TYPE_NONE: Padding. */
809 uint8_t abNone[2];
810 } Digest;
811} RTCV8SRCINFO;
812AssertCompileSize(RTCV8SRCINFO, 24);
813typedef RTCV8SRCINFO *PRTCV8SRCINFO;
814typedef RTCV8SRCINFO const *PCRTCV8SRCINFO;
815
816/** @name RTCV8SRCINFO_DIGEST_TYPE_XXX - CV8 source digest types.
817 * Used by RTCV8SRCINFO::uDigestType.
818 * @{ */
819#define RTCV8SRCINFO_DIGEST_TYPE_NONE UINT16_C(0x0000)
820#define RTCV8SRCINFO_DIGEST_TYPE_MD5 UINT16_C(0x0110)
821/** @} */
822
823
824
825/**
826 * PDB v2.0 in image debug info.
827 * The URL is constructed from the timestamp and age?
828 */
829typedef struct CVPDB20INFO
830{
831 uint32_t u32Magic; /**< CVPDB20INFO_SIGNATURE. */
832 int32_t offDbgInfo; /**< Always 0. Used to be the offset to the real debug info. */
833 uint32_t uTimestamp;
834 uint32_t uAge;
835 uint8_t szPdbFilename[4];
836} CVPDB20INFO;
837/** Pointer to in executable image PDB v2.0 info. */
838typedef CVPDB20INFO *PCVPDB20INFO;
839/** Pointer to read only in executable image PDB v2.0 info. */
840typedef CVPDB20INFO const *PCCVPDB20INFO;
841/** The CVPDB20INFO magic value. */
842#define CVPDB20INFO_MAGIC RT_MAKE_U32_FROM_U8('N','B','1','0')
843
844/**
845 * PDB v7.0 in image debug info.
846 * The URL is constructed from the signature and the age.
847 */
848#pragma pack(4)
849typedef struct CVPDB70INFO
850{
851 uint32_t u32Magic; /**< CVPDB70INFO_SIGNATURE. */
852 RTUUID PdbUuid;
853 uint32_t uAge;
854 uint8_t szPdbFilename[4];
855} CVPDB70INFO;
856#pragma pack()
857AssertCompileMemberOffset(CVPDB70INFO, PdbUuid, 4);
858AssertCompileMemberOffset(CVPDB70INFO, uAge, 4 + 16);
859/** Pointer to in executable image PDB v7.0 info. */
860typedef CVPDB70INFO *PCVPDB70INFO;
861/** Pointer to read only in executable image PDB v7.0 info. */
862typedef CVPDB70INFO const *PCCVPDB70INFO;
863/** The CVPDB70INFO magic value. */
864#define CVPDB70INFO_MAGIC RT_MAKE_U32_FROM_U8('R','S','D','S')
865
866
867/** @} */
868
869#endif /* !IPRT_INCLUDED_formats_codeview_h */
870
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