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