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 #pragma once
100
101 #include "pshpack1.h"
102
103 /* ======================================== *
104 * Type information
105 * ======================================== */
106
107 struct p_string
108 {
109 unsigned char namelen;
110 char name[1];
111 };
112
113 union codeview_type
114 {
115 struct
116 {
117 unsigned short int len;
118 short int id;
119 } generic;
120
121 struct
122 {
123 unsigned short int len;
124 short int id;
125 short int attribute;
126 short int type;
127 } modifier_v1;
128
129 struct
130 {
131 unsigned short int len;
132 short int id;
133 int type;
134 short int attribute;
135 } modifier_v2;
136
137 struct
138 {
139 unsigned short int len;
140 short int id;
141 short int attribute;
142 short int datatype;
143 struct p_string p_name;
144 } pointer_v1;
145
146 struct
147 {
148 unsigned short int len;
149 short int id;
150 unsigned int datatype;
151 unsigned int attribute;
152 struct p_string p_name;
153 } pointer_v2;
154
155 struct
156 {
157 unsigned short int len;
158 short int id;
159 short int elemtype;
160 short int idxtype;
161 unsigned short int arrlen; /* numeric leaf */
162 #if 0
163 struct p_string p_name;
164 #endif
165 } array_v1;
166
167 struct
168 {
169 unsigned short int len;
170 short int id;
171 unsigned int elemtype;
172 unsigned int idxtype;
173 unsigned short int arrlen; /* numeric leaf */
174 #if 0
175 struct p_string p_name;
176 #endif
177 } array_v2;
178
179 struct
180 {
181 unsigned short int len;
182 short int id;
183 unsigned int elemtype;
184 unsigned int idxtype;
185 unsigned short int arrlen; /* numeric leaf */
186 #if 0
187 char name[1];
188 #endif
189 } array_v3;
190
191 struct
192 {
193 unsigned short int len;
194 short int id;
195 short int n_element;
196 short int fieldlist;
197 short int property;
198 short int derived;
199 short int vshape;
200 unsigned short int structlen; /* numeric leaf */
201 #if 0
202 struct p_string p_name;
203 #endif
204 } struct_v1;
205
206 struct
207 {
208 unsigned short int len;
209 short int id;
210 short int n_element;
211 short int property;
212 unsigned int fieldlist;
213 unsigned int derived;
214 unsigned int vshape;
215 unsigned short int structlen; /* numeric leaf */
216 #if 0
217 struct p_string p_name;
218 #endif
219 } struct_v2;
220
221 struct
222 {
223 unsigned short int len;
224 short int id;
225 short int n_element;
226 short int property;
227 unsigned int fieldlist;
228 unsigned int derived;
229 unsigned int vshape;
230 unsigned short int structlen; /* numeric leaf */
231 #if 0
232 char name[1];
233 #endif
234 } struct_v3;
235
236 struct
237 {
238 unsigned short int len;
239 short int id;
240 short int count;
241 short int fieldlist;
242 short int property;
243 unsigned short int un_len; /* numeric leaf */
244 #if 0
245 struct p_string p_name;
246 #endif
247 } union_v1;
248
249 struct
250 {
251 unsigned short int len;
252 short int id;
253 short int count;
254 short int property;
255 unsigned int fieldlist;
256 unsigned short int un_len; /* numeric leaf */
257 #if 0
258 struct p_string p_name;
259 #endif
260 } union_v2;
261
262 struct
263 {
264 unsigned short int len;
265 short int id;
266 short int count;
267 short int property;
268 unsigned int fieldlist;
269 unsigned short int un_len; /* numeric leaf */
270 #if 0
271 char name[1];
272 #endif
273 } union_v3;
274
275 struct
276 {
277 unsigned short int len;
278 short int id;
279 short int count;
280 short int type;
281 short int fieldlist;
282 short int property;
283 struct p_string p_name;
284 } enumeration_v1;
285
286 struct
287 {
288 unsigned short int len;
289 short int id;
290 short int count;
291 short int property;
292 unsigned int type;
293 unsigned int fieldlist;
294 struct p_string p_name;
295 } enumeration_v2;
296
297 struct
298 {
299 unsigned short int len;
300 short int id;
301 short int count;
302 short int property;
303 unsigned int type;
304 unsigned int fieldlist;
305 char name[1];
306 } enumeration_v3;
307
308 struct
309 {
310 unsigned short int len;
311 short int id;
312 unsigned short int rvtype;
313 unsigned char call;
314 unsigned char reserved;
315 unsigned short int params;
316 unsigned short int arglist;
317 } procedure_v1;
318
319 struct
320 {
321 unsigned short int len;
322 short int id;
323 unsigned int rvtype;
324 unsigned char call;
325 unsigned char reserved;
326 unsigned short int params;
327 unsigned int arglist;
328 } procedure_v2;
329
330 struct
331 {
332 unsigned short int len;
333 short int id;
334 unsigned short int rvtype;
335 unsigned short int class_type;
336 unsigned short int this_type;
337 unsigned char call;
338 unsigned char reserved;
339 unsigned short int params;
340 unsigned short int arglist;
341 unsigned int this_adjust;
342 } mfunction_v1;
343
344 struct
345 {
346 unsigned short int len;
347 short int id;
348 unsigned int rvtype;
349 unsigned int class_type;
350 unsigned this_type;
351 unsigned char call;
352 unsigned char reserved;
353 unsigned short params;
354 unsigned int arglist;
355 unsigned int this_adjust;
356 } mfunction_v2;
357 };
358
359 union codeview_reftype
360 {
361 struct
362 {
363 unsigned short int len;
364 short int id;
365 } generic;
366
367 struct
368 {
369 unsigned short int len;
370 short int id;
371 unsigned char list[1];
372 } fieldlist;
373
374 struct
375 {
376 unsigned short int len;
377 short int id;
378 unsigned char nbits;
379 unsigned char bitoff;
380 unsigned short type;
381 } bitfield_v1;
382
383 struct
384 {
385 unsigned short int len;
386 short int id;
387 unsigned int type;
388 unsigned char nbits;
389 unsigned char bitoff;
390 } bitfield_v2;
391
392 struct
393 {
394 unsigned short int len;
395 short int id;
396 unsigned short num;
397 unsigned short args[1];
398 } arglist_v1;
399
400 struct
401 {
402 unsigned short int len;
403 short int id;
404 unsigned num;
405 unsigned args[1];
406 } arglist_v2;
407
408 struct
409 {
410 unsigned short int len;
411 short int id;
412 unsigned short num;
413 unsigned short drvdcls[1];
414 } derived_v1;
415
416 struct
417 {
418 unsigned short int len;
419 short int id;
420 unsigned num;
421 unsigned drvdcls[1];
422 } derived_v2;
423 };
424
425 union codeview_fieldtype
426 {
427 struct
428 {
429 short int id;
430 } generic;
431
432 struct
433 {
434 short int id;
435 short int type;
436 short int attribute;
437 unsigned short int offset; /* numeric leaf */
438 } bclass_v1;
439
440 struct
441 {
442 short int id;
443 short int attribute;
444 unsigned int type;
445 unsigned short int offset; /* numeric leaf */
446 } bclass_v2;
447
448 struct
449 {
450 short int id;
451 short int btype;
452 short int vbtype;
453 short int attribute;
454 unsigned short int vbpoff; /* numeric leaf */
455 #if 0
456 unsigned short int vboff; /* numeric leaf */
457 #endif
458 } vbclass_v1;
459
460 struct
461 {
462 short int id;
463 short int attribute;
464 unsigned int btype;
465 unsigned int vbtype;
466 unsigned short int vbpoff; /* numeric leaf */
467 #if 0
468 unsigned short int vboff; /* numeric leaf */
469 #endif
470 } vbclass_v2;
471
472 struct
473 {
474 short int id;
475 short int attribute;
476 unsigned short int value; /* numeric leaf */
477 #if 0
478 struct p_string p_name;
479 #endif
480 } enumerate_v1;
481
482 struct
483 {
484 short int id;
485 short int attribute;
486 unsigned short int value; /* numeric leaf */
487 #if 0
488 char name[1];
489 #endif
490 } enumerate_v3;
491
492 struct
493 {
494 short int id;
495 short int type;
496 struct p_string p_name;
497 } friendfcn_v1;
498
499 struct
500 {
501 short int id;
502 short int _pad0;
503 unsigned int type;
504 struct p_string p_name;
505 } friendfcn_v2;
506
507 struct
508 {
509 short int id;
510 short int type;
511 short int attribute;
512 unsigned short int offset; /* numeric leaf */
513 #if 0
514 struct p_string p_name;
515 #endif
516 } member_v1;
517
518 struct
519 {
520 short int id;
521 short int attribute;
522 unsigned int type;
523 unsigned short int offset; /* numeric leaf */
524 #if 0
525 struct p_string p_name;
526 #endif
527 } member_v2;
528
529 struct
530 {
531 short int id;
532 short int attribute;
533 unsigned int type;
534 unsigned short int offset; /* numeric leaf */
535 #if 0
536 unsigned char name[1];
537 #endif
538 }
539 member_v3;
540
541 struct
542 {
543 short int id;
544 short int type;
545 short int attribute;
546 struct p_string p_name;
547 } stmember_v1;
548
549 struct
550 {
551 short int id;
552 short int attribute;
553 unsigned int type;
554 struct p_string p_name;
555 } stmember_v2;
556
557 struct
558 {
559 short int id;
560 short int attribute;
561 unsigned int type;
562 char name[1];
563 } stmember_v3;
564
565 struct
566 {
567 short int id;
568 short int count;
569 short int mlist;
570 struct p_string p_name;
571 } method_v1;
572
573 struct
574 {
575 short int id;
576 short int count;
577 unsigned int mlist;
578 struct p_string p_name;
579 } method_v2;
580
581 struct
582 {
583 short int id;
584 short int count;
585 unsigned int mlist;
586 char name[1];
587 } method_v3;
588
589 struct
590 {
591 short int id;
592 short int type;
593 struct p_string p_name;
594 } nesttype_v1;
595
596 struct
597 {
598 short int id;
599 short int _pad0;
600 unsigned int type;
601 struct p_string p_name;
602 } nesttype_v2;
603
604 struct
605 {
606 short int id;
607 short int _pad0;
608 unsigned int type;
609 char name[1];
610 } nesttype_v3;
611
612 struct
613 {
614 short int id;
615 short int type;
616 } vfunctab_v1;
617
618 struct
619 {
620 short int id;
621 short int _pad0;
622 unsigned int type;
623 } vfunctab_v2;
624
625 struct
626 {
627 short int id;
628 short int type;
629 } friendcls_v1;
630
631 struct
632 {
633 short int id;
634 short int _pad0;
635 unsigned int type;
636 } friendcls_v2;
637
638 struct
639 {
640 short int id;
641 short int attribute;
642 short int type;
643 struct p_string p_name;
644 } onemethod_v1;
645
646 struct
647 {
648 short int id;
649 short int attribute;
650 unsigned int type;
651 struct p_string p_name;
652 } onemethod_v2;
653
654 struct
655 {
656 short int id;
657 short int attribute;
658 unsigned int type;
659 char name[1];
660 } onemethod_v3;
661
662 struct
663 {
664 short int id;
665 short int attribute;
666 short int type;
667 unsigned int vtab_offset;
668 struct p_string p_name;
669 } onemethod_virt_v1;
670
671 struct
672 {
673 short int id;
674 short int attribute;
675 unsigned int type;
676 unsigned int vtab_offset;
677 struct p_string p_name;
678 } onemethod_virt_v2;
679
680 struct
681 {
682 short int id;
683 short int attribute;
684 unsigned int type;
685 unsigned int vtab_offset;
686 char name[1];
687 } onemethod_virt_v3;
688
689 struct
690 {
691 short int id;
692 short int type;
693 unsigned int offset;
694 } vfuncoff_v1;
695
696 struct
697 {
698 short int id;
699 short int _pad0;
700 unsigned int type;
701 unsigned int offset;
702 } vfuncoff_v2;
703
704 struct
705 {
706 short int id;
707 short int attribute;
708 short int type;
709 struct p_string p_name;
710 } nesttypeex_v1;
711
712 struct
713 {
714 short int id;
715 short int attribute;
716 unsigned int type;
717 struct p_string p_name;
718 } nesttypeex_v2;
719
720 struct
721 {
722 short int id;
723 short int attribute;
724 unsigned int type;
725 struct p_string p_name;
726 } membermodify_v2;
727
728 struct
729 {
730 short int id;
731 short int ref;
732 } index_v1;
733
734 struct
735 {
736 short int id;
737 short int unk;
738 unsigned int ref;
739 } index_v2;
740 };
741
742
743 /*
744 * This covers the basic datatypes that VC++ seems to be using these days.
745 * 32 bit mode only. There are additional numbers for the pointers in 16
746 * bit mode. There are many other types listed in the documents, but these
747 * are apparently not used by the compiler, or represent pointer types
748 * that are not used.
749 *
750 * Official MS documentation says that type (< 0x4000, so 12 bits) is made of:
751 * +----------+------+------+----------+------+
752 * | 11 | 10-8 | 7-4 | 3 | 2-0 |
753 * +----------+------+------+----------+------+
754 * | reserved | mode | type | reserved | size |
755 * +----------+------+------+----------+------+
756 * In recent PDB files, type 8 exists, and is seen as an HRESULT... So we've
757 * added this basic type... as if bit 3 had been integrated into the size field
758 */
759
760 /* the type number of a built-in type is a 16-bit value specified in the following format:
761 bit # | 11 | 10-8 | 7-4 | 3 | 2-0 |
762 field | reserved | mode | type | reserved | size |
763
764 where
765 <type> is one of the following types:
766 0x00 Special
767 0x01 Signed integral value
768 0x02 Unsigned integral value
769 0x03 Boolean
770 0x04 Real
771 0x05 Complex
772 0x06 Special2
773 0x07 Real int value
774 0x08 Reserved
775 0x09 Reserved
776 0x0a Reserved
777 0x0b Reserved
778 0x0c Reserved
779 0x0d Reserved
780 0x0e Reserved
781 0x0f Reserved for debugger expression evaluator
782
783 <size> is an enumerated value for each of the types.
784 Type = special
785 0x00 No type
786 0x01 Absolute symbol
787 0x02 Segment
788 0x03 Void
789 0x04 Basic 8-byte currency value
790 0x05 Near Basic string
791 0x06 Far Basic string
792 0x07 Untranslated type from previous Microsoft symbol formats
793 Type = signed/unsigned integral and Boolean values
794 0x00 1 byte
795 0x01 2 byte
796 0x02 4 byte
797 0x03 8 byte
798 0x04 Reserved
799 0x05 Reserved
800 0x06 Reserved
801 0x07 Reserved
802 Type = real and complex
803 0x00 32 bit
804 0x01 64 bit
805 0x02 80 bit
806 0x03 128 bit
807 0x04 48 bit
808 0x05 Reserved
809 0x06 Reserved
810 0x07 Reserved
811 Type = special2
812 0x00 Bit
813 0x01 Pascal CHAR
814 Type = Real int
815 0x00 Char
816 0x01 Wide character
817 0x02 2-byte signed integer
818 0x03 2-byte unsigned integer
819 0x04 4-byte signed integer
820 0x05 4-byte unsigned integer
821 0x06 8-byte signed integer
822 0x07 8-byte unsigned integer
823
824 <mode> is the pointer mode:
825 0x00 Direct; not a pointer
826 0x01 Near pointer
827 0x02 Far pointer
828 0x03 Huge pointer
829 0x04 32-bit near pointer
830 0x05 32-bit far pointer
831 0x06 64-bit near pointer
832 0x07 Reserved
833 */
834
835 /* basic types */
836 #define T_NOTYPE 0x0000 /* Notype */
837 #define T_ABS 0x0001 /* Abs */
838 #define T_SEGMENT 0x0002 /* segment type */
839 #define T_VOID 0x0003 /* Void */
840 #define T_CURRENCY 0x0004 /* basic 8-byte currency value */
841 #define T_NBASICSTR 0x0005 /* near basic string */
842 #define T_FBASICSTR 0x0006 /* far basic string */
843 #define T_NOTTRANS 0x0007 /* untranslated type record from MS symbol format */
844 #define T_HRESULT 0x0008 /* HRESULT - or error code ??? */
845 #define T_CHAR 0x0010 /* signed char */
846 #define T_SHORT 0x0011 /* short */
847 #define T_LONG 0x0012 /* long */
848 #define T_QUAD 0x0013 /* long long */
849 #define T_UCHAR 0x0020 /* unsigned char */
850 #define T_USHORT 0x0021 /* unsigned short */
851 #define T_ULONG 0x0022 /* unsigned long */
852 #define T_UQUAD 0x0023 /* unsigned long long */
853 #define T_BOOL08 0x0030 /* 8-bit boolean */
854 #define T_BOOL16 0x0031 /* 16-bit boolean */
855 #define T_BOOL32 0x0032 /* 32-bit boolean */
856 #define T_BOOL64 0x0033 /* 64-bit boolean */
857 #define T_REAL32 0x0040 /* float */
858 #define T_REAL64 0x0041 /* double */
859 #define T_REAL80 0x0042 /* 80-bit real */
860 #define T_REAL128 0x0043 /* 128-bit real */
861 #define T_REAL48 0x0044 /* 48-bit real */
862 #define T_CPLX32 0x0050 /* 32-bit complex number */
863 #define T_CPLX64 0x0051 /* 64-bit complex number */
864 #define T_CPLX80 0x0052 /* 80-bit complex number */
865 #define T_CPLX128 0x0053 /* 128-bit complex number */
866 #define T_BIT 0x0060 /* bit */
867 #define T_PASCHAR 0x0061 /* pascal CHAR */
868 #define T_RCHAR 0x0070 /* real char */
869 #define T_WCHAR 0x0071 /* wide char */
870 #define T_INT2 0x0072 /* real 16-bit signed int */
871 #define T_UINT2 0x0073 /* real 16-bit unsigned int */
872 #define T_INT4 0x0074 /* int */
873 #define T_UINT4 0x0075 /* unsigned int */
874 #define T_INT8 0x0076 /* 64-bit signed int */
875 #define T_UINT8 0x0077 /* 64-bit unsigned int */
876 #define T_CHAR16 0x007a /* 16-bit unicode char */
877 #define T_CHAR32 0x007b /* 32-bit unicode char */
878
879 /* near pointers to basic types */
880 #define T_PVOID 0x0103 /* near pointer to void */
881 #define T_PCHAR 0x0110 /* Near pointer to 8-bit signed */
882 #define T_PSHORT 0x0111 /* Near pointer to 16-bit signed */
883 #define T_PLONG 0x0112 /* Near pointer to 32-bit signed */
884 #define T_PQUAD 0x0113 /* Near pointer to 64-bit signed */
885 #define T_PUCHAR 0x0120 /* Near pointer to 8-bit unsigned */
886 #define T_PUSHORT 0x0121 /* Near pointer to 16-bit unsigned */
887 #define T_PULONG 0x0122 /* Near pointer to 32-bit unsigned */
888 #define T_PUQUAD 0x0123 /* Near pointer to 64-bit unsigned */
889 #define T_PBOOL08 0x0130 /* Near pointer to 8-bit Boolean */
890 #define T_PBOOL16 0x0131 /* Near pointer to 16-bit Boolean */
891 #define T_PBOOL32 0x0132 /* Near pointer to 32-bit Boolean */
892 #define T_PBOOL64 0x0133 /* Near pointer to 64-bit Boolean */
893 #define T_PREAL32 0x0140 /* Near pointer to 32-bit real */
894 #define T_PREAL64 0x0141 /* Near pointer to 64-bit real */
895 #define T_PREAL80 0x0142 /* Near pointer to 80-bit real */
896 #define T_PREAL128 0x0143 /* Near pointer to 128-bit real */
897 #define T_PREAL48 0x0144 /* Near pointer to 48-bit real */
898 #define T_PCPLX32 0x0150 /* Near pointer to 32-bit complex */
899 #define T_PCPLX64 0x0151 /* Near pointer to 64-bit complex */
900 #define T_PCPLX80 0x0152 /* Near pointer to 80-bit complex */
901 #define T_PCPLX128 0x0153 /* Near pointer to 128-bit complex */
902 #define T_PRCHAR 0x0170 /* Near pointer to a real char */
903 #define T_PWCHAR 0x0171 /* Near pointer to a wide char */
904 #define T_PINT2 0x0172 /* Near pointer to 16-bit signed int */
905 #define T_PUINT2 0x0173 /* Near pointer to 16-bit unsigned int */
906 #define T_PINT4 0x0174 /* Near pointer to 32-bit signed int */
907 #define T_PUINT4 0x0175 /* Near pointer to 32-bit unsigned int */
908 #define T_PINT8 0x0176 /* Near pointer to 64-bit signed int */
909 #define T_PUINT8 0x0177 /* Near pointer to 64-bit unsigned int */
910 #define T_PCHAR16 0x017a /* Near pointer to 16-bit unicode char */
911 #define T_PCHAR32 0x017b /* Near pointer to 32-bit unicode char */
912
913 /* far pointers to basic types */
914 #define T_PFVOID 0x0203 /* Far pointer to void */
915 #define T_PFCHAR 0x0210 /* Far pointer to 8-bit signed */
916 #define T_PFSHORT 0x0211 /* Far pointer to 16-bit signed */
917 #define T_PFLONG 0x0212 /* Far pointer to 32-bit signed */
918 #define T_PFQUAD 0x0213 /* Far pointer to 64-bit signed */
919 #define T_PFUCHAR 0x0220 /* Far pointer to 8-bit unsigned */
920 #define T_PFUSHORT 0x0221 /* Far pointer to 16-bit unsigned */
921 #define T_PFULONG 0x0222 /* Far pointer to 32-bit unsigned */
922 #define T_PFUQUAD 0x0223 /* Far pointer to 64-bit unsigned */
923 #define T_PFBOOL08 0x0230 /* Far pointer to 8-bit Boolean */
924 #define T_PFBOOL16 0x0231 /* Far pointer to 16-bit Boolean */
925 #define T_PFBOOL32 0x0232 /* Far pointer to 32-bit Boolean */
926 #define T_PFBOOL64 0x0233 /* Far pointer to 64-bit Boolean */
927 #define T_PFREAL32 0x0240 /* Far pointer to 32-bit real */
928 #define T_PFREAL64 0x0241 /* Far pointer to 64-bit real */
929 #define T_PFREAL80 0x0242 /* Far pointer to 80-bit real */
930 #define T_PFREAL128 0x0243 /* Far pointer to 128-bit real */
931 #define T_PFREAL48 0x0244 /* Far pointer to 48-bit real */
932 #define T_PFCPLX32 0x0250 /* Far pointer to 32-bit complex */
933 #define T_PFCPLX64 0x0251 /* Far pointer to 64-bit complex */
934 #define T_PFCPLX80 0x0252 /* Far pointer to 80-bit complex */
935 #define T_PFCPLX128 0x0253 /* Far pointer to 128-bit complex */
936 #define T_PFRCHAR 0x0270 /* Far pointer to a real char */
937 #define T_PFWCHAR 0x0271 /* Far pointer to a wide char */
938 #define T_PFINT2 0x0272 /* Far pointer to 16-bit signed int */
939 #define T_PFUINT2 0x0273 /* Far pointer to 16-bit unsigned int */
940 #define T_PFINT4 0x0274 /* Far pointer to 32-bit signed int */
941 #define T_PFUINT4 0x0275 /* Far pointer to 32-bit unsigned int */
942 #define T_PFINT8 0x0276 /* Far pointer to 64-bit signed int */
943 #define T_PFUINT8 0x0277 /* Far pointer to 64-bit unsigned int */
944 #define T_PFCHAR16 0x027a /* Far pointer to 16-bit unicode char */
945 #define T_PFCHAR32 0x027b /* Far pointer to 32-bit unicode char */
946
947 /* huge pointers to basic types */
948 #define T_PHVOID 0x0303 /* Huge pointer to void */
949 #define T_PHCHAR 0x0310 /* Huge pointer to 8-bit signed */
950 #define T_PHSHORT 0x0311 /* Huge pointer to 16-bit signed */
951 #define T_PHLONG 0x0312 /* Huge pointer to 32-bit signed */
952 #define T_PHQUAD 0x0313 /* Huge pointer to 64-bit signed */
953 #define T_PHUCHAR 0x0320 /* Huge pointer to 8-bit unsigned */
954 #define T_PHUSHORT 0x0321 /* Huge pointer to 16-bit unsigned */
955 #define T_PHULONG 0x0322 /* Huge pointer to 32-bit unsigned */
956 #define T_PHUQUAD 0x0323 /* Huge pointer to 64-bit unsigned */
957 #define T_PHBOOL08 0x0330 /* Huge pointer to 8-bit Boolean */
958 #define T_PHBOOL16 0x0331 /* Huge pointer to 16-bit Boolean */
959 #define T_PHBOOL32 0x0332 /* Huge pointer to 32-bit Boolean */
960 #define T_PHBOOL64 0x0333 /* Huge pointer to 64-bit Boolean */
961 #define T_PHREAL32 0x0340 /* Huge pointer to 32-bit real */
962 #define T_PHREAL64 0x0341 /* Huge pointer to 64-bit real */
963 #define T_PHREAL80 0x0342 /* Huge pointer to 80-bit real */
964 #define T_PHREAL128 0x0343 /* Huge pointer to 128-bit real */
965 #define T_PHREAL48 0x0344 /* Huge pointer to 48-bit real */
966 #define T_PHCPLX32 0x0350 /* Huge pointer to 32-bit complex */
967 #define T_PHCPLX64 0x0351 /* Huge pointer to 64-bit complex */
968 #define T_PHCPLX80 0x0352 /* Huge pointer to 80-bit complex */
969 #define T_PHCPLX128 0x0353 /* Huge pointer to 128-bit real */
970 #define T_PHRCHAR 0x0370 /* Huge pointer to a real char */
971 #define T_PHWCHAR 0x0371 /* Huge pointer to a wide char */
972 #define T_PHINT2 0x0372 /* Huge pointer to 16-bit signed int */
973 #define T_PHUINT2 0x0373 /* Huge pointer to 16-bit unsigned int */
974 #define T_PHINT4 0x0374 /* Huge pointer to 32-bit signed int */
975 #define T_PHUINT4 0x0375 /* Huge pointer to 32-bit unsigned int */
976 #define T_PHINT8 0x0376 /* Huge pointer to 64-bit signed int */
977 #define T_PHUINT8 0x0377 /* Huge pointer to 64-bit unsigned int */
978 #define T_PHCHAR16 0x037a /* Huge pointer to 16-bit unicode char */
979 #define T_PHCHAR32 0x037b /* Huge pointer to 32-bit unicode char */
980
981 /* 32-bit near pointers to basic types */
982 #define T_32PVOID 0x0403 /* 32-bit near pointer to void */
983 #define T_32PHRESULT 0x0408 /* 16:32 near pointer to HRESULT - or error code ??? */
984 #define T_32PCHAR 0x0410 /* 16:32 near pointer to 8-bit signed */
985 #define T_32PSHORT 0x0411 /* 16:32 near pointer to 16-bit signed */
986 #define T_32PLONG 0x0412 /* 16:32 near pointer to 32-bit signed */
987 #define T_32PQUAD 0x0413 /* 16:32 near pointer to 64-bit signed */
988 #define T_32PUCHAR 0x0420 /* 16:32 near pointer to 8-bit unsigned */
989 #define T_32PUSHORT 0x0421 /* 16:32 near pointer to 16-bit unsigned */
990 #define T_32PULONG 0x0422 /* 16:32 near pointer to 32-bit unsigned */
991 #define T_32PUQUAD 0x0423 /* 16:32 near pointer to 64-bit unsigned */
992 #define T_32PBOOL08 0x0430 /* 16:32 near pointer to 8-bit Boolean */
993 #define T_32PBOOL16 0x0431 /* 16:32 near pointer to 16-bit Boolean */
994 #define T_32PBOOL32 0x0432 /* 16:32 near pointer to 32-bit Boolean */
995 #define T_32PBOOL64 0x0433 /* 16:32 near pointer to 64-bit Boolean */
996 #define T_32PREAL32 0x0440 /* 16:32 near pointer to 32-bit real */
997 #define T_32PREAL64 0x0441 /* 16:32 near pointer to 64-bit real */
998 #define T_32PREAL80 0x0442 /* 16:32 near pointer to 80-bit real */
999 #define T_32PREAL128 0x0443 /* 16:32 near pointer to 128-bit real */
1000 #define T_32PREAL48 0x0444 /* 16:32 near pointer to 48-bit real */
1001 #define T_32PCPLX32 0x0450 /* 16:32 near pointer to 32-bit complex */
1002 #define T_32PCPLX64 0x0451 /* 16:32 near pointer to 64-bit complex */
1003 #define T_32PCPLX80 0x0452 /* 16:32 near pointer to 80-bit complex */
1004 #define T_32PCPLX128 0x0453 /* 16:32 near pointer to 128-bit complex */
1005 #define T_32PRCHAR 0x0470 /* 16:32 near pointer to a real char */
1006 #define T_32PWCHAR 0x0471 /* 16:32 near pointer to a wide char */
1007 #define T_32PINT2 0x0472 /* 16:32 near pointer to 16-bit signed int */
1008 #define T_32PUINT2 0x0473 /* 16:32 near pointer to 16-bit unsigned int */
1009 #define T_32PINT4 0x0474 /* 16:32 near pointer to 32-bit signed int */
1010 #define T_32PUINT4 0x0475 /* 16:32 near pointer to 32-bit unsigned int */
1011 #define T_32PINT8 0x0476 /* 16:32 near pointer to 64-bit signed int */
1012 #define T_32PUINT8 0x0477 /* 16:32 near pointer to 64-bit unsigned int */
1013 #define T_32PCHAR16 0x047a /* 16:32 near pointer to 16-bit unicode char */
1014 #define T_32PCHAR32 0x047b /* 16:32 near pointer to 32-bit unicode char */
1015
1016 /* 32-bit far pointers to basic types */
1017 #define T_32PFVOID 0x0503 /* 32-bit far pointer to void */
1018 #define T_32PFHRESULT 0x0508 /* 16:32 far pointer to HRESULT - or error code ??? */
1019 #define T_32PFCHAR 0x0510 /* 16:32 far pointer to 8-bit signed */
1020 #define T_32PFSHORT 0x0511 /* 16:32 far pointer to 16-bit signed */
1021 #define T_32PFLONG 0x0512 /* 16:32 far pointer to 32-bit signed */
1022 #define T_32PFQUAD 0x0513 /* 16:32 far pointer to 64-bit signed */
1023 #define T_32PFUCHAR 0x0520 /* 16:32 far pointer to 8-bit unsigned */
1024 #define T_32PFUSHORT 0x0521 /* 16:32 far pointer to 16-bit unsigned */
1025 #define T_32PFULONG 0x0522 /* 16:32 far pointer to 32-bit unsigned */
1026 #define T_32PFUQUAD 0x0523 /* 16:32 far pointer to 64-bit unsigned */
1027 #define T_32PFBOOL08 0x0530 /* 16:32 far pointer to 8-bit Boolean */
1028 #define T_32PFBOOL16 0x0531 /* 16:32 far pointer to 16-bit Boolean */
1029 #define T_32PFBOOL32 0x0532 /* 16:32 far pointer to 32-bit Boolean */
1030 #define T_32PFBOOL64 0x0533 /* 16:32 far pointer to 64-bit Boolean */
1031 #define T_32PFREAL32 0x0540 /* 16:32 far pointer to 32-bit real */
1032 #define T_32PFREAL64 0x0541 /* 16:32 far pointer to 64-bit real */
1033 #define T_32PFREAL80 0x0542 /* 16:32 far pointer to 80-bit real */
1034 #define T_32PFREAL128 0x0543 /* 16:32 far pointer to 128-bit real */
1035 #define T_32PFREAL48 0x0544 /* 16:32 far pointer to 48-bit real */
1036 #define T_32PFCPLX32 0x0550 /* 16:32 far pointer to 32-bit complex */
1037 #define T_32PFCPLX64 0x0551 /* 16:32 far pointer to 64-bit complex */
1038 #define T_32PFCPLX80 0x0552 /* 16:32 far pointer to 80-bit complex */
1039 #define T_32PFCPLX128 0x0553 /* 16:32 far pointer to 128-bit complex */
1040 #define T_32PFRCHAR 0x0570 /* 16:32 far pointer to a real char */
1041 #define T_32PFWCHAR 0x0571 /* 16:32 far pointer to a wide char */
1042 #define T_32PFINT2 0x0572 /* 16:32 far pointer to 16-bit signed int */
1043 #define T_32PFUINT2 0x0573 /* 16:32 far pointer to 16-bit unsigned int */
1044 #define T_32PFINT4 0x0574 /* 16:32 far pointer to 32-bit signed int */
1045 #define T_32PFUINT4 0x0575 /* 16:32 far pointer to 32-bit unsigned int */
1046 #define T_32PFINT8 0x0576 /* 16:32 far pointer to 64-bit signed int */
1047 #define T_32PFUINT8 0x0577 /* 16:32 far pointer to 64-bit unsigned int */
1048 #define T_32PFCHAR16 0x057a /* 16:32 far pointer to 16-bit unicode char */
1049 #define T_32PFCHAR32 0x057b /* 16:32 far pointer to 32-bit unicode char */
1050
1051 /* 64-bit near pointers to basic types */
1052 #define T_64PVOID 0x0603 /* 64-bit near pointer to void */
1053 #define T_64PHRESULT 0x0608 /* 64 near pointer to HRESULT - or error code ??? */
1054 #define T_64PCHAR 0x0610 /* 64 near pointer to 8-bit signed */
1055 #define T_64PSHORT 0x0611 /* 64 near pointer to 16-bit signed */
1056 #define T_64PLONG 0x0612 /* 64 near pointer to 32-bit signed */
1057 #define T_64PQUAD 0x0613 /* 64 near pointer to 64-bit signed */
1058 #define T_64PUCHAR 0x0620 /* 64 near pointer to 8-bit unsigned */
1059 #define T_64PUSHORT 0x0621 /* 64 near pointer to 16-bit unsigned */
1060 #define T_64PULONG 0x0622 /* 64 near pointer to 32-bit unsigned */
1061 #define T_64PUQUAD 0x0623 /* 64 near pointer to 64-bit unsigned */
1062 #define T_64PBOOL08 0x0630 /* 64 near pointer to 8-bit Boolean */
1063 #define T_64PBOOL16 0x0631 /* 64 near pointer to 16-bit Boolean */
1064 #define T_64PBOOL32 0x0632 /* 64 near pointer to 32-bit Boolean */
1065 #define T_64PBOOL64 0x0633 /* 64 near pointer to 64-bit Boolean */
1066 #define T_64PREAL32 0x0640 /* 64 near pointer to 32-bit real */
1067 #define T_64PREAL64 0x0641 /* 64 near pointer to 64-bit real */
1068 #define T_64PREAL80 0x0642 /* 64 near pointer to 80-bit real */
1069 #define T_64PREAL128 0x0643 /* 64 near pointer to 128-bit real */
1070 #define T_64PREAL48 0x0644 /* 64 near pointer to 48-bit real */
1071 #define T_64PCPLX32 0x0650 /* 64 near pointer to 32-bit complex */
1072 #define T_64PCPLX64 0x0651 /* 64 near pointer to 64-bit complex */
1073 #define T_64PCPLX80 0x0652 /* 64 near pointer to 80-bit complex */
1074 #define T_64PCPLX128 0x0653 /* 64 near pointer to 128-bit complex */
1075 #define T_64PRCHAR 0x0670 /* 64 near pointer to a real char */
1076 #define T_64PWCHAR 0x0671 /* 64 near pointer to a wide char */
1077 #define T_64PINT2 0x0672 /* 64 near pointer to 16-bit signed int */
1078 #define T_64PUINT2 0x0673 /* 64 near pointer to 16-bit unsigned int */
1079 #define T_64PINT4 0x0674 /* 64 near pointer to 32-bit signed int */
1080 #define T_64PUINT4 0x0675 /* 64 near pointer to 32-bit unsigned int */
1081 #define T_64PINT8 0x0676 /* 64 near pointer to 64-bit signed int */
1082 #define T_64PUINT8 0x0677 /* 64 near pointer to 64-bit unsigned int */
1083 #define T_64PCHAR16 0x067a /* 64 near pointer to 16-bit unicode char */
1084 #define T_64PCHAR32 0x067b /* 64 near pointer to 32-bit unicode char */
1085
1086 /* counts, bit masks, and shift values needed to access various parts of the built-in type numbers */
1087 #define T_MAXPREDEFINEDTYPE 0x0580 /* maximum type index for all built-in types */
1088 #define T_MAXBASICTYPE 0x0080 /* maximum type index all non-pointer built-in types */
1089 #define T_BASICTYPE_MASK 0x00ff /* mask of bits that can potentially identify a non-pointer basic type */
1090 #define T_BASICTYPE_SHIFT 8 /* shift count to push out the basic type bits from a type number */
1091 #define T_MODE_MASK 0x0700 /* type mode mask (ptr/non-ptr) */
1092 #define T_SIZE_MASK 0x0007 /* type size mask (depends on 'type' value) */
1093 #define T_TYPE_MASK 0x00f0 /* type type mask (data treatment mode) */
1094
1095 /* bit patterns for the <mode> portion of a built-in type number */
1096 #define T_NEARPTR_BITS 0x0100
1097 #define T_FARPTR_BITS 0x0200
1098 #define T_HUGEPTR_BITS 0x0300
1099 #define T_NEAR32PTR_BITS 0x0400
1100 #define T_FAR32PTR_BITS 0x0500
1101 #define T_NEAR64PTR_BITS 0x0600
1102
1103 #define LF_MODIFIER_V1 0x0001
1104 #define LF_POINTER_V1 0x0002
1105 #define LF_ARRAY_V1 0x0003
1106 #define LF_CLASS_V1 0x0004
1107 #define LF_STRUCTURE_V1 0x0005
1108 #define LF_UNION_V1 0x0006
1109 #define LF_ENUM_V1 0x0007
1110 #define LF_PROCEDURE_V1 0x0008
1111 #define LF_MFUNCTION_V1 0x0009
1112 #define LF_VTSHAPE_V1 0x000a
1113 #define LF_COBOL0_V1 0x000b
1114 #define LF_COBOL1_V1 0x000c
1115 #define LF_BARRAY_V1 0x000d
1116 #define LF_LABEL_V1 0x000e
1117 #define LF_NULL_V1 0x000f
1118 #define LF_NOTTRAN_V1 0x0010
1119 #define LF_DIMARRAY_V1 0x0011
1120 #define LF_VFTPATH_V1 0x0012
1121 #define LF_PRECOMP_V1 0x0013
1122 #define LF_ENDPRECOMP_V1 0x0014
1123 #define LF_OEM_V1 0x0015
1124 #define LF_TYPESERVER_V1 0x0016
1125
1126 #define LF_MODIFIER_V2 0x1001 /* variants with new 32-bit type indices (V2) */
1127 #define LF_POINTER_V2 0x1002
1128 #define LF_ARRAY_V2 0x1003
1129 #define LF_CLASS_V2 0x1004
1130 #define LF_STRUCTURE_V2 0x1005
1131 #define LF_UNION_V2 0x1006
1132 #define LF_ENUM_V2 0x1007
1133 #define LF_PROCEDURE_V2 0x1008
1134 #define LF_MFUNCTION_V2 0x1009
1135 #define LF_COBOL0_V2 0x100a
1136 #define LF_BARRAY_V2 0x100b
1137 #define LF_DIMARRAY_V2 0x100c
1138 #define LF_VFTPATH_V2 0x100d
1139 #define LF_PRECOMP_V2 0x100e
1140 #define LF_OEM_V2 0x100f
1141
1142 #define LF_SKIP_V1 0x0200
1143 #define LF_ARGLIST_V1 0x0201
1144 #define LF_DEFARG_V1 0x0202
1145 #define LF_LIST_V1 0x0203
1146 #define LF_FIELDLIST_V1 0x0204
1147 #define LF_DERIVED_V1 0x0205
1148 #define LF_BITFIELD_V1 0x0206
1149 #define LF_METHODLIST_V1 0x0207
1150 #define LF_DIMCONU_V1 0x0208
1151 #define LF_DIMCONLU_V1 0x0209
1152 #define LF_DIMVARU_V1 0x020a
1153 #define LF_DIMVARLU_V1 0x020b
1154 #define LF_REFSYM_V1 0x020c
1155
1156 #define LF_SKIP_V2 0x1200 /* variants with new 32-bit type indices (V2) */
1157 #define LF_ARGLIST_V2 0x1201
1158 #define LF_DEFARG_V2 0x1202
1159 #define LF_FIELDLIST_V2 0x1203
1160 #define LF_DERIVED_V2 0x1204
1161 #define LF_BITFIELD_V2 0x1205
1162 #define LF_METHODLIST_V2 0x1206
1163 #define LF_DIMCONU_V2 0x1207
1164 #define LF_DIMCONLU_V2 0x1208
1165 #define LF_DIMVARU_V2 0x1209
1166 #define LF_DIMVARLU_V2 0x120a
1167
1168 /* Field lists */
1169 #define LF_BCLASS_V1 0x0400
1170 #define LF_VBCLASS_V1 0x0401
1171 #define LF_IVBCLASS_V1 0x0402
1172 #define LF_ENUMERATE_V1 0x0403
1173 #define LF_FRIENDFCN_V1 0x0404
1174 #define LF_INDEX_V1 0x0405
1175 #define LF_MEMBER_V1 0x0406
1176 #define LF_STMEMBER_V1 0x0407
1177 #define LF_METHOD_V1 0x0408
1178 #define LF_NESTTYPE_V1 0x0409
1179 #define LF_VFUNCTAB_V1 0x040a
1180 #define LF_FRIENDCLS_V1 0x040b
1181 #define LF_ONEMETHOD_V1 0x040c
1182 #define LF_VFUNCOFF_V1 0x040d
1183 #define LF_NESTTYPEEX_V1 0x040e
1184 #define LF_MEMBERMODIFY_V1 0x040f
1185
1186 #define LF_BCLASS_V2 0x1400 /* variants with new 32-bit type indices (V2) */
1187 #define LF_VBCLASS_V2 0x1401
1188 #define LF_IVBCLASS_V2 0x1402
1189 #define LF_FRIENDFCN_V2 0x1403
1190 #define LF_INDEX_V2 0x1404
1191 #define LF_MEMBER_V2 0x1405
1192 #define LF_STMEMBER_V2 0x1406
1193 #define LF_METHOD_V2 0x1407
1194 #define LF_NESTTYPE_V2 0x1408
1195 #define LF_VFUNCTAB_V2 0x1409
1196 #define LF_FRIENDCLS_V2 0x140a
1197 #define LF_ONEMETHOD_V2 0x140b
1198 #define LF_VFUNCOFF_V2 0x140c
1199 #define LF_NESTTYPEEX_V2 0x140d
1200
1201 #define LF_ENUMERATE_V3 0x1502
1202 #define LF_ARRAY_V3 0x1503
1203 #define LF_CLASS_V3 0x1504
1204 #define LF_STRUCTURE_V3 0x1505
1205 #define LF_UNION_V3 0x1506
1206 #define LF_ENUM_V3 0x1507
1207 #define LF_MEMBER_V3 0x150d
1208 #define LF_STMEMBER_V3 0x150e
1209 #define LF_METHOD_V3 0x150f
1210 #define LF_NESTTYPE_V3 0x1510
1211 #define LF_ONEMETHOD_V3 0x1511
1212
1213 #define LF_NUMERIC 0x8000 /* numeric leaf types */
1214 #define LF_CHAR 0x8000
1215 #define LF_SHORT 0x8001
1216 #define LF_USHORT 0x8002
1217 #define LF_LONG 0x8003
1218 #define LF_ULONG 0x8004
1219 #define LF_REAL32 0x8005
1220 #define LF_REAL64 0x8006
1221 #define LF_REAL80 0x8007
1222 #define LF_REAL128 0x8008
1223 #define LF_QUADWORD 0x8009
1224 #define LF_UQUADWORD 0x800a
1225 #define LF_REAL48 0x800b
1226 #define LF_COMPLEX32 0x800c
1227 #define LF_COMPLEX64 0x800d
1228 #define LF_COMPLEX80 0x800e
1229 #define LF_COMPLEX128 0x800f
1230 #define LF_VARSTRING 0x8010
1231
1232 /* symtype e.g. for public_vx.symtype */
1233 #define SYMTYPE_NONE 0x0000
1234 #define SYMTYPE_CODE 0x0001
1235 #define SYMTYPE_FUNCTION 0x0002
1236 #define SYMTYPE_MANAGED 0x0004
1237 #define SYMTYPE_MSIL 0x0008
1238
1239 /* ======================================== *
1240 * Symbol information
1241 * ======================================== */
1242
1243 union codeview_symbol
1244 {
1245 struct
1246 {
1247 short int len;
1248 short int id;
1249 } generic;
1250
1251 struct
1252 {
1253 short int len;
1254 short int id;
1255 unsigned int offset;
1256 unsigned short segment;
1257 unsigned short symtype;
1258 struct p_string p_name;
1259 } data_v1;
1260
1261 struct
1262 {
1263 short int len;
1264 short int id;
1265 unsigned int symtype;
1266 unsigned int offset;
1267 unsigned short segment;
1268 struct p_string p_name;
1269 } data_v2;
1270
1271 struct
1272 {
1273 short int len;
1274 short int id;
1275 unsigned int symtype;
1276 unsigned int offset;
1277 unsigned short segment;
1278 char name[1];
1279 } data_v3;
1280
1281 struct
1282 {
1283 short int len;
1284 short int id;
1285 unsigned int pparent;
1286 unsigned int pend;
1287 unsigned int next;
1288 unsigned int offset;
1289 unsigned short segment;
1290 unsigned short thunk_len;
1291 unsigned char thtype;
1292 struct p_string p_name;
1293 } thunk_v1;
1294
1295 struct
1296 {
1297 short int len;
1298 short int id;
1299 unsigned int pparent;
1300 unsigned int pend;
1301 unsigned int next;
1302 unsigned int offset;
1303 unsigned short segment;
1304 unsigned short thunk_len;
1305 unsigned char thtype;
1306 char name[1];
1307 } thunk_v3;
1308
1309 struct
1310 {
1311 short int len;
1312 short int id;
1313 unsigned int pparent;
1314 unsigned int pend;
1315 unsigned int next;
1316 unsigned int proc_len;
1317 unsigned int debug_start;
1318 unsigned int debug_end;
1319 unsigned int offset;
1320 unsigned short segment;
1321 unsigned short proctype;
1322 unsigned char flags;
1323 struct p_string p_name;
1324 } proc_v1;
1325
1326 struct
1327 {
1328 short int len;
1329 short int id;
1330 unsigned int pparent;
1331 unsigned int pend;
1332 unsigned int next;
1333 unsigned int proc_len;
1334 unsigned int debug_start;
1335 unsigned int debug_end;
1336 unsigned int proctype;
1337 unsigned int offset;
1338 unsigned short segment;
1339 unsigned char flags;
1340 struct p_string p_name;
1341 } proc_v2;
1342
1343 struct
1344 {
1345 short int len;
1346 short int id;
1347 unsigned int pparent;
1348 unsigned int pend;
1349 unsigned int next;
1350 unsigned int proc_len;
1351 unsigned int debug_start;
1352 unsigned int debug_end;
1353 unsigned int proctype;
1354 unsigned int offset;
1355 unsigned short segment;
1356 unsigned char flags;
1357 char name[1];
1358 } proc_v3;
1359
1360 struct
1361 {
1362 short int len;
1363 short int id;
1364 unsigned int offset;
1365 unsigned short segment;
1366 unsigned short symtype;
1367 struct p_string p_name;
1368 } public_v1;
1369
1370 struct
1371 {
1372 short int len;
1373 short int id;
1374 unsigned int symtype;
1375 unsigned int offset;
1376 unsigned short segment;
1377 struct p_string p_name;
1378 } public_v2;
1379
1380 struct
1381 {
1382 short int len;
1383 short int id;
1384 unsigned int symtype;
1385 unsigned int offset;
1386 unsigned short segment;
1387 char name[1];
1388 } public_v3;
1389
1390 struct
1391 {
1392 short int len; /* Total length of this entry */
1393 short int id; /* Always S_BPREL_V1 */
1394 unsigned int offset; /* Stack offset relative to BP */
1395 unsigned short symtype;
1396 struct p_string p_name;
1397 } stack_v1;
1398
1399 struct
1400 {
1401 short int len; /* Total length of this entry */
1402 short int id; /* Always S_BPREL_V2 */
1403 unsigned int offset; /* Stack offset relative to EBP */
1404 unsigned int symtype;
1405 struct p_string p_name;
1406 } stack_v2;
1407
1408 struct
1409 {
1410 short int len; /* Total length of this entry */
1411 short int id; /* Always S_BPREL_V3 */
1412 int offset; /* Stack offset relative to BP */
1413 unsigned int symtype;
1414 char name[1];
1415 } stack_v3;
1416
1417 struct
1418 {
1419 short int len; /* Total length of this entry */
1420 short int id; /* Always S_BPREL_V3 */
1421 int offset; /* Stack offset relative to BP */
1422 unsigned int symtype;
1423 unsigned short reg;
1424 char name[1];
1425 } regrel_v3;
1426
1427 struct
1428 {
1429 short int len; /* Total length of this entry */
1430 short int id; /* Always S_REGISTER */
1431 unsigned short type;
1432 unsigned short reg;
1433 struct p_string p_name;
1434 /* don't handle register tracking */
1435 } register_v1;
1436
1437 struct
1438 {
1439 short int len; /* Total length of this entry */
1440 short int id; /* Always S_REGISTER_V2 */
1441 unsigned int type; /* check whether type & reg are correct */
1442 unsigned short reg;
1443 struct p_string p_name;
1444 /* don't handle register tracking */
1445 } register_v2;
1446
1447 struct
1448 {
1449 short int len; /* Total length of this entry */
1450 short int id; /* Always S_REGISTER_V3 */
1451 unsigned int type; /* check whether type & reg are correct */
1452 unsigned short reg;
1453 char name[1];
1454 /* don't handle register tracking */
1455 } register_v3;
1456
1457 struct
1458 {
1459 short int len;
1460 short int id;
1461 unsigned int parent;
1462 unsigned int end;
1463 unsigned int length;
1464 unsigned int offset;
1465 unsigned short segment;
1466 struct p_string p_name;
1467 } block_v1;
1468
1469 struct
1470 {
1471 short int len;
1472 short int id;
1473 unsigned int parent;
1474 unsigned int end;
1475 unsigned int length;
1476 unsigned int offset;
1477 unsigned short segment;
1478 char name[1];
1479 } block_v3;
1480
1481 struct
1482 {
1483 short int len;
1484 short int id;
1485 unsigned int offset;
1486 unsigned short segment;
1487 unsigned char flags;
1488 struct p_string p_name;
1489 } label_v1;
1490
1491 struct
1492 {
1493 short int len;
1494 short int id;
1495 unsigned int offset;
1496 unsigned short segment;
1497 unsigned char flags;
1498 char name[1];
1499 } label_v3;
1500
1501 struct
1502 {
1503 short int len;
1504 short int id;
1505 unsigned short type;
1506 unsigned short cvalue; /* numeric leaf */
1507 #if 0
1508 struct p_string p_name;
1509 #endif
1510 } constant_v1;
1511
1512 struct
1513 {
1514 short int len;
1515 short int id;
1516 unsigned type;
1517 unsigned short cvalue; /* numeric leaf */
1518 #if 0
1519 struct p_string p_name;
1520 #endif
1521 } constant_v2;
1522
1523 struct
1524 {
1525 short int len;
1526 short int id;
1527 unsigned type;
1528 unsigned short cvalue;
1529 #if 0
1530 char name[1];
1531 #endif
1532 } constant_v3;
1533
1534 struct
1535 {
1536 short int len;
1537 short int id;
1538 unsigned short type;
1539 struct p_string p_name;
1540 } udt_v1;
1541
1542 struct
1543 {
1544 short int len;
1545 short int id;
1546 unsigned type;
1547 struct p_string p_name;
1548 } udt_v2;
1549
1550 struct
1551 {
1552 short int len;
1553 short int id;
1554 unsigned int type;
1555 char name[1];
1556 } udt_v3;
1557
1558 struct
1559 {
1560 short int len;
1561 short int id;
1562 char signature[4];
1563 struct p_string p_name;
1564 } objname_v1;
1565
1566 struct
1567 {
1568 short int len;
1569 short int id;
1570 unsigned int unknown;
1571 struct p_string p_name;
1572 } compiland_v1;
1573
1574 struct
1575 {
1576 short int len;
1577 short int id;
1578 unsigned unknown1[4];
1579 unsigned short unknown2;
1580 struct p_string p_name;
1581 } compiland_v2;
1582
1583 struct
1584 {
1585 short int len;
1586 short int id;
1587 unsigned int unknown;
1588 char name[1];
1589 } compiland_v3;
1590
1591 struct
1592 {
1593 short int len;
1594 short int id;
1595 unsigned int offset;
1596 unsigned short segment;
1597 unsigned short symtype;
1598 struct p_string p_name;
1599 } thread_v1;
1600
1601 struct
1602 {
1603 short int len;
1604 short int id;
1605 unsigned int symtype;
1606 unsigned int offset;
1607 unsigned short segment;
1608 struct p_string p_name;
1609 } thread_v2;
1610
1611 struct
1612 {
1613 short int len;
1614 short int id;
1615 unsigned int symtype;
1616 unsigned int offset;
1617 unsigned short segment;
1618 char name[1];
1619 } thread_v3;
1620
1621 struct
1622 {
1623 short int len;
1624 short int id;
1625 unsigned int offset;
1626 unsigned short segment;
1627 } ssearch_v1;
1628
1629 struct
1630 {
1631 short int len;
1632 short int id;
1633 unsigned int offset;
1634 unsigned int unknown;
1635 } security_cookie_v3;
1636
1637 struct
1638 {
1639 short int len;
1640 short int id;
1641 unsigned int sz_frame; /* size of frame */
1642 unsigned int unknown2;
1643 unsigned int unknown3;
1644 unsigned int sz_saved_regs; /* size of saved registers from callee */
1645 unsigned int eh_offset; /* offset for exception handler */
1646 unsigned short eh_sect; /* section for exception handler */
1647 unsigned int flags;
1648 } frame_info_v2;
1649
1650 struct
1651 {
1652 unsigned short len;
1653 unsigned short id;
1654 unsigned int offset;
1655 unsigned short sect_idx;
1656 unsigned short inst_len;
1657 unsigned int index;
1658 } heap_alloc_site;
1659 };
1660
1661 #define S_COMPILAND_V1 0x0001
1662 #define S_REGISTER_V1 0x0002
1663 #define S_CONSTANT_V1 0x0003
1664 #define S_UDT_V1 0x0004
1665 #define S_SSEARCH_V1 0x0005
1666 #define S_END_V1 0x0006
1667 #define S_SKIP_V1 0x0007
1668 #define S_CVRESERVE_V1 0x0008
1669 #define S_OBJNAME_V1 0x0009
1670 #define S_ENDARG_V1 0x000a
1671 #define S_COBOLUDT_V1 0x000b
1672 #define S_MANYREG_V1 0x000c
1673 #define S_RETURN_V1 0x000d
1674 #define S_ENTRYTHIS_V1 0x000e
1675
1676 #define S_BPREL_V1 0x0200
1677 #define S_LDATA_V1 0x0201
1678 #define S_GDATA_V1 0x0202
1679 #define S_PUB_V1 0x0203
1680 #define S_LPROC_V1 0x0204
1681 #define S_GPROC_V1 0x0205
1682 #define S_THUNK_V1 0x0206
1683 #define S_BLOCK_V1 0x0207
1684 #define S_WITH_V1 0x0208
1685 #define S_LABEL_V1 0x0209
1686 #define S_CEXMODEL_V1 0x020a
1687 #define S_VFTPATH_V1 0x020b
1688 #define S_REGREL_V1 0x020c
1689 #define S_LTHREAD_V1 0x020d
1690 #define S_GTHREAD_V1 0x020e
1691
1692 #define S_PROCREF_V1 0x0400
1693 #define S_DATAREF_V1 0x0401
1694 #define S_ALIGN_V1 0x0402
1695 #define S_LPROCREF_V1 0x0403
1696
1697 #define S_REGISTER_V2 0x1001 /* Variants with new 32-bit type indices */
1698 #define S_CONSTANT_V2 0x1002
1699 #define S_UDT_V2 0x1003
1700 #define S_COBOLUDT_V2 0x1004
1701 #define S_MANYREG_V2 0x1005
1702 #define S_BPREL_V2 0x1006
1703 #define S_LDATA_V2 0x1007
1704 #define S_GDATA_V2 0x1008
1705 #define S_PUB_V2 0x1009
1706 #define S_LPROC_V2 0x100a
1707 #define S_GPROC_V2 0x100b
1708 #define S_VFTTABLE_V2 0x100c
1709 #define S_REGREL_V2 0x100d
1710 #define S_LTHREAD_V2 0x100e
1711 #define S_GTHREAD_V2 0x100f
1712 #define S_FRAMEINFO_V2 0x1012
1713 #define S_COMPILAND_V2 0x1013
1714
1715 #define S_COMPILAND_V3 0x1101
1716 #define S_THUNK_V3 0x1102
1717 #define S_BLOCK_V3 0x1103
1718 #define S_WITH_V3 0x1104
1719 #define S_LABEL_V3 0x1105
1720 #define S_REGISTER_V3 0x1106
1721 #define S_CONSTANT_V3 0x1107
1722 #define S_UDT_V3 0x1108
1723 #define S_COBOLUDT_V3 0x1109
1724 #define S_MANYREG_V3 0x110A
1725 #define S_BPREL_V3 0x110B
1726 #define S_LDATA_V3 0x110C
1727 #define S_GDATA_V3 0x110D
1728 #define S_PUB_V3 0x110E
1729 #define S_LPROC_V3 0x110F
1730 #define S_GPROC_V3 0x1110
1731 #define S_REGREL_V3 0x1111
1732 #define S_LTHREAD_V3 0x1112
1733 #define S_GTHREAD_V3 0x1113
1734 #define S_LPROCMIPS 0x1114
1735 #define S_GPROCMIPS 0x1115
1736 #define S_MSTOOL_V3 0x1116 /* compiler command line options and build information */
1737 #define S_MANYREG2 0x1117
1738 #define S_LPROCIA64 0x1118
1739 #define S_GPROCIA64 0x1119
1740 #define S_LOCALSLOT 0x111A
1741 #define S_PARAMSLOT 0x111B
1742 #define S_LMANDATA 0x111C
1743 #define S_GMANDATA 0x111D
1744 #define S_MANFRAMEREL 0x111E
1745 #define S_MANREGISTER 0x111F
1746 #define S_MANSLOT 0x1120
1747 #define S_MANMANYREG 0x1121
1748 #define S_MANREGREL 0x1122
1749 #define S_MANMANYREG2 0x1123
1750 #define S_UNAMESPACE 0x1124
1751 #define S_PUB_FUNC1_V3 0x1125 /* didn't get the difference between the two */
1752 #define S_DATAREF_V3 0x1126
1753 #define S_PUB_FUNC2_V3 0x1127
1754 #define S_ANNOTATIONREF 0x1128
1755 #define S_TOKENREF 0x1129
1756 #define S_GMANPROC 0x112A
1757 #define S_LMANPROC 0x112B
1758 #define S_TRAMPOLINE 0x112C
1759 #define S_MANCONSTANT 0x112D
1760 #define S_ATTR_FRAMEREL 0x112E
1761 #define S_ATTR_REGISTER 0x112F
1762 #define S_ATTR_REGREL 0x1130
1763 #define S_ATTR_MANYREG 0x1131
1764 #define S_SEPCODE 0x1132
1765 #define S_LOCAL_2005 0x1133
1766 #define S_DEFRANGE_2005 0x1134
1767 #define S_DEFRANGE2_2005 0x1135
1768 #define S_SECTINFO_V3 0x1136
1769 #define S_SUBSECTINFO_V3 0x1137
1770 #define S_ENTRYPOINT_V3 0x1138
1771 #define S_CALLSITEINFO 0x1139
1772 #define S_SECUCOOKIE_V3 0x113A
1773 #define S_DISCARDED 0x113B
1774 #define S_MSTOOLINFO_V3 0x113C
1775 #define S_MSTOOLENV_V3 0x113D
1776
1777 #define S_LOCAL_VS2013 0x113E
1778 #define S_DEFRANGE_VS2013 0x113F
1779 #define S_DEFRANGE_SUBFIELD 0x1140
1780 #define S_DEFRANGE_REGISTER 0x1141
1781 #define S_DEFRANGE_FRAMEPOINTER_REL 0x1142
1782 #define S_DEFRANGE_SUBFIELD_REGISTER 0x1143
1783 #define S_FPOFF_VS2013 0x1144
1784 #define S_DEFRANGE_REGISTER_REL 0x1145
1785 #define S_LPROC32_VS2013 0x1146
1786 #define S_GPROC32_VS2013 0x1147
1787 #define S_LPROCMIPS_ID 0x1148
1788 #define S_GPROCMIPS_ID 0x1149
1789 #define S_LPROCIA64_ID 0x114A
1790 #define S_GPROCIA64_ID 0x114B
1791 #define S_BUILDINFO 0x114C
1792 #define S_INLINESITE 0x114D
1793 #define S_INLINESITE_END 0x114E
1794 #define S_PROC_ID_END 0x114F
1795 #define S_DEFRANGE_HLSL 0x1150
1796 #define S_GDATA_HLSL 0x1151
1797 #define S_LDATA_HLSL 0x1152
1798
1799 #define S_FILESTATIC 0x1153
1800 #define S_ARMSWITCHTABLE 0x1159
1801 #define S_CALLEES 0x115A
1802 #define S_CALLERS 0x115B
1803 #define S_POGODATA 0x115C
1804 #define S_INLINESITE2 0x115D
1805 #define S_HEAPALLOCSITE 0x115E
1806 #define S_MOD_TYPEREF 0x115F
1807 #define S_REF_MINIPDB 0x1160
1808 #define S_PDBMAP 0x1161
1809 #define S_GDATA_HLSL32 0x1162
1810 #define S_LDATA_HLSL32 0x1163
1811 #define S_GDATA_HLSL32_EX 0x1164
1812 #define S_LDATA_HLSL32_EX 0x1165
1813
1814 /* ======================================== *
1815 * Line number information
1816 * ======================================== */
1817
1818 struct codeview_linetab_block
1819 {
1820 unsigned short seg;
1821 unsigned short num_lines;
1822 unsigned int offsets[1]; /* in fact num_lines */
1823 /* unsigned short linenos[]; */
1824 };
1825
1826 struct startend
1827 {
1828 unsigned int start;
1829 unsigned int end;
1830 };
1831
1832 #define LT2_LINES_BLOCK 0x000000f2
1833 #define LT2_FILES_BLOCK 0x000000f4
1834
1835 /* there's a new line tab structure from MS Studio 2005 and after
1836 * it's made of a list of codeview_linetab2 blocks.
1837 * We've only seen (so far) list with a single LT2_FILES_BLOCK and several
1838 * LT2_LINES_BLOCK. The LT2_FILES block has been encountered either as first
1839 * or last block of the list.
1840 * A LT2_FILES contains one or several codeview_linetab2_file:s
1841 */
1842
1843 struct codeview_linetab2
1844 {
1845 DWORD header;
1846 DWORD size_of_block;
1847 };
1848
codeview_linetab2_next_block(const struct codeview_linetab2 * lt2)1849 static inline const struct codeview_linetab2* codeview_linetab2_next_block(const struct codeview_linetab2* lt2)
1850 {
1851 return (const struct codeview_linetab2*)((const char*)(lt2 + 1) + lt2->size_of_block);
1852 }
1853
1854 struct codeview_linetab2_file
1855 {
1856 DWORD offset; /* offset in string table for filename */
1857 WORD unk; /* always 0x0110... type of following information ??? */
1858 BYTE md5[16]; /* MD5 signature of file (signature on file's content or name ???) */
1859 WORD pad0; /* always 0 */
1860 };
1861
1862 struct codeview_lt2blk_files
1863 {
1864 struct codeview_linetab2 lt2; /* LT2_FILES */
1865 struct codeview_linetab2_file file[1];
1866 };
1867
1868 struct codeview_lt2blk_lines
1869 {
1870 struct codeview_linetab2 lt2; /* LT2_LINE_BLOCK */
1871 DWORD start; /* start address of function with line numbers */
1872 DWORD seg; /* segment of function with line numbers */
1873 DWORD size; /* size of function with line numbers */
1874 DWORD file_offset; /* offset for accessing corresponding codeview_linetab2_file */
1875 DWORD nlines; /* number of lines in this block */
1876 DWORD size_lines; /* number of bytes following for line number information */
1877 struct {
1878 DWORD offset; /* offset (from <seg>:<start>) for line number */
1879 DWORD lineno; /* the line number (OR:ed with 0x80000000 why ???) */
1880 } l[1]; /* actually array of <nlines> */
1881 };
1882
1883 /* ======================================== *
1884 * PDB file information
1885 * ======================================== */
1886
1887
1888 struct PDB_FILE
1889 {
1890 DWORD size;
1891 DWORD unknown;
1892 };
1893
1894 struct PDB_JG_HEADER
1895 {
1896 CHAR ident[40];
1897 DWORD signature;
1898 DWORD block_size;
1899 WORD free_list;
1900 WORD total_alloc;
1901 struct PDB_FILE toc;
1902 WORD toc_block[1];
1903 };
1904
1905 struct PDB_DS_HEADER
1906 {
1907 char signature[32];
1908 DWORD block_size;
1909 DWORD unknown1;
1910 DWORD num_pages;
1911 DWORD toc_size;
1912 DWORD unknown2;
1913 DWORD toc_page;
1914 };
1915
1916 struct PDB_JG_TOC
1917 {
1918 DWORD num_files;
1919 struct PDB_FILE file[1];
1920 };
1921
1922 struct PDB_DS_TOC
1923 {
1924 DWORD num_files;
1925 DWORD file_size[1];
1926 };
1927
1928 struct PDB_JG_ROOT
1929 {
1930 DWORD Version;
1931 DWORD TimeDateStamp;
1932 DWORD Age;
1933 DWORD cbNames;
1934 CHAR names[1];
1935 };
1936
1937 struct PDB_DS_ROOT
1938 {
1939 DWORD Version;
1940 DWORD TimeDateStamp;
1941 DWORD Age;
1942 GUID guid;
1943 DWORD cbNames;
1944 CHAR names[1];
1945 };
1946
1947 typedef struct _PDB_TYPES_OLD
1948 {
1949 DWORD version;
1950 WORD first_index;
1951 WORD last_index;
1952 DWORD type_size;
1953 WORD file;
1954 WORD pad;
1955 } PDB_TYPES_OLD, *PPDB_TYPES_OLD;
1956
1957 typedef struct _PDB_TYPES
1958 {
1959 DWORD version;
1960 DWORD type_offset;
1961 DWORD first_index;
1962 DWORD last_index;
1963 DWORD type_size;
1964 WORD file;
1965 WORD pad;
1966 DWORD hash_size;
1967 DWORD hash_base;
1968 DWORD hash_offset;
1969 DWORD hash_len;
1970 DWORD search_offset;
1971 DWORD search_len;
1972 DWORD unknown_offset;
1973 DWORD unknown_len;
1974 } PDB_TYPES, *PPDB_TYPES;
1975
1976 typedef struct _PDB_SYMBOL_RANGE
1977 {
1978 WORD segment;
1979 WORD pad1;
1980 DWORD offset;
1981 DWORD size;
1982 DWORD characteristics;
1983 WORD index;
1984 WORD pad2;
1985 } PDB_SYMBOL_RANGE, *PPDB_SYMBOL_RANGE;
1986
1987 typedef struct _PDB_SYMBOL_RANGE_EX
1988 {
1989 WORD segment;
1990 WORD pad1;
1991 DWORD offset;
1992 DWORD size;
1993 DWORD characteristics;
1994 WORD index;
1995 WORD pad2;
1996 DWORD timestamp;
1997 DWORD unknown;
1998 } PDB_SYMBOL_RANGE_EX, *PPDB_SYMBOL_RANGE_EX;
1999
2000 typedef struct _PDB_SYMBOL_FILE
2001 {
2002 DWORD unknown1;
2003 PDB_SYMBOL_RANGE range;
2004 WORD flag;
2005 WORD file;
2006 DWORD symbol_size;
2007 DWORD lineno_size;
2008 DWORD unknown2;
2009 DWORD nSrcFiles;
2010 DWORD attribute;
2011 CHAR filename[1];
2012 } PDB_SYMBOL_FILE, *PPDB_SYMBOL_FILE;
2013
2014 typedef struct _PDB_SYMBOL_FILE_EX
2015 {
2016 DWORD unknown1;
2017 PDB_SYMBOL_RANGE_EX range;
2018 WORD flag;
2019 WORD file;
2020 DWORD symbol_size;
2021 DWORD lineno_size;
2022 DWORD unknown2;
2023 DWORD nSrcFiles;
2024 DWORD attribute;
2025 DWORD reserved[2];
2026 CHAR filename[1];
2027 } PDB_SYMBOL_FILE_EX, *PPDB_SYMBOL_FILE_EX;
2028
2029 typedef struct _PDB_SYMBOL_SOURCE
2030 {
2031 WORD nModules;
2032 WORD nSrcFiles;
2033 WORD table[1];
2034 } PDB_SYMBOL_SOURCE, *PPDB_SYMBOL_SOURCE;
2035
2036 typedef struct _PDB_SYMBOL_IMPORT
2037 {
2038 DWORD unknown1;
2039 DWORD unknown2;
2040 DWORD TimeDateStamp;
2041 DWORD Age;
2042 CHAR filename[1];
2043 } PDB_SYMBOL_IMPORT, *PPDB_SYMBOL_IMPORT;
2044
2045 typedef struct _PDB_SYMBOLS_OLD
2046 {
2047 WORD hash1_file;
2048 WORD hash2_file;
2049 WORD gsym_file;
2050 WORD pad;
2051 DWORD module_size;
2052 DWORD offset_size;
2053 DWORD hash_size;
2054 DWORD srcmodule_size;
2055 } PDB_SYMBOLS_OLD, *PPDB_SYMBOLS_OLD;
2056
2057 typedef struct _PDB_SYMBOLS
2058 {
2059 DWORD signature;
2060 DWORD version;
2061 DWORD unknown;
2062 DWORD hash1_file;
2063 DWORD hash2_file;
2064 WORD gsym_file;
2065 WORD unknown1;
2066 DWORD module_size;
2067 DWORD offset_size;
2068 DWORD hash_size;
2069 DWORD srcmodule_size;
2070 DWORD pdbimport_size;
2071 DWORD resvd0;
2072 DWORD stream_index_size;
2073 DWORD unknown2_size;
2074 WORD resvd3;
2075 WORD machine;
2076 DWORD resvd4;
2077 } PDB_SYMBOLS, *PPDB_SYMBOLS;
2078
2079 typedef struct
2080 {
2081 WORD FPO;
2082 WORD unk0;
2083 WORD unk1;
2084 WORD unk2;
2085 WORD unk3;
2086 WORD segments;
2087 } PDB_STREAM_INDEXES_OLD;
2088
2089 typedef struct
2090 {
2091 WORD FPO;
2092 WORD unk0;
2093 WORD unk1;
2094 WORD unk2;
2095 WORD unk3;
2096 WORD segments;
2097 WORD unk4;
2098 WORD unk5;
2099 WORD unk6;
2100 WORD FPO_EXT;
2101 WORD unk7;
2102 } PDB_STREAM_INDEXES;
2103
2104 typedef struct _PDB_FPO_DATA
2105 {
2106 DWORD start;
2107 DWORD func_size;
2108 DWORD locals_size;
2109 DWORD params_size;
2110 DWORD maxstack_size;
2111 DWORD str_offset;
2112 WORD prolog_size;
2113 WORD savedregs_size;
2114 #define PDB_FPO_DFL_SEH 0x00000001
2115 #define PDB_FPO_DFL_EH 0x00000002
2116 #define PDB_FPO_DFL_IN_BLOCK 0x00000004
2117 DWORD flags;
2118 } PDB_FPO_DATA;
2119
2120 #include "poppack.h"
2121
2122 /* ----------------------------------------------
2123 * Information used for parsing
2124 * ---------------------------------------------- */
2125
2126 typedef struct
2127 {
2128 DWORD from;
2129 DWORD to;
2130 } OMAP_DATA;
2131
2132 struct msc_debug_info
2133 {
2134 struct module* module;
2135 int nsect;
2136 const IMAGE_SECTION_HEADER* sectp;
2137 int nomap;
2138 const OMAP_DATA* omapp;
2139 const BYTE* root;
2140 };
2141
2142 /* coff.c */
2143 extern BOOL coff_process_info(const struct msc_debug_info* msc_dbg);
2144
2145 /* ===================================================
2146 * The old CodeView stuff (for NB09 and NB11)
2147 * =================================================== */
2148
2149 #define sstModule 0x120
2150 #define sstTypes 0x121
2151 #define sstPublic 0x122
2152 #define sstPublicSym 0x123
2153 #define sstSymbols 0x124
2154 #define sstAlignSym 0x125
2155 #define sstSrcLnSeg 0x126
2156 #define sstSrcModule 0x127
2157 #define sstLibraries 0x128
2158 #define sstGlobalSym 0x129
2159 #define sstGlobalPub 0x12a
2160 #define sstGlobalTypes 0x12b
2161 #define sstMPC 0x12c
2162 #define sstSegMap 0x12d
2163 #define sstSegName 0x12e
2164 #define sstPreComp 0x12f
2165 #define sstFileIndex 0x133
2166 #define sstStaticSym 0x134
2167
2168 /* overall structure information */
2169 typedef struct OMFSignature
2170 {
2171 char Signature[4];
2172 long filepos;
2173 } OMFSignature;
2174
2175 typedef struct OMFSignatureRSDS
2176 {
2177 char Signature[4];
2178 GUID guid;
2179 DWORD age;
2180 CHAR name[1];
2181 } OMFSignatureRSDS;
2182
2183 typedef struct _CODEVIEW_PDB_DATA
2184 {
2185 char Signature[4];
2186 long filepos;
2187 DWORD timestamp;
2188 DWORD age;
2189 CHAR name[1];
2190 } CODEVIEW_PDB_DATA, *PCODEVIEW_PDB_DATA;
2191
2192 typedef struct OMFDirHeader
2193 {
2194 WORD cbDirHeader;
2195 WORD cbDirEntry;
2196 DWORD cDir;
2197 DWORD lfoNextDir;
2198 DWORD flags;
2199 } OMFDirHeader;
2200
2201 typedef struct OMFDirEntry
2202 {
2203 WORD SubSection;
2204 WORD iMod;
2205 DWORD lfo;
2206 DWORD cb;
2207 } OMFDirEntry;
2208
2209 /* sstModule subsection */
2210
2211 typedef struct OMFSegDesc
2212 {
2213 WORD Seg;
2214 WORD pad;
2215 DWORD Off;
2216 DWORD cbSeg;
2217 } OMFSegDesc;
2218
2219 typedef struct OMFModule
2220 {
2221 WORD ovlNumber;
2222 WORD iLib;
2223 WORD cSeg;
2224 char Style[2];
2225 /*
2226 OMFSegDesc SegInfo[cSeg];
2227 p_string Name;
2228 */
2229 } OMFModule;
2230
2231 typedef struct OMFGlobalTypes
2232 {
2233 DWORD flags;
2234 DWORD cTypes;
2235 /*
2236 DWORD offset[cTypes];
2237 types_record[];
2238 */
2239 } OMFGlobalTypes;
2240
2241 /* sstGlobalPub section */
2242
2243 /* Header for symbol table */
2244 typedef struct OMFSymHash
2245 {
2246 unsigned short symhash;
2247 unsigned short addrhash;
2248 unsigned long cbSymbol;
2249 unsigned long cbHSym;
2250 unsigned long cbHAddr;
2251 } OMFSymHash;
2252
2253 /* sstSegMap section */
2254
2255 typedef struct OMFSegMapDesc
2256 {
2257 unsigned short flags;
2258 unsigned short ovl;
2259 unsigned short group;
2260 unsigned short frame;
2261 unsigned short iSegName;
2262 unsigned short iClassName;
2263 unsigned long offset;
2264 unsigned long cbSeg;
2265 } OMFSegMapDesc;
2266
2267 typedef struct OMFSegMap
2268 {
2269 unsigned short cSeg;
2270 unsigned short cSegLog;
2271 /* OMFSegMapDesc rgDesc[0];*/
2272 } OMFSegMap;
2273
2274
2275 /* sstSrcModule section */
2276
2277 typedef struct OMFSourceLine
2278 {
2279 unsigned short Seg;
2280 unsigned short cLnOff;
2281 unsigned long offset[1];
2282 unsigned short lineNbr[1];
2283 } OMFSourceLine;
2284
2285 typedef struct OMFSourceFile
2286 {
2287 unsigned short cSeg;
2288 unsigned short reserved;
2289 unsigned long baseSrcLn[1];
2290 unsigned short cFName;
2291 char Name;
2292 } OMFSourceFile;
2293
2294 typedef struct OMFSourceModule
2295 {
2296 unsigned short cFile;
2297 unsigned short cSeg;
2298 unsigned long baseSrcFile[1];
2299 } OMFSourceModule;
2300