VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Wine/include/wine/mscvpdb.h@ 38565

最後變更 在這個檔案從38565是 33656,由 vboxsync 提交於 14 年 前

*: rebrand Sun (L)GPL disclaimers

  • 屬性 svn:eol-style 設為 native
檔案大小: 64.9 KB
 
1/*
2 * MS debug information definitions.
3 *
4 * Copyright (C) 1996 Eric Youngdale
5 * Copyright (C) 1999-2000 Ulrich Weigand
6 * Copyright (C) 2004 Eric Pouech
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 */
22
23/*
24 * Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
25 * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
26 * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
27 * a choice of LGPL license versions is made available with the language indicating
28 * that LGPLv2 or any later version may be used, or where a choice of which version
29 * of the LGPL is applied is otherwise unspecified.
30 */
31
32/* MS has stored all its debug information in a set of structures
33 * which has been rather consistent across the years (ie you can grasp
34 * some continuity, and not so many drastic changes).
35 *
36 * A bit of history on the various formats
37 * MSVC 1.0 PDB v1 (new format for debug info)
38 * MSVC 2.0 Inclusion in link of debug info (PDB v2)
39 * MSVC 5.0 Types are 24 bits (instead of 16 for <= 4.x)
40 * MSVC x.0 PDB (change in internal streams layout)
41 *
42 * .DBG Contains COFF, FPO and Codeview info
43 * .PDB New format for debug info (information is
44 * derived from Codeview information)
45 * VCx0.PDB x major MSVC number, stores types, while
46 * <project>.PDB stores symbols.
47 *
48 * Debug information can either be found in the debug section of a PE
49 * module (in something close to a .DBG file), or the debug section
50 * can actually refer to an external file, which can be in turn,
51 * either a .DBG or .PDB file.
52 *
53 * Regarding PDB files:
54 * -------------------
55 * They are implemented as a set of internal files (as a small file
56 * system). The file is split into blocks, an internal file is made
57 * of a set of blocks. Internal files are accessed through
58 * numbers. For example,
59 * 1/ is the ROOT (basic information on the file)
60 * 2/ is the Symbol information (global symbols, local variables...)
61 * 3/ is the Type internal file (each the symbols can have type
62 * information associated with it).
63 *
64 * Over the years, three formats existed for the PDB:
65 * - ?? was rather linked to 16 bit code (our support shall be rather
66 * bad)
67 * - JG: it's the signature embedded in the file header. This format
68 * has been used in MSVC 2.0 => 5.0.
69 * - DS: it's the signature embedded in the file header. It's the
70 * current format supported my MS.
71 *
72 * Types internal stream
73 * ---------------------
74 * Types (from the Type internal file) have existed in three flavors
75 * (note that those flavors came as historical evolution, but there
76 * isn't a one to one link between types evolution and PDB formats'
77 * evolutions:
78 * - the first flavor (suffixed by V1 in this file), where the types
79 * and subtypes are 16 bit entities; and where strings are in Pascal
80 * format (first char is their length and are not 0 terminated)
81 * - the second flavor (suffixed by V2) differs from first flavor with
82 * types and subtypes as 32 bit entities. This forced some
83 * reordering of fields in some types
84 * - the third flavor (suffixed by V3) differs from second flavor with
85 * strings stored as C strings (ie are 0 terminated, instead of
86 * length prefixed)
87 * The different flavors can coexist in the same file (is this really
88 * true ??)
89 *
90 * For the evolution of types, the need of the second flavor was the
91 * number of types to be defined (limited to 0xFFFF, including the C
92 * basic types); the need of the third flavor is the increase of
93 * symbol size (to be greater than 256), which was likely needed for
94 * complex C++ types (nested + templates).
95 *
96 * It's somehow difficult to represent the layout of those types on
97 * disk because:
98 * - some integral values are stored as numeric leaf, which size is
99 * variable depending on its value
100 *
101 * Symbols internal stream
102 * -----------------------
103 * Here also we find three flavors (that we've suffixed with _V1, _V2
104 * and _V3) even if their evolution is closer to the evolution of
105 * types, they are not completely linked together.
106 */
107
108#include "pshpack1.h"
109
110/* ======================================== *
111 * Type information
112 * ======================================== */
113
114struct p_string
115{
116 unsigned char namelen;
117 char name[1];
118};
119
120union codeview_type
121{
122 struct
123 {
124 unsigned short int len;
125 short int id;
126 } generic;
127
128 struct
129 {
130 unsigned short int len;
131 short int id;
132 short int attribute;
133 short int type;
134 } modifier_v1;
135
136 struct
137 {
138 unsigned short int len;
139 short int id;
140 int type;
141 short int attribute;
142 } modifier_v2;
143
144 struct
145 {
146 unsigned short int len;
147 short int id;
148 short int attribute;
149 short int datatype;
150 struct p_string p_name;
151 } pointer_v1;
152
153 struct
154 {
155 unsigned short int len;
156 short int id;
157 unsigned int datatype;
158 unsigned int attribute;
159 struct p_string p_name;
160 } pointer_v2;
161
162 struct
163 {
164 unsigned short int len;
165 short int id;
166 short int elemtype;
167 short int idxtype;
168 unsigned short int arrlen; /* numeric leaf */
169#if 0
170 struct p_string p_name;
171#endif
172 } array_v1;
173
174 struct
175 {
176 unsigned short int len;
177 short int id;
178 unsigned int elemtype;
179 unsigned int idxtype;
180 unsigned short int arrlen; /* numeric leaf */
181#if 0
182 struct p_string p_name;
183#endif
184 } array_v2;
185
186 struct
187 {
188 unsigned short int len;
189 short int id;
190 unsigned int elemtype;
191 unsigned int idxtype;
192 unsigned short int arrlen; /* numeric leaf */
193#if 0
194 char name[1];
195#endif
196 } array_v3;
197
198 struct
199 {
200 unsigned short int len;
201 short int id;
202 short int n_element;
203 short int fieldlist;
204 short int property;
205 short int derived;
206 short int vshape;
207 unsigned short int structlen; /* numeric leaf */
208#if 0
209 struct p_string p_name;
210#endif
211 } struct_v1;
212
213 struct
214 {
215 unsigned short int len;
216 short int id;
217 short int n_element;
218 short int property;
219 unsigned int fieldlist;
220 unsigned int derived;
221 unsigned int vshape;
222 unsigned short int structlen; /* numeric leaf */
223#if 0
224 struct p_string p_name;
225#endif
226 } struct_v2;
227
228 struct
229 {
230 unsigned short int len;
231 short int id;
232 short int n_element;
233 short int property;
234 unsigned int fieldlist;
235 unsigned int derived;
236 unsigned int vshape;
237 unsigned short int structlen; /* numeric leaf */
238#if 0
239 char name[1];
240#endif
241 } struct_v3;
242
243 struct
244 {
245 unsigned short int len;
246 short int id;
247 short int count;
248 short int fieldlist;
249 short int property;
250 unsigned short int un_len; /* numeric leaf */
251#if 0
252 struct p_string p_name;
253#endif
254 } union_v1;
255
256 struct
257 {
258 unsigned short int len;
259 short int id;
260 short int count;
261 short int property;
262 unsigned int fieldlist;
263 unsigned short int un_len; /* numeric leaf */
264#if 0
265 struct p_string p_name;
266#endif
267 } union_v2;
268
269 struct
270 {
271 unsigned short int len;
272 short int id;
273 short int count;
274 short int property;
275 unsigned int fieldlist;
276 unsigned short int un_len; /* numeric leaf */
277#if 0
278 char name[1];
279#endif
280 } union_v3;
281
282 struct
283 {
284 unsigned short int len;
285 short int id;
286 short int count;
287 short int type;
288 short int fieldlist;
289 short int property;
290 struct p_string p_name;
291 } enumeration_v1;
292
293 struct
294 {
295 unsigned short int len;
296 short int id;
297 short int count;
298 short int property;
299 unsigned int type;
300 unsigned int fieldlist;
301 struct p_string p_name;
302 } enumeration_v2;
303
304 struct
305 {
306 unsigned short int len;
307 short int id;
308 short int count;
309 short int property;
310 unsigned int type;
311 unsigned int fieldlist;
312 char name[1];
313 } enumeration_v3;
314
315 struct
316 {
317 unsigned short int len;
318 short int id;
319 unsigned short int rvtype;
320 unsigned char call;
321 unsigned char reserved;
322 unsigned short int params;
323 unsigned short int arglist;
324 } procedure_v1;
325
326 struct
327 {
328 unsigned short int len;
329 short int id;
330 unsigned int rvtype;
331 unsigned char call;
332 unsigned char reserved;
333 unsigned short int params;
334 unsigned int arglist;
335 } procedure_v2;
336
337 struct
338 {
339 unsigned short int len;
340 short int id;
341 unsigned short int rvtype;
342 unsigned short int class_type;
343 unsigned short int this_type;
344 unsigned char call;
345 unsigned char reserved;
346 unsigned short int params;
347 unsigned short int arglist;
348 unsigned int this_adjust;
349 } mfunction_v1;
350
351 struct
352 {
353 unsigned short int len;
354 short int id;
355 unsigned int rvtype;
356 unsigned int class_type;
357 unsigned this_type;
358 unsigned char call;
359 unsigned char reserved;
360 unsigned short params;
361 unsigned int arglist;
362 unsigned int this_adjust;
363 } mfunction_v2;
364};
365
366union codeview_reftype
367{
368 struct
369 {
370 unsigned short int len;
371 short int id;
372 } generic;
373
374 struct
375 {
376 unsigned short int len;
377 short int id;
378 unsigned char list[1];
379 } fieldlist;
380
381 struct
382 {
383 unsigned short int len;
384 short int id;
385 unsigned char nbits;
386 unsigned char bitoff;
387 unsigned short type;
388 } bitfield_v1;
389
390 struct
391 {
392 unsigned short int len;
393 short int id;
394 unsigned int type;
395 unsigned char nbits;
396 unsigned char bitoff;
397 } bitfield_v2;
398
399 struct
400 {
401 unsigned short int len;
402 short int id;
403 unsigned short num;
404 unsigned short args[1];
405 } arglist_v1;
406
407 struct
408 {
409 unsigned short int len;
410 short int id;
411 unsigned num;
412 unsigned args[1];
413 } arglist_v2;
414
415 struct
416 {
417 unsigned short int len;
418 short int id;
419 unsigned short num;
420 unsigned short drvdcls[1];
421 } derived_v1;
422
423 struct
424 {
425 unsigned short int len;
426 short int id;
427 unsigned num;
428 unsigned drvdcls[1];
429 } derived_v2;
430};
431
432union codeview_fieldtype
433{
434 struct
435 {
436 short int id;
437 } generic;
438
439 struct
440 {
441 short int id;
442 short int type;
443 short int attribute;
444 unsigned short int offset; /* numeric leaf */
445 } bclass_v1;
446
447 struct
448 {
449 short int id;
450 short int attribute;
451 unsigned int type;
452 unsigned short int offset; /* numeric leaf */
453 } bclass_v2;
454
455 struct
456 {
457 short int id;
458 short int btype;
459 short int vbtype;
460 short int attribute;
461 unsigned short int vbpoff; /* numeric leaf */
462#if 0
463 unsigned short int vboff; /* numeric leaf */
464#endif
465 } vbclass_v1;
466
467 struct
468 {
469 short int id;
470 short int attribute;
471 unsigned int btype;
472 unsigned int vbtype;
473 unsigned short int vbpoff; /* numeric leaf */
474#if 0
475 unsigned short int vboff; /* numeric leaf */
476#endif
477 } vbclass_v2;
478
479 struct
480 {
481 short int id;
482 short int attribute;
483 unsigned short int value; /* numeric leaf */
484#if 0
485 struct p_string p_name;
486#endif
487 } enumerate_v1;
488
489 struct
490 {
491 short int id;
492 short int attribute;
493 unsigned short int value; /* numeric leaf */
494#if 0
495 char name[1];
496#endif
497 } enumerate_v3;
498
499 struct
500 {
501 short int id;
502 short int type;
503 struct p_string p_name;
504 } friendfcn_v1;
505
506 struct
507 {
508 short int id;
509 short int _pad0;
510 unsigned int type;
511 struct p_string p_name;
512 } friendfcn_v2;
513
514 struct
515 {
516 short int id;
517 short int type;
518 short int attribute;
519 unsigned short int offset; /* numeric leaf */
520#if 0
521 struct p_string p_name;
522#endif
523 } member_v1;
524
525 struct
526 {
527 short int id;
528 short int attribute;
529 unsigned int type;
530 unsigned short int offset; /* numeric leaf */
531#if 0
532 struct p_string p_name;
533#endif
534 } member_v2;
535
536 struct
537 {
538 short int id;
539 short int attribute;
540 unsigned int type;
541 unsigned short int offset; /* numeric leaf */
542#if 0
543 unsigned char name[1];
544#endif
545 }
546 member_v3;
547
548 struct
549 {
550 short int id;
551 short int type;
552 short int attribute;
553 struct p_string p_name;
554 } stmember_v1;
555
556 struct
557 {
558 short int id;
559 short int attribute;
560 unsigned int type;
561 struct p_string p_name;
562 } stmember_v2;
563
564 struct
565 {
566 short int id;
567 short int attribute;
568 unsigned int type;
569 char name[1];
570 } stmember_v3;
571
572 struct
573 {
574 short int id;
575 short int count;
576 short int mlist;
577 struct p_string p_name;
578 } method_v1;
579
580 struct
581 {
582 short int id;
583 short int count;
584 unsigned int mlist;
585 struct p_string p_name;
586 } method_v2;
587
588 struct
589 {
590 short int id;
591 short int count;
592 unsigned int mlist;
593 char name[1];
594 } method_v3;
595
596 struct
597 {
598 short int id;
599 short int type;
600 struct p_string p_name;
601 } nesttype_v1;
602
603 struct
604 {
605 short int id;
606 short int _pad0;
607 unsigned int type;
608 struct p_string p_name;
609 } nesttype_v2;
610
611 struct
612 {
613 short int id;
614 short int _pad0;
615 unsigned int type;
616 char name[1];
617 } nesttype_v3;
618
619 struct
620 {
621 short int id;
622 short int type;
623 } vfunctab_v1;
624
625 struct
626 {
627 short int id;
628 short int _pad0;
629 unsigned int type;
630 } vfunctab_v2;
631
632 struct
633 {
634 short int id;
635 short int type;
636 } friendcls_v1;
637
638 struct
639 {
640 short int id;
641 short int _pad0;
642 unsigned int type;
643 } friendcls_v2;
644
645 struct
646 {
647 short int id;
648 short int attribute;
649 short int type;
650 struct p_string p_name;
651 } onemethod_v1;
652
653 struct
654 {
655 short int id;
656 short int attribute;
657 unsigned int type;
658 struct p_string p_name;
659 } onemethod_v2;
660
661 struct
662 {
663 short int id;
664 short int attribute;
665 unsigned int type;
666 char name[1];
667 } onemethod_v3;
668
669 struct
670 {
671 short int id;
672 short int attribute;
673 short int type;
674 unsigned int vtab_offset;
675 struct p_string p_name;
676 } onemethod_virt_v1;
677
678 struct
679 {
680 short int id;
681 short int attribute;
682 unsigned int type;
683 unsigned int vtab_offset;
684 struct p_string p_name;
685 } onemethod_virt_v2;
686
687 struct
688 {
689 short int id;
690 short int attribute;
691 unsigned int type;
692 unsigned int vtab_offset;
693 char name[1];
694 } onemethod_virt_v3;
695
696 struct
697 {
698 short int id;
699 short int type;
700 unsigned int offset;
701 } vfuncoff_v1;
702
703 struct
704 {
705 short int id;
706 short int _pad0;
707 unsigned int type;
708 unsigned int offset;
709 } vfuncoff_v2;
710
711 struct
712 {
713 short int id;
714 short int attribute;
715 short int type;
716 struct p_string p_name;
717 } nesttypeex_v1;
718
719 struct
720 {
721 short int id;
722 short int attribute;
723 unsigned int type;
724 struct p_string p_name;
725 } nesttypeex_v2;
726
727 struct
728 {
729 short int id;
730 short int attribute;
731 unsigned int type;
732 struct p_string p_name;
733 } membermodify_v2;
734
735};
736
737
738/*
739 * This covers the basic datatypes that VC++ seems to be using these days.
740 * 32 bit mode only. There are additional numbers for the pointers in 16
741 * bit mode. There are many other types listed in the documents, but these
742 * are apparently not used by the compiler, or represent pointer types
743 * that are not used.
744 *
745 * Official MS documentation says that type (< 0x4000, so 12 bits) is made of:
746 * +----------+------+------+----------+------+
747 * | 11 | 10-8 | 7-4 | 3 | 2-0 |
748 * +----------+------+------+----------+------+
749 * | reserved | mode | type | reserved | size |
750 * +----------+------+------+----------+------+
751 * In recent PDB files, type 8 exists, and is seen as an HRESULT... So we've
752 * added this basic type... as if bit 3 had been integrated into the size field
753 */
754
755/* the type number of a built-in type is a 16-bit value specified in the following format:
756 bit # | 11 | 10-8 | 7-4 | 3 | 2-0 |
757 field | reserved | mode | type | reserved | size |
758
759 where
760 <type> is one of the following types:
761 0x00 Special
762 0x01 Signed integral value
763 0x02 Unsigned integral value
764 0x03 Boolean
765 0x04 Real
766 0x05 Complex
767 0x06 Special2
768 0x07 Real int value
769 0x08 Reserved
770 0x09 Reserved
771 0x0a Reserved
772 0x0b Reserved
773 0x0c Reserved
774 0x0d Reserved
775 0x0e Reserved
776 0x0f Reserved for debugger expression evaluator
777
778 <size> is an enumerated value for each of the types.
779 Type = special
780 0x00 No type
781 0x01 Absolute symbol
782 0x02 Segment
783 0x03 Void
784 0x04 Basic 8-byte currency value
785 0x05 Near Basic string
786 0x06 Far Basic string
787 0x07 Untranslated type from previous Microsoft symbol formats
788 Type = signed/unsigned integral and Boolean values
789 0x00 1 byte
790 0x01 2 byte
791 0x02 4 byte
792 0x03 8 byte
793 0x04 Reserved
794 0x05 Reserved
795 0x06 Reserved
796 0x07 Reserved
797 Type = real and complex
798 0x00 32 bit
799 0x01 64 bit
800 0x02 80 bit
801 0x03 128 bit
802 0x04 48 bit
803 0x05 Reserved
804 0x06 Reserved
805 0x07 Reserved
806 Type = special2
807 0x00 Bit
808 0x01 Pascal CHAR
809 Type = Real int
810 0x00 Char
811 0x01 Wide character
812 0x02 2-byte signed integer
813 0x03 2-byte unsigned integer
814 0x04 4-byte signed integer
815 0x05 4-byte unsigned integer
816 0x06 8-byte signed integer
817 0x07 8-byte unsigned integer
818
819 <mode> is the pointer mode:
820 0x00 Direct; not a pointer
821 0x01 Near pointer
822 0x02 Far pointer
823 0x03 Huge pointer
824 0x04 32-bit near pointer
825 0x05 32-bit far pointer
826 0x06 64-bit near pointer
827 0x07 Reserved
828*/
829
830/* basic types */
831#define T_NOTYPE 0x0000 /* Notype */
832#define T_ABS 0x0001 /* Abs */
833#define T_SEGMENT 0x0002 /* segment type */
834#define T_VOID 0x0003 /* Void */
835#define T_CURRENCY 0x0004 /* basic 8-byte currency value */
836#define T_NBASICSTR 0x0005 /* near basic string */
837#define T_FBASICSTR 0x0006 /* far basic string */
838#define T_NOTTRANS 0x0007 /* untranslated type record from MS symbol format */
839#define T_HRESULT 0x0008 /* HRESULT - or error code ??? */
840#define T_CHAR 0x0010 /* signed char */
841#define T_SHORT 0x0011 /* short */
842#define T_LONG 0x0012 /* long */
843#define T_QUAD 0x0013 /* long long */
844#define T_UCHAR 0x0020 /* unsigned char */
845#define T_USHORT 0x0021 /* unsigned short */
846#define T_ULONG 0x0022 /* unsigned long */
847#define T_UQUAD 0x0023 /* unsigned long long */
848#define T_BOOL08 0x0030 /* 8-bit boolean */
849#define T_BOOL16 0x0031 /* 16-bit boolean */
850#define T_BOOL32 0x0032 /* 32-bit boolean */
851#define T_BOOL64 0x0033 /* 64-bit boolean */
852#define T_REAL32 0x0040 /* float */
853#define T_REAL64 0x0041 /* double */
854#define T_REAL80 0x0042 /* 80-bit real */
855#define T_REAL128 0x0043 /* 128-bit real */
856#define T_REAL48 0x0044 /* 48-bit real */
857#define T_CPLX32 0x0050 /* 32-bit complex number */
858#define T_CPLX64 0x0051 /* 64-bit complex number */
859#define T_CPLX80 0x0052 /* 80-bit complex number */
860#define T_CPLX128 0x0053 /* 128-bit complex number */
861#define T_BIT 0x0060 /* bit */
862#define T_PASCHAR 0x0061 /* pascal CHAR */
863#define T_RCHAR 0x0070 /* real char */
864#define T_WCHAR 0x0071 /* wide char */
865#define T_INT2 0x0072 /* real 16-bit signed int */
866#define T_UINT2 0x0073 /* real 16-bit unsigned int */
867#define T_INT4 0x0074 /* int */
868#define T_UINT4 0x0075 /* unsigned int */
869#define T_INT8 0x0076 /* 64-bit signed int */
870#define T_UINT8 0x0077 /* 64-bit unsigned int */
871
872
873/* near pointers to basic types */
874#define T_PVOID 0x0103 /* near pointer to void */
875#define T_PCHAR 0x0110 /* Near pointer to 8-bit signed */
876#define T_PSHORT 0x0111 /* Near pointer to 16-bit signed */
877#define T_PLONG 0x0112 /* Near pointer to 32-bit signed */
878#define T_PQUAD 0x0113 /* Near pointer to 64-bit signed */
879#define T_PUCHAR 0x0120 /* Near pointer to 8-bit unsigned */
880#define T_PUSHORT 0x0121 /* Near pointer to 16-bit unsigned */
881#define T_PULONG 0x0122 /* Near pointer to 32-bit unsigned */
882#define T_PUQUAD 0x0123 /* Near pointer to 64-bit unsigned */
883#define T_PBOOL08 0x0130 /* Near pointer to 8-bit Boolean */
884#define T_PBOOL16 0x0131 /* Near pointer to 16-bit Boolean */
885#define T_PBOOL32 0x0132 /* Near pointer to 32-bit Boolean */
886#define T_PBOOL64 0x0133 /* Near pointer to 64-bit Boolean */
887#define T_PREAL32 0x0140 /* Near pointer to 32-bit real */
888#define T_PREAL64 0x0141 /* Near pointer to 64-bit real */
889#define T_PREAL80 0x0142 /* Near pointer to 80-bit real */
890#define T_PREAL128 0x0143 /* Near pointer to 128-bit real */
891#define T_PREAL48 0x0144 /* Near pointer to 48-bit real */
892#define T_PCPLX32 0x0150 /* Near pointer to 32-bit complex */
893#define T_PCPLX64 0x0151 /* Near pointer to 64-bit complex */
894#define T_PCPLX80 0x0152 /* Near pointer to 80-bit complex */
895#define T_PCPLX128 0x0153 /* Near pointer to 128-bit complex */
896#define T_PRCHAR 0x0170 /* Near pointer to a real char */
897#define T_PWCHAR 0x0171 /* Near pointer to a wide char */
898#define T_PINT2 0x0172 /* Near pointer to 16-bit signed int */
899#define T_PUINT2 0x0173 /* Near pointer to 16-bit unsigned int */
900#define T_PINT4 0x0174 /* Near pointer to 32-bit signed int */
901#define T_PUINT4 0x0175 /* Near pointer to 32-bit unsigned int */
902#define T_PINT8 0x0176 /* Near pointer to 64-bit signed int */
903#define T_PUINT8 0x0177 /* Near pointer to 64-bit unsigned int */
904
905
906/* far pointers to basic types */
907#define T_PFVOID 0x0203 /* Far pointer to void */
908#define T_PFCHAR 0x0210 /* Far pointer to 8-bit signed */
909#define T_PFSHORT 0x0211 /* Far pointer to 16-bit signed */
910#define T_PFLONG 0x0212 /* Far pointer to 32-bit signed */
911#define T_PFQUAD 0x0213 /* Far pointer to 64-bit signed */
912#define T_PFUCHAR 0x0220 /* Far pointer to 8-bit unsigned */
913#define T_PFUSHORT 0x0221 /* Far pointer to 16-bit unsigned */
914#define T_PFULONG 0x0222 /* Far pointer to 32-bit unsigned */
915#define T_PFUQUAD 0x0223 /* Far pointer to 64-bit unsigned */
916#define T_PFBOOL08 0x0230 /* Far pointer to 8-bit Boolean */
917#define T_PFBOOL16 0x0231 /* Far pointer to 16-bit Boolean */
918#define T_PFBOOL32 0x0232 /* Far pointer to 32-bit Boolean */
919#define T_PFBOOL64 0x0233 /* Far pointer to 64-bit Boolean */
920#define T_PFREAL32 0x0240 /* Far pointer to 32-bit real */
921#define T_PFREAL64 0x0241 /* Far pointer to 64-bit real */
922#define T_PFREAL80 0x0242 /* Far pointer to 80-bit real */
923#define T_PFREAL128 0x0243 /* Far pointer to 128-bit real */
924#define T_PFREAL48 0x0244 /* Far pointer to 48-bit real */
925#define T_PFCPLX32 0x0250 /* Far pointer to 32-bit complex */
926#define T_PFCPLX64 0x0251 /* Far pointer to 64-bit complex */
927#define T_PFCPLX80 0x0252 /* Far pointer to 80-bit complex */
928#define T_PFCPLX128 0x0253 /* Far pointer to 128-bit complex */
929#define T_PFRCHAR 0x0270 /* Far pointer to a real char */
930#define T_PFWCHAR 0x0271 /* Far pointer to a wide char */
931#define T_PFINT2 0x0272 /* Far pointer to 16-bit signed int */
932#define T_PFUINT2 0x0273 /* Far pointer to 16-bit unsigned int */
933#define T_PFINT4 0x0274 /* Far pointer to 32-bit signed int */
934#define T_PFUINT4 0x0275 /* Far pointer to 32-bit unsigned int */
935#define T_PFINT8 0x0276 /* Far pointer to 64-bit signed int */
936#define T_PFUINT8 0x0277 /* Far pointer to 64-bit unsigned int */
937
938
939/* huge pointers to basic types */
940#define T_PHVOID 0x0303 /* Huge pointer to void */
941#define T_PHCHAR 0x0310 /* Huge pointer to 8-bit signed */
942#define T_PHSHORT 0x0311 /* Huge pointer to 16-bit signed */
943#define T_PHLONG 0x0312 /* Huge pointer to 32-bit signed */
944#define T_PHQUAD 0x0313 /* Huge pointer to 64-bit signed */
945#define T_PHUCHAR 0x0320 /* Huge pointer to 8-bit unsigned */
946#define T_PHUSHORT 0x0321 /* Huge pointer to 16-bit unsigned */
947#define T_PHULONG 0x0322 /* Huge pointer to 32-bit unsigned */
948#define T_PHUQUAD 0x0323 /* Huge pointer to 64-bit unsigned */
949#define T_PHBOOL08 0x0330 /* Huge pointer to 8-bit Boolean */
950#define T_PHBOOL16 0x0331 /* Huge pointer to 16-bit Boolean */
951#define T_PHBOOL32 0x0332 /* Huge pointer to 32-bit Boolean */
952#define T_PHBOOL64 0x0333 /* Huge pointer to 64-bit Boolean */
953#define T_PHREAL32 0x0340 /* Huge pointer to 32-bit real */
954#define T_PHREAL64 0x0341 /* Huge pointer to 64-bit real */
955#define T_PHREAL80 0x0342 /* Huge pointer to 80-bit real */
956#define T_PHREAL128 0x0343 /* Huge pointer to 128-bit real */
957#define T_PHREAL48 0x0344 /* Huge pointer to 48-bit real */
958#define T_PHCPLX32 0x0350 /* Huge pointer to 32-bit complex */
959#define T_PHCPLX64 0x0351 /* Huge pointer to 64-bit complex */
960#define T_PHCPLX80 0x0352 /* Huge pointer to 80-bit complex */
961#define T_PHCPLX128 0x0353 /* Huge pointer to 128-bit real */
962#define T_PHRCHAR 0x0370 /* Huge pointer to a real char */
963#define T_PHWCHAR 0x0371 /* Huge pointer to a wide char */
964#define T_PHINT2 0x0372 /* Huge pointer to 16-bit signed int */
965#define T_PHUINT2 0x0373 /* Huge pointer to 16-bit unsigned int */
966#define T_PHINT4 0x0374 /* Huge pointer to 32-bit signed int */
967#define T_PHUINT4 0x0375 /* Huge pointer to 32-bit unsigned int */
968#define T_PHINT8 0x0376 /* Huge pointer to 64-bit signed int */
969#define T_PHUINT8 0x0377 /* Huge pointer to 64-bit unsigned int */
970
971
972/* 32-bit near pointers to basic types */
973#define T_32PVOID 0x0403 /* 32-bit near pointer to void */
974#define T_32PHRESULT 0x0408 /* 16:32 near pointer to HRESULT - or error code ??? */
975#define T_32PCHAR 0x0410 /* 16:32 near pointer to 8-bit signed */
976#define T_32PSHORT 0x0411 /* 16:32 near pointer to 16-bit signed */
977#define T_32PLONG 0x0412 /* 16:32 near pointer to 32-bit signed */
978#define T_32PQUAD 0x0413 /* 16:32 near pointer to 64-bit signed */
979#define T_32PUCHAR 0x0420 /* 16:32 near pointer to 8-bit unsigned */
980#define T_32PUSHORT 0x0421 /* 16:32 near pointer to 16-bit unsigned */
981#define T_32PULONG 0x0422 /* 16:32 near pointer to 32-bit unsigned */
982#define T_32PUQUAD 0x0423 /* 16:32 near pointer to 64-bit unsigned */
983#define T_32PBOOL08 0x0430 /* 16:32 near pointer to 8-bit Boolean */
984#define T_32PBOOL16 0x0431 /* 16:32 near pointer to 16-bit Boolean */
985#define T_32PBOOL32 0x0432 /* 16:32 near pointer to 32-bit Boolean */
986#define T_32PBOOL64 0x0433 /* 16:32 near pointer to 64-bit Boolean */
987#define T_32PREAL32 0x0440 /* 16:32 near pointer to 32-bit real */
988#define T_32PREAL64 0x0441 /* 16:32 near pointer to 64-bit real */
989#define T_32PREAL80 0x0442 /* 16:32 near pointer to 80-bit real */
990#define T_32PREAL128 0x0443 /* 16:32 near pointer to 128-bit real */
991#define T_32PREAL48 0x0444 /* 16:32 near pointer to 48-bit real */
992#define T_32PCPLX32 0x0450 /* 16:32 near pointer to 32-bit complex */
993#define T_32PCPLX64 0x0451 /* 16:32 near pointer to 64-bit complex */
994#define T_32PCPLX80 0x0452 /* 16:32 near pointer to 80-bit complex */
995#define T_32PCPLX128 0x0453 /* 16:32 near pointer to 128-bit complex */
996#define T_32PRCHAR 0x0470 /* 16:32 near pointer to a real char */
997#define T_32PWCHAR 0x0471 /* 16:32 near pointer to a wide char */
998#define T_32PINT2 0x0472 /* 16:32 near pointer to 16-bit signed int */
999#define T_32PUINT2 0x0473 /* 16:32 near pointer to 16-bit unsigned int */
1000#define T_32PINT4 0x0474 /* 16:32 near pointer to 32-bit signed int */
1001#define T_32PUINT4 0x0475 /* 16:32 near pointer to 32-bit unsigned int */
1002#define T_32PINT8 0x0476 /* 16:32 near pointer to 64-bit signed int */
1003#define T_32PUINT8 0x0477 /* 16:32 near pointer to 64-bit unsigned int */
1004
1005
1006/* 32-bit far pointers to basic types */
1007#define T_32PFVOID 0x0503 /* 32-bit far pointer to void */
1008#define T_32PFCHAR 0x0510 /* 16:32 far pointer to 8-bit signed */
1009#define T_32PFSHORT 0x0511 /* 16:32 far pointer to 16-bit signed */
1010#define T_32PFLONG 0x0512 /* 16:32 far pointer to 32-bit signed */
1011#define T_32PFQUAD 0x0513 /* 16:32 far pointer to 64-bit signed */
1012#define T_32PFUCHAR 0x0520 /* 16:32 far pointer to 8-bit unsigned */
1013#define T_32PFUSHORT 0x0521 /* 16:32 far pointer to 16-bit unsigned */
1014#define T_32PFULONG 0x0522 /* 16:32 far pointer to 32-bit unsigned */
1015#define T_32PFUQUAD 0x0523 /* 16:32 far pointer to 64-bit unsigned */
1016#define T_32PFBOOL08 0x0530 /* 16:32 far pointer to 8-bit Boolean */
1017#define T_32PFBOOL16 0x0531 /* 16:32 far pointer to 16-bit Boolean */
1018#define T_32PFBOOL32 0x0532 /* 16:32 far pointer to 32-bit Boolean */
1019#define T_32PFBOOL64 0x0533 /* 16:32 far pointer to 64-bit Boolean */
1020#define T_32PFREAL32 0x0540 /* 16:32 far pointer to 32-bit real */
1021#define T_32PFREAL64 0x0541 /* 16:32 far pointer to 64-bit real */
1022#define T_32PFREAL80 0x0542 /* 16:32 far pointer to 80-bit real */
1023#define T_32PFREAL128 0x0543 /* 16:32 far pointer to 128-bit real */
1024#define T_32PFREAL48 0x0544 /* 16:32 far pointer to 48-bit real */
1025#define T_32PFCPLX32 0x0550 /* 16:32 far pointer to 32-bit complex */
1026#define T_32PFCPLX64 0x0551 /* 16:32 far pointer to 64-bit complex */
1027#define T_32PFCPLX80 0x0552 /* 16:32 far pointer to 80-bit complex */
1028#define T_32PFCPLX128 0x0553 /* 16:32 far pointer to 128-bit complex */
1029#define T_32PFRCHAR 0x0570 /* 16:32 far pointer to a real char */
1030#define T_32PFWCHAR 0x0571 /* 16:32 far pointer to a wide char */
1031#define T_32PFINT2 0x0572 /* 16:32 far pointer to 16-bit signed int */
1032#define T_32PFUINT2 0x0573 /* 16:32 far pointer to 16-bit unsigned int */
1033#define T_32PFINT4 0x0574 /* 16:32 far pointer to 32-bit signed int */
1034#define T_32PFUINT4 0x0575 /* 16:32 far pointer to 32-bit unsigned int */
1035#define T_32PFINT8 0x0576 /* 16:32 far pointer to 64-bit signed int */
1036#define T_32PFUINT8 0x0577 /* 16:32 far pointer to 64-bit unsigned int */
1037
1038
1039/* counts, bit masks, and shift values needed to access various parts of the built-in type numbers */
1040#define T_MAXPREDEFINEDTYPE 0x0580 /* maximum type index for all built-in types */
1041#define T_MAXBASICTYPE 0x0080 /* maximum type index all non-pointer built-in types */
1042#define T_BASICTYPE_MASK 0x00ff /* mask of bits that can potentially identify a non-pointer basic type */
1043#define T_BASICTYPE_SHIFT 8 /* shift count to push out the basic type bits from a type number */
1044#define T_MODE_MASK 0x0700 /* type mode mask (ptr/non-ptr) */
1045#define T_SIZE_MASK 0x0007 /* type size mask (depends on 'type' value) */
1046#define T_TYPE_MASK 0x00f0 /* type type mask (data treatment mode) */
1047
1048/* bit patterns for the <mode> portion of a built-in type number */
1049#define T_NEARPTR_BITS 0x0100
1050#define T_FARPTR_BITS 0x0200
1051#define T_HUGEPTR_BITS 0x0300
1052#define T_NEAR32PTR_BITS 0x0400
1053#define T_FAR32PTR_BITS 0x0500
1054#define T_NEAR64PTR_BITS 0x0600
1055
1056#define LF_MODIFIER_V1 0x0001
1057#define LF_POINTER_V1 0x0002
1058#define LF_ARRAY_V1 0x0003
1059#define LF_CLASS_V1 0x0004
1060#define LF_STRUCTURE_V1 0x0005
1061#define LF_UNION_V1 0x0006
1062#define LF_ENUM_V1 0x0007
1063#define LF_PROCEDURE_V1 0x0008
1064#define LF_MFUNCTION_V1 0x0009
1065#define LF_VTSHAPE_V1 0x000a
1066#define LF_COBOL0_V1 0x000b
1067#define LF_COBOL1_V1 0x000c
1068#define LF_BARRAY_V1 0x000d
1069#define LF_LABEL_V1 0x000e
1070#define LF_NULL_V1 0x000f
1071#define LF_NOTTRAN_V1 0x0010
1072#define LF_DIMARRAY_V1 0x0011
1073#define LF_VFTPATH_V1 0x0012
1074#define LF_PRECOMP_V1 0x0013
1075#define LF_ENDPRECOMP_V1 0x0014
1076#define LF_OEM_V1 0x0015
1077#define LF_TYPESERVER_V1 0x0016
1078
1079#define LF_MODIFIER_V2 0x1001 /* variants with new 32-bit type indices (V2) */
1080#define LF_POINTER_V2 0x1002
1081#define LF_ARRAY_V2 0x1003
1082#define LF_CLASS_V2 0x1004
1083#define LF_STRUCTURE_V2 0x1005
1084#define LF_UNION_V2 0x1006
1085#define LF_ENUM_V2 0x1007
1086#define LF_PROCEDURE_V2 0x1008
1087#define LF_MFUNCTION_V2 0x1009
1088#define LF_COBOL0_V2 0x100a
1089#define LF_BARRAY_V2 0x100b
1090#define LF_DIMARRAY_V2 0x100c
1091#define LF_VFTPATH_V2 0x100d
1092#define LF_PRECOMP_V2 0x100e
1093#define LF_OEM_V2 0x100f
1094
1095#define LF_SKIP_V1 0x0200
1096#define LF_ARGLIST_V1 0x0201
1097#define LF_DEFARG_V1 0x0202
1098#define LF_LIST_V1 0x0203
1099#define LF_FIELDLIST_V1 0x0204
1100#define LF_DERIVED_V1 0x0205
1101#define LF_BITFIELD_V1 0x0206
1102#define LF_METHODLIST_V1 0x0207
1103#define LF_DIMCONU_V1 0x0208
1104#define LF_DIMCONLU_V1 0x0209
1105#define LF_DIMVARU_V1 0x020a
1106#define LF_DIMVARLU_V1 0x020b
1107#define LF_REFSYM_V1 0x020c
1108
1109#define LF_SKIP_V2 0x1200 /* variants with new 32-bit type indices (V2) */
1110#define LF_ARGLIST_V2 0x1201
1111#define LF_DEFARG_V2 0x1202
1112#define LF_FIELDLIST_V2 0x1203
1113#define LF_DERIVED_V2 0x1204
1114#define LF_BITFIELD_V2 0x1205
1115#define LF_METHODLIST_V2 0x1206
1116#define LF_DIMCONU_V2 0x1207
1117#define LF_DIMCONLU_V2 0x1208
1118#define LF_DIMVARU_V2 0x1209
1119#define LF_DIMVARLU_V2 0x120a
1120
1121/* Field lists */
1122#define LF_BCLASS_V1 0x0400
1123#define LF_VBCLASS_V1 0x0401
1124#define LF_IVBCLASS_V1 0x0402
1125#define LF_ENUMERATE_V1 0x0403
1126#define LF_FRIENDFCN_V1 0x0404
1127#define LF_INDEX_V1 0x0405
1128#define LF_MEMBER_V1 0x0406
1129#define LF_STMEMBER_V1 0x0407
1130#define LF_METHOD_V1 0x0408
1131#define LF_NESTTYPE_V1 0x0409
1132#define LF_VFUNCTAB_V1 0x040a
1133#define LF_FRIENDCLS_V1 0x040b
1134#define LF_ONEMETHOD_V1 0x040c
1135#define LF_VFUNCOFF_V1 0x040d
1136#define LF_NESTTYPEEX_V1 0x040e
1137#define LF_MEMBERMODIFY_V1 0x040f
1138
1139#define LF_BCLASS_V2 0x1400 /* variants with new 32-bit type indices (V2) */
1140#define LF_VBCLASS_V2 0x1401
1141#define LF_IVBCLASS_V2 0x1402
1142#define LF_FRIENDFCN_V2 0x1403
1143#define LF_INDEX_V2 0x1404
1144#define LF_MEMBER_V2 0x1405
1145#define LF_STMEMBER_V2 0x1406
1146#define LF_METHOD_V2 0x1407
1147#define LF_NESTTYPE_V2 0x1408
1148#define LF_VFUNCTAB_V2 0x1409
1149#define LF_FRIENDCLS_V2 0x140a
1150#define LF_ONEMETHOD_V2 0x140b
1151#define LF_VFUNCOFF_V2 0x140c
1152#define LF_NESTTYPEEX_V2 0x140d
1153
1154#define LF_ENUMERATE_V3 0x1502
1155#define LF_ARRAY_V3 0x1503
1156#define LF_CLASS_V3 0x1504
1157#define LF_STRUCTURE_V3 0x1505
1158#define LF_UNION_V3 0x1506
1159#define LF_ENUM_V3 0x1507
1160#define LF_MEMBER_V3 0x150d
1161#define LF_STMEMBER_V3 0x150e
1162#define LF_METHOD_V3 0x150f
1163#define LF_NESTTYPE_V3 0x1510
1164#define LF_ONEMETHOD_V3 0x1511
1165
1166#define LF_NUMERIC 0x8000 /* numeric leaf types */
1167#define LF_CHAR 0x8000
1168#define LF_SHORT 0x8001
1169#define LF_USHORT 0x8002
1170#define LF_LONG 0x8003
1171#define LF_ULONG 0x8004
1172#define LF_REAL32 0x8005
1173#define LF_REAL64 0x8006
1174#define LF_REAL80 0x8007
1175#define LF_REAL128 0x8008
1176#define LF_QUADWORD 0x8009
1177#define LF_UQUADWORD 0x800a
1178#define LF_REAL48 0x800b
1179#define LF_COMPLEX32 0x800c
1180#define LF_COMPLEX64 0x800d
1181#define LF_COMPLEX80 0x800e
1182#define LF_COMPLEX128 0x800f
1183#define LF_VARSTRING 0x8010
1184
1185/* ======================================== *
1186 * Symbol information
1187 * ======================================== */
1188
1189union codeview_symbol
1190{
1191 struct
1192 {
1193 short int len;
1194 short int id;
1195 } generic;
1196
1197 struct
1198 {
1199 short int len;
1200 short int id;
1201 unsigned int offset;
1202 unsigned short segment;
1203 unsigned short symtype;
1204 struct p_string p_name;
1205 } data_v1;
1206
1207 struct
1208 {
1209 short int len;
1210 short int id;
1211 unsigned int symtype;
1212 unsigned int offset;
1213 unsigned short segment;
1214 struct p_string p_name;
1215 } data_v2;
1216
1217 struct
1218 {
1219 short int len;
1220 short int id;
1221 unsigned int symtype;
1222 unsigned int offset;
1223 unsigned short segment;
1224 char name[1];
1225 } data_v3;
1226
1227 struct
1228 {
1229 short int len;
1230 short int id;
1231 unsigned int pparent;
1232 unsigned int pend;
1233 unsigned int next;
1234 unsigned int offset;
1235 unsigned short segment;
1236 unsigned short thunk_len;
1237 unsigned char thtype;
1238 struct p_string p_name;
1239 } thunk_v1;
1240
1241 struct
1242 {
1243 short int len;
1244 short int id;
1245 unsigned int pparent;
1246 unsigned int pend;
1247 unsigned int next;
1248 unsigned int offset;
1249 unsigned short segment;
1250 unsigned short thunk_len;
1251 unsigned char thtype;
1252 char name[1];
1253 } thunk_v3;
1254
1255 struct
1256 {
1257 short int len;
1258 short int id;
1259 unsigned int pparent;
1260 unsigned int pend;
1261 unsigned int next;
1262 unsigned int proc_len;
1263 unsigned int debug_start;
1264 unsigned int debug_end;
1265 unsigned int offset;
1266 unsigned short segment;
1267 unsigned short proctype;
1268 unsigned char flags;
1269 struct p_string p_name;
1270 } proc_v1;
1271
1272 struct
1273 {
1274 short int len;
1275 short int id;
1276 unsigned int pparent;
1277 unsigned int pend;
1278 unsigned int next;
1279 unsigned int proc_len;
1280 unsigned int debug_start;
1281 unsigned int debug_end;
1282 unsigned int proctype;
1283 unsigned int offset;
1284 unsigned short segment;
1285 unsigned char flags;
1286 struct p_string p_name;
1287 } proc_v2;
1288
1289 struct
1290 {
1291 short int len;
1292 short int id;
1293 unsigned int pparent;
1294 unsigned int pend;
1295 unsigned int next;
1296 unsigned int proc_len;
1297 unsigned int debug_start;
1298 unsigned int debug_end;
1299 unsigned int proctype;
1300 unsigned int offset;
1301 unsigned short segment;
1302 unsigned char flags;
1303 char name[1];
1304 } proc_v3;
1305
1306 struct
1307 {
1308 short int len;
1309 short int id;
1310 unsigned int symtype;
1311 unsigned int offset;
1312 unsigned short segment;
1313 struct p_string p_name;
1314 } public_v2;
1315
1316 struct
1317 {
1318 short int len;
1319 short int id;
1320 unsigned int symtype;
1321 unsigned int offset;
1322 unsigned short segment;
1323 char name[1];
1324 } public_v3;
1325
1326 struct
1327 {
1328 short int len; /* Total length of this entry */
1329 short int id; /* Always S_BPREL_V1 */
1330 unsigned int offset; /* Stack offset relative to BP */
1331 unsigned short symtype;
1332 struct p_string p_name;
1333 } stack_v1;
1334
1335 struct
1336 {
1337 short int len; /* Total length of this entry */
1338 short int id; /* Always S_BPREL_V2 */
1339 unsigned int offset; /* Stack offset relative to EBP */
1340 unsigned int symtype;
1341 struct p_string p_name;
1342 } stack_v2;
1343
1344 struct
1345 {
1346 short int len; /* Total length of this entry */
1347 short int id; /* Always S_BPREL_V3 */
1348 int offset; /* Stack offset relative to BP */
1349 unsigned int symtype;
1350 char name[1];
1351 } stack_v3;
1352
1353 struct
1354 {
1355 short int len; /* Total length of this entry */
1356 short int id; /* Always S_BPREL_V3 */
1357 int offset; /* Stack offset relative to BP */
1358 unsigned int symtype;
1359 unsigned short unknown;
1360 char name[1];
1361 } stack_xxxx_v3;
1362
1363 struct
1364 {
1365 short int len; /* Total length of this entry */
1366 short int id; /* Always S_REGISTER */
1367 unsigned short type;
1368 unsigned short reg;
1369 struct p_string p_name;
1370 /* don't handle register tracking */
1371 } register_v1;
1372
1373 struct
1374 {
1375 short int len; /* Total length of this entry */
1376 short int id; /* Always S_REGISTER_V2 */
1377 unsigned int type; /* check whether type & reg are correct */
1378 unsigned short reg;
1379 struct p_string p_name;
1380 /* don't handle register tracking */
1381 } register_v2;
1382
1383 struct
1384 {
1385 short int len; /* Total length of this entry */
1386 short int id; /* Always S_REGISTER_V3 */
1387 unsigned int type; /* check whether type & reg are correct */
1388 unsigned short reg;
1389 char name[1];
1390 /* don't handle register tracking */
1391 } register_v3;
1392
1393 struct
1394 {
1395 short int len;
1396 short int id;
1397 unsigned int parent;
1398 unsigned int end;
1399 unsigned int length;
1400 unsigned int offset;
1401 unsigned short segment;
1402 struct p_string p_name;
1403 } block_v1;
1404
1405 struct
1406 {
1407 short int len;
1408 short int id;
1409 unsigned int parent;
1410 unsigned int end;
1411 unsigned int length;
1412 unsigned int offset;
1413 unsigned short segment;
1414 char name[1];
1415 } block_v3;
1416
1417 struct
1418 {
1419 short int len;
1420 short int id;
1421 unsigned int offset;
1422 unsigned short segment;
1423 unsigned char flags;
1424 struct p_string p_name;
1425 } label_v1;
1426
1427 struct
1428 {
1429 short int len;
1430 short int id;
1431 unsigned int offset;
1432 unsigned short segment;
1433 unsigned char flags;
1434 char name[1];
1435 } label_v3;
1436
1437 struct
1438 {
1439 short int len;
1440 short int id;
1441 unsigned short type;
1442 unsigned short cvalue; /* numeric leaf */
1443#if 0
1444 struct p_string p_name;
1445#endif
1446 } constant_v1;
1447
1448 struct
1449 {
1450 short int len;
1451 short int id;
1452 unsigned type;
1453 unsigned short cvalue; /* numeric leaf */
1454#if 0
1455 struct p_string p_name;
1456#endif
1457 } constant_v2;
1458
1459 struct
1460 {
1461 short int len;
1462 short int id;
1463 unsigned type;
1464 unsigned short cvalue;
1465#if 0
1466 char name[1];
1467#endif
1468 } constant_v3;
1469
1470 struct
1471 {
1472 short int len;
1473 short int id;
1474 unsigned short type;
1475 struct p_string p_name;
1476 } udt_v1;
1477
1478 struct
1479 {
1480 short int len;
1481 short int id;
1482 unsigned type;
1483 struct p_string p_name;
1484 } udt_v2;
1485
1486 struct
1487 {
1488 short int len;
1489 short int id;
1490 unsigned int type;
1491 char name[1];
1492 } udt_v3;
1493
1494 struct
1495 {
1496 short int len;
1497 short int id;
1498 char signature[4];
1499 struct p_string p_name;
1500 } objname_v1;
1501
1502 struct
1503 {
1504 short int len;
1505 short int id;
1506 unsigned int unknown;
1507 struct p_string p_name;
1508 } compiland_v1;
1509
1510 struct
1511 {
1512 short int len;
1513 short int id;
1514 unsigned unknown1[4];
1515 unsigned short unknown2;
1516 struct p_string p_name;
1517 } compiland_v2;
1518
1519 struct
1520 {
1521 short int len;
1522 short int id;
1523 unsigned int unknown;
1524 char name[1];
1525 } compiland_v3;
1526
1527 struct
1528 {
1529 short int len;
1530 short int id;
1531 unsigned int offset;
1532 unsigned short segment;
1533 } ssearch_v1;
1534
1535 struct
1536 {
1537 short int len;
1538 short int id;
1539 unsigned int offset;
1540 unsigned int unknown;
1541 } security_cookie_v3;
1542
1543 struct
1544 {
1545 short int len;
1546 short int id;
1547 unsigned int unknown1; /* maybe size (of what ?) */
1548 unsigned int unknown2;
1549 unsigned int unknown3;
1550 unsigned int unknown4; /* maybe size (of what ?) */
1551 unsigned int unknown5; /* maybe address <offset and segment> (of what ?) */
1552 unsigned short unknown6;
1553 unsigned short flags;
1554 unsigned int unknown7;
1555 } func_info_v2;
1556};
1557
1558#define S_COMPILAND_V1 0x0001
1559#define S_REGISTER_V1 0x0002
1560#define S_CONSTANT_V1 0x0003
1561#define S_UDT_V1 0x0004
1562#define S_SSEARCH_V1 0x0005
1563#define S_END_V1 0x0006
1564#define S_SKIP_V1 0x0007
1565#define S_CVRESERVE_V1 0x0008
1566#define S_OBJNAME_V1 0x0009
1567#define S_ENDARG_V1 0x000a
1568#define S_COBOLUDT_V1 0x000b
1569#define S_MANYREG_V1 0x000c
1570#define S_RETURN_V1 0x000d
1571#define S_ENTRYTHIS_V1 0x000e
1572
1573#define S_BPREL_V1 0x0200
1574#define S_LDATA_V1 0x0201
1575#define S_GDATA_V1 0x0202
1576#define S_PUB_V1 0x0203
1577#define S_LPROC_V1 0x0204
1578#define S_GPROC_V1 0x0205
1579#define S_THUNK_V1 0x0206
1580#define S_BLOCK_V1 0x0207
1581#define S_WITH_V1 0x0208
1582#define S_LABEL_V1 0x0209
1583#define S_CEXMODEL_V1 0x020a
1584#define S_VFTPATH_V1 0x020b
1585#define S_REGREL_V1 0x020c
1586#define S_LTHREAD_V1 0x020d
1587#define S_GTHREAD_V1 0x020e
1588
1589#define S_PROCREF_V1 0x0400
1590#define S_DATAREF_V1 0x0401
1591#define S_ALIGN_V1 0x0402
1592#define S_LPROCREF_V1 0x0403
1593
1594#define S_REGISTER_V2 0x1001 /* Variants with new 32-bit type indices */
1595#define S_CONSTANT_V2 0x1002
1596#define S_UDT_V2 0x1003
1597#define S_COBOLUDT_V2 0x1004
1598#define S_MANYREG_V2 0x1005
1599#define S_BPREL_V2 0x1006
1600#define S_LDATA_V2 0x1007
1601#define S_GDATA_V2 0x1008
1602#define S_PUB_V2 0x1009
1603#define S_LPROC_V2 0x100a
1604#define S_GPROC_V2 0x100b
1605#define S_VFTTABLE_V2 0x100c
1606#define S_REGREL_V2 0x100d
1607#define S_LTHREAD_V2 0x100e
1608#define S_GTHREAD_V2 0x100f
1609#define S_FUNCINFO_V2 0x1012
1610#define S_COMPILAND_V2 0x1013
1611
1612#define S_COMPILAND_V3 0x1101
1613#define S_THUNK_V3 0x1102
1614#define S_BLOCK_V3 0x1103
1615#define S_LABEL_V3 0x1105
1616#define S_REGISTER_V3 0x1106
1617#define S_CONSTANT_V3 0x1107
1618#define S_UDT_V3 0x1108
1619#define S_BPREL_V3 0x110B
1620#define S_LDATA_V3 0x110C
1621#define S_GDATA_V3 0x110D
1622#define S_PUB_V3 0x110E
1623#define S_LPROC_V3 0x110F
1624#define S_GPROC_V3 0x1110
1625#define S_BPREL_XXXX_V3 0x1111 /* not really understood, but looks like bprel... */
1626#define S_MSTOOL_V3 0x1116 /* compiler command line options and build information */
1627#define S_PUB_FUNC1_V3 0x1125 /* didn't get the difference between the two */
1628#define S_PUB_FUNC2_V3 0x1127
1629#define S_SECTINFO_V3 0x1136
1630#define S_SUBSECTINFO_V3 0x1137
1631#define S_ENTRYPOINT_V3 0x1138
1632#define S_SECUCOOKIE_V3 0x113A
1633#define S_MSTOOLINFO_V3 0x113C
1634#define S_MSTOOLENV_V3 0x113D
1635
1636/* ======================================== *
1637 * Line number information
1638 * ======================================== */
1639
1640struct codeview_linetab_block
1641{
1642 unsigned short seg;
1643 unsigned short num_lines;
1644 unsigned int offsets[1]; /* in fact num_lines */
1645/* unsigned short linenos[]; */
1646};
1647
1648struct startend
1649{
1650 unsigned int start;
1651 unsigned int end;
1652};
1653
1654#define LT2_LINES_BLOCK 0x000000f2
1655#define LT2_FILES_BLOCK 0x000000f4
1656
1657/* there's a new line tab structure from MS Studio 2005 and after
1658 * it's made of a list of codeview_linetab2 blocks.
1659 * We've only seen (so far) list with a single LT2_FILES_BLOCK and several
1660 * LT2_LINES_BLOCK. The LT2_FILES block has been encountered either as first
1661 * or last block of the list.
1662 * A LT2_FILES contains one or several codeview_linetab2_file:s
1663 */
1664
1665struct codeview_linetab2
1666{
1667 DWORD header;
1668 DWORD size_of_block;
1669};
1670
1671static inline const struct codeview_linetab2* codeview_linetab2_next_block(const struct codeview_linetab2* lt2)
1672{
1673 return (const struct codeview_linetab2*)((const char*)(lt2 + 1) + lt2->size_of_block);
1674}
1675
1676struct codeview_linetab2_file
1677{
1678 DWORD offset; /* offset in string table for filename */
1679 WORD unk; /* always 0x0110... type of following information ??? */
1680 BYTE md5[16]; /* MD5 signature of file (signature on file's content or name ???) */
1681 WORD pad0; /* always 0 */
1682};
1683
1684struct codeview_lt2blk_files
1685{
1686 struct codeview_linetab2 lt2; /* LT2_FILES */
1687 struct codeview_linetab2_file file[1];
1688};
1689
1690struct codeview_lt2blk_lines
1691{
1692 struct codeview_linetab2 lt2; /* LT2_LINE_BLOCK */
1693 DWORD start; /* start address of function with line numbers */
1694 DWORD seg; /* segment of function with line numbers */
1695 DWORD size; /* size of function with line numbers */
1696 DWORD file_offset; /* offset for accessing corresponding codeview_linetab2_file */
1697 DWORD nlines; /* number of lines in this block */
1698 DWORD size_lines; /* number of bytes following for line number information */
1699 struct {
1700 DWORD offset; /* offset (from <seg>:<start>) for line number */
1701 DWORD lineno; /* the line number (OR:ed with 0x80000000 why ???) */
1702 } l[1]; /* actually array of <nlines> */
1703};
1704
1705/* ======================================== *
1706 * PDB file information
1707 * ======================================== */
1708
1709
1710struct PDB_FILE
1711{
1712 DWORD size;
1713 DWORD unknown;
1714};
1715
1716struct PDB_JG_HEADER
1717{
1718 CHAR ident[40];
1719 DWORD signature;
1720 DWORD block_size;
1721 WORD free_list;
1722 WORD total_alloc;
1723 struct PDB_FILE toc;
1724 WORD toc_block[1];
1725};
1726
1727struct PDB_DS_HEADER
1728{
1729 char signature[32];
1730 DWORD block_size;
1731 DWORD unknown1;
1732 DWORD num_pages;
1733 DWORD toc_size;
1734 DWORD unknown2;
1735 DWORD toc_page;
1736};
1737
1738struct PDB_JG_TOC
1739{
1740 DWORD num_files;
1741 struct PDB_FILE file[1];
1742};
1743
1744struct PDB_DS_TOC
1745{
1746 DWORD num_files;
1747 DWORD file_size[1];
1748};
1749
1750struct PDB_JG_ROOT
1751{
1752 DWORD Version;
1753 DWORD TimeDateStamp;
1754 DWORD Age;
1755 DWORD cbNames;
1756 CHAR names[1];
1757};
1758
1759struct PDB_DS_ROOT
1760{
1761 DWORD Version;
1762 DWORD TimeDateStamp;
1763 DWORD Age;
1764 GUID guid;
1765 DWORD cbNames;
1766 CHAR names[1];
1767};
1768
1769typedef struct _PDB_TYPES_OLD
1770{
1771 DWORD version;
1772 WORD first_index;
1773 WORD last_index;
1774 DWORD type_size;
1775 WORD file;
1776 WORD pad;
1777} PDB_TYPES_OLD, *PPDB_TYPES_OLD;
1778
1779typedef struct _PDB_TYPES
1780{
1781 DWORD version;
1782 DWORD type_offset;
1783 DWORD first_index;
1784 DWORD last_index;
1785 DWORD type_size;
1786 WORD file;
1787 WORD pad;
1788 DWORD hash_size;
1789 DWORD hash_base;
1790 DWORD hash_offset;
1791 DWORD hash_len;
1792 DWORD search_offset;
1793 DWORD search_len;
1794 DWORD unknown_offset;
1795 DWORD unknown_len;
1796} PDB_TYPES, *PPDB_TYPES;
1797
1798typedef struct _PDB_SYMBOL_RANGE
1799{
1800 WORD segment;
1801 WORD pad1;
1802 DWORD offset;
1803 DWORD size;
1804 DWORD characteristics;
1805 WORD index;
1806 WORD pad2;
1807} PDB_SYMBOL_RANGE, *PPDB_SYMBOL_RANGE;
1808
1809typedef struct _PDB_SYMBOL_RANGE_EX
1810{
1811 WORD segment;
1812 WORD pad1;
1813 DWORD offset;
1814 DWORD size;
1815 DWORD characteristics;
1816 WORD index;
1817 WORD pad2;
1818 DWORD timestamp;
1819 DWORD unknown;
1820} PDB_SYMBOL_RANGE_EX, *PPDB_SYMBOL_RANGE_EX;
1821
1822typedef struct _PDB_SYMBOL_FILE
1823{
1824 DWORD unknown1;
1825 PDB_SYMBOL_RANGE range;
1826 WORD flag;
1827 WORD file;
1828 DWORD symbol_size;
1829 DWORD lineno_size;
1830 DWORD unknown2;
1831 DWORD nSrcFiles;
1832 DWORD attribute;
1833 CHAR filename[1];
1834} PDB_SYMBOL_FILE, *PPDB_SYMBOL_FILE;
1835
1836typedef struct _PDB_SYMBOL_FILE_EX
1837{
1838 DWORD unknown1;
1839 PDB_SYMBOL_RANGE_EX range;
1840 WORD flag;
1841 WORD file;
1842 DWORD symbol_size;
1843 DWORD lineno_size;
1844 DWORD unknown2;
1845 DWORD nSrcFiles;
1846 DWORD attribute;
1847 DWORD reserved[2];
1848 CHAR filename[1];
1849} PDB_SYMBOL_FILE_EX, *PPDB_SYMBOL_FILE_EX;
1850
1851typedef struct _PDB_SYMBOL_SOURCE
1852{
1853 WORD nModules;
1854 WORD nSrcFiles;
1855 WORD table[1];
1856} PDB_SYMBOL_SOURCE, *PPDB_SYMBOL_SOURCE;
1857
1858typedef struct _PDB_SYMBOL_IMPORT
1859{
1860 DWORD unknown1;
1861 DWORD unknown2;
1862 DWORD TimeDateStamp;
1863 DWORD Age;
1864 CHAR filename[1];
1865} PDB_SYMBOL_IMPORT, *PPDB_SYMBOL_IMPORT;
1866
1867typedef struct _PDB_SYMBOLS_OLD
1868{
1869 WORD hash1_file;
1870 WORD hash2_file;
1871 WORD gsym_file;
1872 WORD pad;
1873 DWORD module_size;
1874 DWORD offset_size;
1875 DWORD hash_size;
1876 DWORD srcmodule_size;
1877} PDB_SYMBOLS_OLD, *PPDB_SYMBOLS_OLD;
1878
1879typedef struct _PDB_SYMBOLS
1880{
1881 DWORD signature;
1882 DWORD version;
1883 DWORD unknown;
1884 DWORD hash1_file;
1885 DWORD hash2_file;
1886 WORD gsym_file;
1887 WORD unknown1;
1888 DWORD module_size;
1889 DWORD offset_size;
1890 DWORD hash_size;
1891 DWORD srcmodule_size;
1892 DWORD pdbimport_size;
1893 DWORD resvd[5];
1894} PDB_SYMBOLS, *PPDB_SYMBOLS;
1895
1896#include "poppack.h"
1897
1898/* ----------------------------------------------
1899 * Information used for parsing
1900 * ---------------------------------------------- */
1901
1902typedef struct
1903{
1904 DWORD from;
1905 DWORD to;
1906} OMAP_DATA;
1907
1908struct msc_debug_info
1909{
1910 struct module* module;
1911 int nsect;
1912 const IMAGE_SECTION_HEADER* sectp;
1913 int nomap;
1914 const OMAP_DATA* omapp;
1915 const BYTE* root;
1916};
1917
1918/* coff.c */
1919extern BOOL coff_process_info(const struct msc_debug_info* msc_dbg);
1920
1921/* ===================================================
1922 * The old CodeView stuff (for NB09 and NB11)
1923 * =================================================== */
1924
1925#define sstModule 0x120
1926#define sstTypes 0x121
1927#define sstPublic 0x122
1928#define sstPublicSym 0x123
1929#define sstSymbols 0x124
1930#define sstAlignSym 0x125
1931#define sstSrcLnSeg 0x126
1932#define sstSrcModule 0x127
1933#define sstLibraries 0x128
1934#define sstGlobalSym 0x129
1935#define sstGlobalPub 0x12a
1936#define sstGlobalTypes 0x12b
1937#define sstMPC 0x12c
1938#define sstSegMap 0x12d
1939#define sstSegName 0x12e
1940#define sstPreComp 0x12f
1941#define sstFileIndex 0x133
1942#define sstStaticSym 0x134
1943
1944/* overall structure information */
1945typedef struct OMFSignature
1946{
1947 char Signature[4];
1948 long filepos;
1949} OMFSignature;
1950
1951typedef struct OMFSignatureRSDS
1952{
1953 char Signature[4];
1954 GUID guid;
1955 DWORD age;
1956 CHAR name[1];
1957} OMFSignatureRSDS;
1958
1959typedef struct _CODEVIEW_PDB_DATA
1960{
1961 char Signature[4];
1962 long filepos;
1963 DWORD timestamp;
1964 DWORD age;
1965 CHAR name[1];
1966} CODEVIEW_PDB_DATA, *PCODEVIEW_PDB_DATA;
1967
1968typedef struct OMFDirHeader
1969{
1970 WORD cbDirHeader;
1971 WORD cbDirEntry;
1972 DWORD cDir;
1973 DWORD lfoNextDir;
1974 DWORD flags;
1975} OMFDirHeader;
1976
1977typedef struct OMFDirEntry
1978{
1979 WORD SubSection;
1980 WORD iMod;
1981 DWORD lfo;
1982 DWORD cb;
1983} OMFDirEntry;
1984
1985/* sstModule subsection */
1986
1987typedef struct OMFSegDesc
1988{
1989 WORD Seg;
1990 WORD pad;
1991 DWORD Off;
1992 DWORD cbSeg;
1993} OMFSegDesc;
1994
1995typedef struct OMFModule
1996{
1997 WORD ovlNumber;
1998 WORD iLib;
1999 WORD cSeg;
2000 char Style[2];
2001/*
2002 OMFSegDesc SegInfo[cSeg];
2003 p_string Name;
2004*/
2005} OMFModule;
2006
2007typedef struct OMFGlobalTypes
2008{
2009 DWORD flags;
2010 DWORD cTypes;
2011/*
2012 DWORD offset[cTypes];
2013 types_record[];
2014*/
2015} OMFGlobalTypes;
2016
2017/* sstGlobalPub section */
2018
2019/* Header for symbol table */
2020typedef struct OMFSymHash
2021{
2022 unsigned short symhash;
2023 unsigned short addrhash;
2024 unsigned long cbSymbol;
2025 unsigned long cbHSym;
2026 unsigned long cbHAddr;
2027} OMFSymHash;
2028
2029/* sstSegMap section */
2030
2031typedef struct OMFSegMapDesc
2032{
2033 unsigned short flags;
2034 unsigned short ovl;
2035 unsigned short group;
2036 unsigned short frame;
2037 unsigned short iSegName;
2038 unsigned short iClassName;
2039 unsigned long offset;
2040 unsigned long cbSeg;
2041} OMFSegMapDesc;
2042
2043typedef struct OMFSegMap
2044{
2045 unsigned short cSeg;
2046 unsigned short cSegLog;
2047/* OMFSegMapDesc rgDesc[0];*/
2048} OMFSegMap;
2049
2050
2051/* sstSrcModule section */
2052
2053typedef struct OMFSourceLine
2054{
2055 unsigned short Seg;
2056 unsigned short cLnOff;
2057 unsigned long offset[1];
2058 unsigned short lineNbr[1];
2059} OMFSourceLine;
2060
2061typedef struct OMFSourceFile
2062{
2063 unsigned short cSeg;
2064 unsigned short reserved;
2065 unsigned long baseSrcLn[1];
2066 unsigned short cFName;
2067 char Name;
2068} OMFSourceFile;
2069
2070typedef struct OMFSourceModule
2071{
2072 unsigned short cFile;
2073 unsigned short cSeg;
2074 unsigned long baseSrcFile[1];
2075} OMFSourceModule;
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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