resources: Change Dutch sublanguage code to SUBLANG_NEUTRAL.
[wine] / dlls / dbghelp / 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 greated 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                unknown1; /* could be this_type ??? */
347         unsigned int            class_type;
348         unsigned int            rvtype;
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 };
407
408 union codeview_fieldtype
409 {
410     struct
411     {
412         short int               id;
413     } generic;
414
415     struct
416     {
417         short int               id;
418         short int               type;
419         short int               attribute;
420         unsigned short int      offset;     /* numeric leaf */
421     } bclass_v1;
422
423     struct
424     {
425         short int               id;
426         short int               attribute;
427         unsigned int            type;
428         unsigned short int      offset;     /* numeric leaf */
429     } bclass_v2;
430
431     struct
432     {
433         short int               id;
434         short int               btype;
435         short int               vbtype;
436         short int               attribute;
437         unsigned short int      vbpoff;     /* numeric leaf */
438 #if 0
439         unsigned short int      vboff;      /* numeric leaf */
440 #endif
441     } vbclass_v1;
442
443     struct
444     {
445         short int               id;
446         short int               attribute;
447         unsigned int            btype;
448         unsigned int            vbtype;
449         unsigned short int      vbpoff;     /* numeric leaf */
450 #if 0
451         unsigned short int      vboff;      /* numeric leaf */
452 #endif
453     } vbclass_v2;
454
455     struct
456     {
457         short int               id;
458         short int               attribute;
459         unsigned short int      value;     /* numeric leaf */
460 #if 0
461         struct p_string         p_name;
462 #endif
463     } enumerate_v1;
464
465    struct
466     {
467         short int               id;
468         short int               attribute;
469         unsigned short int      value;     /* numeric leaf */
470 #if 0
471         char                    name[1];
472 #endif
473     } enumerate_v3;
474
475     struct
476     {
477         short int               id;
478         short int               type;
479         struct p_string         p_name;
480     } friendfcn_v1;
481
482     struct
483     {
484         short int               id;
485         short int               _pad0;
486         unsigned int            type;
487         struct p_string         p_name;
488     } friendfcn_v2;
489
490     struct
491     {
492         short int               id;
493         short int               type;
494         short int               attribute;
495         unsigned short int      offset;    /* numeric leaf */
496 #if 0
497         struct p_string         p_name;
498 #endif
499     } member_v1;
500
501     struct
502     {
503         short int               id;
504         short int               attribute;
505         unsigned int            type;
506         unsigned short int      offset;    /* numeric leaf */
507 #if 0
508         struct p_string         p_name;
509 #endif
510     } member_v2;
511
512     struct
513     {
514         short int               id;
515         short int               attribute;
516         unsigned int            type;
517         unsigned short int      offset; /* numeric leaf */
518 #if 0
519         unsigned char           name[1];
520 #endif
521     }
522     member_v3;
523
524     struct
525     {
526         short int               id;
527         short int               type;
528         short int               attribute;
529         struct p_string         p_name;
530     } stmember_v1;
531
532     struct
533     {
534         short int               id;
535         short int               attribute;
536         unsigned int            type;
537         struct p_string         p_name;
538     } stmember_v2;
539
540     struct
541     {
542         short int               id;
543         short int               count;
544         short int               mlist;
545         struct p_string         p_name;
546     } method_v1;
547
548     struct
549     {
550         short int               id;
551         short int               count;
552         unsigned int            mlist;
553         struct p_string         p_name;
554     } method_v2;
555
556     struct
557     {
558         short int               id;
559         short int               index;
560         struct p_string         p_name;
561     } nesttype_v1;
562
563     struct
564     {
565         short int               id;
566         short int               _pad0;
567         unsigned int            index;
568         struct p_string         p_name;
569     } nesttype_v2;
570
571     struct
572     {
573         short int               id;
574         short int               type;
575     } vfunctab_v1;
576
577     struct
578     {
579         short int               id;
580         short int               _pad0;
581         unsigned int            type;
582     } vfunctab_v2;
583
584     struct
585     {
586         short int               id;
587         short int               type;
588     } friendcls_v1;
589
590     struct
591     {
592         short int               id;
593         short int               _pad0;
594         unsigned int            type;
595     } friendcls_v2;
596
597     struct
598     {
599         short int               id;
600         short int               attribute;
601         short int               type;
602         struct p_string         p_name;
603     } onemethod_v1;
604
605     struct
606     {
607         short int               id;
608         short int               attribute;
609         short int               type;
610         unsigned int            vtab_offset;
611         struct p_string         p_name;
612     } onemethod_virt_v1;
613
614     struct
615     {
616         short int               id;
617         short int               attribute;
618         unsigned int            type;
619         struct p_string         p_name;
620     } onemethod_v2;
621
622     struct
623     {
624         short int               id;
625         short int               attribute;
626         unsigned int            type;
627         unsigned int            vtab_offset;
628         struct p_string         p_name;
629     } onemethod_virt_v2;
630
631     struct
632     {
633         short int               id;
634         short int               type;
635         unsigned int            offset;
636     } vfuncoff_v1;
637
638     struct
639     {
640         short int               id;
641         short int               _pad0;
642         unsigned int            type;
643         unsigned int            offset;
644     } vfuncoff_v2;
645
646     struct
647     {
648         short int               id;
649         short int               attribute;
650         short int               index;
651         struct p_string         p_name;
652     } nesttypeex_v1;
653
654     struct
655     {
656         short int               id;
657         short int               attribute;
658         unsigned int            index;
659         struct p_string         p_name;
660     } nesttypeex_v2;
661
662     struct
663     {
664         short int               id;
665         short int               attribute;
666         unsigned int            type;
667         struct p_string         p_name;
668     } membermodify_v2;
669
670 };
671
672
673 /*
674  * This covers the basic datatypes that VC++ seems to be using these days.
675  * 32 bit mode only.  There are additional numbers for the pointers in 16
676  * bit mode.  There are many other types listed in the documents, but these
677  * are apparently not used by the compiler, or represent pointer types
678  * that are not used.
679  */
680 #define T_NOTYPE                0x0000  /* Notype */
681 #define T_ABS                   0x0001  /* Abs */
682 #define T_VOID                  0x0003  /* Void */
683 #define T_CHAR                  0x0010  /* signed char */
684 #define T_SHORT                 0x0011  /* short */
685 #define T_LONG                  0x0012  /* long */
686 #define T_QUAD                  0x0013  /* long long */
687 #define T_UCHAR                 0x0020  /* unsigned  char */
688 #define T_USHORT                0x0021  /* unsigned short */
689 #define T_ULONG                 0x0022  /* unsigned long */
690 #define T_UQUAD                 0x0023  /* unsigned long long */
691 #define T_REAL32                0x0040  /* float */
692 #define T_REAL64                0x0041  /* double */
693 #define T_RCHAR                 0x0070  /* real char */
694 #define T_WCHAR                 0x0071  /* wide char */
695 #define T_INT4                  0x0074  /* int */
696 #define T_UINT4                 0x0075  /* unsigned int */
697
698 #define T_32PVOID               0x0403  /* 32 bit near pointer to void */
699 #define T_32PCHAR               0x0410  /* 16:32 near pointer to signed char */
700 #define T_32PSHORT              0x0411  /* 16:32 near pointer to short */
701 #define T_32PLONG               0x0412  /* 16:32 near pointer to int */
702 #define T_32PQUAD               0x0413  /* 16:32 near pointer to long long */
703 #define T_32PUCHAR              0x0420  /* 16:32 near pointer to unsigned char */
704 #define T_32PUSHORT             0x0421  /* 16:32 near pointer to unsigned short */
705 #define T_32PULONG              0x0422  /* 16:32 near pointer to unsigned int */
706 #define T_32PUQUAD              0x0423  /* 16:32 near pointer to long long */
707 #define T_32PREAL32             0x0440  /* 16:32 near pointer to float */
708 #define T_32PREAL64             0x0441  /* 16:32 near pointer to float */
709 #define T_32PRCHAR              0x0470  /* 16:32 near pointer to real char */
710 #define T_32PWCHAR              0x0471  /* 16:32 near pointer to real char */
711 #define T_32PINT4               0x0474  /* 16:32 near pointer to int */
712 #define T_32PUINT4              0x0475  /* 16:32 near pointer to unsigned int */
713
714
715 #define LF_MODIFIER_V1          0x0001
716 #define LF_POINTER_V1           0x0002
717 #define LF_ARRAY_V1             0x0003
718 #define LF_CLASS_V1             0x0004
719 #define LF_STRUCTURE_V1         0x0005
720 #define LF_UNION_V1             0x0006
721 #define LF_ENUM_V1              0x0007
722 #define LF_PROCEDURE_V1         0x0008
723 #define LF_MFUNCTION_V1         0x0009
724 #define LF_VTSHAPE_V1           0x000a
725 #define LF_COBOL0_V1            0x000b
726 #define LF_COBOL1_V1            0x000c
727 #define LF_BARRAY_V1            0x000d
728 #define LF_LABEL_V1             0x000e
729 #define LF_NULL_V1              0x000f
730 #define LF_NOTTRAN_V1           0x0010
731 #define LF_DIMARRAY_V1          0x0011
732 #define LF_VFTPATH_V1           0x0012
733 #define LF_PRECOMP_V1           0x0013
734 #define LF_ENDPRECOMP_V1        0x0014
735 #define LF_OEM_V1               0x0015
736 #define LF_TYPESERVER_V1        0x0016
737
738 #define LF_MODIFIER_V2          0x1001     /* variants with new 32-bit type indices (V2) */
739 #define LF_POINTER_V2           0x1002
740 #define LF_ARRAY_V2             0x1003
741 #define LF_CLASS_V2             0x1004
742 #define LF_STRUCTURE_V2         0x1005
743 #define LF_UNION_V2             0x1006
744 #define LF_ENUM_V2              0x1007
745 #define LF_PROCEDURE_V2         0x1008
746 #define LF_MFUNCTION_V2         0x1009
747 #define LF_COBOL0_V2            0x100a
748 #define LF_BARRAY_V2            0x100b
749 #define LF_DIMARRAY_V2          0x100c
750 #define LF_VFTPATH_V2           0x100d
751 #define LF_PRECOMP_V2           0x100e
752 #define LF_OEM_V2               0x100f
753
754 #define LF_SKIP_V1              0x0200
755 #define LF_ARGLIST_V1           0x0201
756 #define LF_DEFARG_V1            0x0202
757 #define LF_LIST_V1              0x0203
758 #define LF_FIELDLIST_V1         0x0204
759 #define LF_DERIVED_V1           0x0205
760 #define LF_BITFIELD_V1          0x0206
761 #define LF_METHODLIST_V1        0x0207
762 #define LF_DIMCONU_V1           0x0208
763 #define LF_DIMCONLU_V1          0x0209
764 #define LF_DIMVARU_V1           0x020a
765 #define LF_DIMVARLU_V1          0x020b
766 #define LF_REFSYM_V1            0x020c
767
768 #define LF_SKIP_V2              0x1200    /* variants with new 32-bit type indices (V2) */
769 #define LF_ARGLIST_V2           0x1201
770 #define LF_DEFARG_V2            0x1202
771 #define LF_FIELDLIST_V2         0x1203
772 #define LF_DERIVED_V2           0x1204
773 #define LF_BITFIELD_V2          0x1205
774 #define LF_METHODLIST_V2        0x1206
775 #define LF_DIMCONU_V2           0x1207
776 #define LF_DIMCONLU_V2          0x1208
777 #define LF_DIMVARU_V2           0x1209
778 #define LF_DIMVARLU_V2          0x120a
779
780 /* Field lists */
781 #define LF_BCLASS_V1            0x0400
782 #define LF_VBCLASS_V1           0x0401
783 #define LF_IVBCLASS_V1          0x0402
784 #define LF_ENUMERATE_V1         0x0403
785 #define LF_FRIENDFCN_V1         0x0404
786 #define LF_INDEX_V1             0x0405
787 #define LF_MEMBER_V1            0x0406
788 #define LF_STMEMBER_V1          0x0407
789 #define LF_METHOD_V1            0x0408
790 #define LF_NESTTYPE_V1          0x0409
791 #define LF_VFUNCTAB_V1          0x040a
792 #define LF_FRIENDCLS_V1         0x040b
793 #define LF_ONEMETHOD_V1         0x040c
794 #define LF_VFUNCOFF_V1          0x040d
795 #define LF_NESTTYPEEX_V1        0x040e
796 #define LF_MEMBERMODIFY_V1      0x040f
797
798 #define LF_BCLASS_V2            0x1400    /* variants with new 32-bit type indices (V2) */
799 #define LF_VBCLASS_V2           0x1401
800 #define LF_IVBCLASS_V2          0x1402
801 #define LF_FRIENDFCN_V2         0x1403
802 #define LF_INDEX_V2             0x1404
803 #define LF_MEMBER_V2            0x1405
804 #define LF_STMEMBER_V2          0x1406
805 #define LF_METHOD_V2            0x1407
806 #define LF_NESTTYPE_V2          0x1408
807 #define LF_VFUNCTAB_V2          0x1409
808 #define LF_FRIENDCLS_V2         0x140a
809 #define LF_ONEMETHOD_V2         0x140b
810 #define LF_VFUNCOFF_V2          0x140c
811 #define LF_NESTTYPEEX_V2        0x140d
812
813 #define LF_ENUMERATE_V3         0x1502
814 #define LF_ARRAY_V3             0x1503
815 #define LF_CLASS_V3             0x1504
816 #define LF_STRUCTURE_V3         0x1505
817 #define LF_UNION_V3             0x1506
818 #define LF_ENUM_V3              0x1507
819 #define LF_MEMBER_V3            0x150d
820
821 #define LF_NUMERIC              0x8000    /* numeric leaf types */
822 #define LF_CHAR                 0x8000
823 #define LF_SHORT                0x8001
824 #define LF_USHORT               0x8002
825 #define LF_LONG                 0x8003
826 #define LF_ULONG                0x8004
827 #define LF_REAL32               0x8005
828 #define LF_REAL64               0x8006
829 #define LF_REAL80               0x8007
830 #define LF_REAL128              0x8008
831 #define LF_QUADWORD             0x8009
832 #define LF_UQUADWORD            0x800a
833 #define LF_REAL48               0x800b
834 #define LF_COMPLEX32            0x800c
835 #define LF_COMPLEX64            0x800d
836 #define LF_COMPLEX80            0x800e
837 #define LF_COMPLEX128           0x800f
838 #define LF_VARSTRING            0x8010
839
840 /* ======================================== *
841  *            Symbol information
842  * ======================================== */
843
844 union codeview_symbol
845 {
846     struct
847     {
848         short int               len;
849         short int               id;
850     } generic;
851
852     struct
853     {
854         short int               len;
855         short int               id;
856         unsigned int            offset;
857         unsigned short          segment;
858         unsigned short          symtype;
859         struct p_string         p_name;
860     } data_v1;
861
862     struct
863     {
864         short int               len;
865         short int               id;
866         unsigned int            symtype;
867         unsigned int            offset;
868         unsigned short          segment;
869         struct p_string         p_name;
870     } data_v2;
871
872     struct
873     {
874         short int               len;
875         short int               id;
876         unsigned int            symtype;
877         unsigned int            offset;
878         unsigned short          segment;
879         char                    name[1];
880     } data_v3;
881
882     struct
883     {
884         short int               len;
885         short int               id;
886         unsigned int            pparent;
887         unsigned int            pend;
888         unsigned int            next;
889         unsigned int            offset;
890         unsigned short          segment;
891         unsigned short          thunk_len;
892         unsigned char           thtype;
893         struct p_string         p_name;
894     } thunk_v1;
895
896     struct
897     {
898         short int               len;
899         short int               id;
900         unsigned int            pparent;
901         unsigned int            pend;
902         unsigned int            next;
903         unsigned int            offset;
904         unsigned short          segment;
905         unsigned short          thunk_len;
906         unsigned char           thtype;
907         char                    name[1];
908     } thunk_v3;
909
910     struct
911     {
912         short int               len;
913         short int               id;
914         unsigned int            pparent;
915         unsigned int            pend;
916         unsigned int            next;
917         unsigned int            proc_len;
918         unsigned int            debug_start;
919         unsigned int            debug_end;
920         unsigned int            offset;
921         unsigned short          segment;
922         unsigned short          proctype;
923         unsigned char           flags;
924         struct p_string         p_name;
925     } proc_v1;
926
927     struct
928     {
929         short int               len;
930         short int               id;
931         unsigned int            pparent;
932         unsigned int            pend;
933         unsigned int            next;
934         unsigned int            proc_len;
935         unsigned int            debug_start;
936         unsigned int            debug_end;
937         unsigned int            proctype;
938         unsigned int            offset;
939         unsigned short          segment;
940         unsigned char           flags;
941         struct p_string         p_name;
942     } proc_v2;
943
944     struct
945     {
946         short int               len;
947         short int               id;
948         unsigned int            pparent;
949         unsigned int            pend;
950         unsigned int            next;
951         unsigned int            proc_len;
952         unsigned int            debug_start;
953         unsigned int            debug_end;
954         unsigned int            proctype;
955         unsigned int            offset;
956         unsigned short          segment;
957         unsigned char           flags;
958         char                    name[1];
959     } proc_v3;
960
961     struct
962     {
963         short int               len;            /* Total length of this entry */
964         short int               id;             /* Always S_BPREL_V1 */
965         unsigned int            offset;         /* Stack offset relative to BP */
966         unsigned short          symtype;
967         struct p_string         p_name;
968     } stack_v1;
969
970     struct
971     {
972         short int               len;            /* Total length of this entry */
973         short int               id;             /* Always S_BPREL_V2 */
974         unsigned int            offset;         /* Stack offset relative to EBP */
975         unsigned int            symtype;
976         struct p_string         p_name;
977     } stack_v2;
978
979     struct
980     {
981         short int               len;            /* Total length of this entry */
982         short int               id;             /* Always S_BPREL_V3 */
983         int                     offset;         /* Stack offset relative to BP */
984         unsigned int            symtype;
985         char                    name[1];
986     } stack_v3;
987
988     struct
989     {
990         short int               len;            /* Total length of this entry */
991         short int               id;             /* Always S_REGISTER */
992         unsigned short          type;
993         unsigned short          reg;
994         struct p_string         p_name;
995         /* don't handle register tracking */
996     } register_v1;
997
998     struct
999     {
1000         short int               len;            /* Total length of this entry */
1001         short int               id;             /* Always S_REGISTER_V2 */
1002         unsigned int            type;           /* check whether type & reg are correct */
1003         unsigned short          reg;
1004         struct p_string         p_name;
1005         /* don't handle register tracking */
1006     } register_v2;
1007
1008     struct
1009     {
1010         short int               len;
1011         short int               id;
1012         unsigned int            parent;
1013         unsigned int            end;
1014         unsigned int            length;
1015         unsigned int            offset;
1016         unsigned short          segment;
1017         struct p_string         p_name;
1018     } block_v1;
1019
1020     struct
1021     {
1022         short int               len;
1023         short int               id;
1024         unsigned int            parent;
1025         unsigned int            end;
1026         unsigned int            length;
1027         unsigned int            offset;
1028         unsigned short          segment;
1029         char                    name[1];
1030     } block_v3;
1031
1032     struct
1033     {
1034         short int               len;
1035         short int               id;
1036         unsigned int            offset;
1037         unsigned short          segment;
1038         unsigned char           flags;
1039         struct p_string         p_name;
1040     } label_v1;
1041
1042     struct
1043     {
1044         short int               len;
1045         short int               id;
1046         unsigned int            offset;
1047         unsigned short          segment;
1048         unsigned char           flags;
1049         char                    name[1];
1050     } label_v3;
1051
1052     struct
1053     {
1054         short int               len;
1055         short int               id;
1056         unsigned short          type;
1057         unsigned short          cvalue;         /* numeric leaf */
1058 #if 0
1059         struct p_string         p_name;
1060 #endif
1061     } constant_v1;
1062
1063     struct
1064     {
1065         short int               len;
1066         short int               id;
1067         unsigned                type;
1068         unsigned short          cvalue;         /* numeric leaf */
1069 #if 0
1070         struct p_string         p_name;
1071 #endif
1072     } constant_v2;
1073
1074     struct
1075     {
1076         short int               len;
1077         short int               id;
1078         unsigned                type;
1079         unsigned short          cvalue;
1080 #if 0
1081         char                    name[1];
1082 #endif
1083     } constant_v3;
1084
1085     struct
1086     {
1087         short int               len;
1088         short int               id;
1089         unsigned short          type;
1090         struct p_string         p_name;
1091     } udt_v1;
1092
1093     struct
1094     {
1095         short int               len;
1096         short int               id;
1097         unsigned                type;
1098         struct p_string         p_name;
1099     } udt_v2;
1100
1101     struct
1102     {
1103         short int               len;
1104         short int               id;
1105         unsigned int            type;
1106         char                    name[1];
1107     } udt_v3;
1108
1109     struct
1110     {
1111         short int               len;
1112         short int               id;
1113         char                    signature[4];
1114         struct p_string         p_name;
1115     } objname_v1;
1116
1117     struct
1118     {
1119         short int               len;
1120         short int               id;
1121         unsigned int            unknown;
1122         struct p_string         p_name;
1123     } compile_v1;
1124
1125     struct
1126     {
1127         short int               len;
1128         short int               id;
1129         unsigned                unknown1[4];
1130         unsigned short          unknown2;
1131         struct p_string         p_name;
1132     } compile_v2;
1133
1134     struct
1135     {
1136         short int               len;
1137         short int               id;
1138         unsigned int            unknown;
1139         char                    name[1];
1140     } compile_v3;
1141
1142     struct
1143     {
1144         short int               len;
1145         short int               id;
1146         unsigned int            offset;
1147         unsigned short          segment;
1148     } ssearch_v1;
1149 };
1150
1151 #define S_COMPILE_V1    0x0001
1152 #define S_REGISTER_V1   0x0002
1153 #define S_CONSTANT_V1   0x0003
1154 #define S_UDT_V1        0x0004
1155 #define S_SSEARCH_V1    0x0005
1156 #define S_END_V1        0x0006
1157 #define S_SKIP_V1       0x0007
1158 #define S_CVRESERVE_V1  0x0008
1159 #define S_OBJNAME_V1    0x0009
1160 #define S_ENDARG_V1     0x000a
1161 #define S_COBOLUDT_V1   0x000b
1162 #define S_MANYREG_V1    0x000c
1163 #define S_RETURN_V1     0x000d
1164 #define S_ENTRYTHIS_V1  0x000e
1165
1166 #define S_BPREL_V1      0x0200
1167 #define S_LDATA_V1      0x0201
1168 #define S_GDATA_V1      0x0202
1169 #define S_PUB_V1        0x0203
1170 #define S_LPROC_V1      0x0204
1171 #define S_GPROC_V1      0x0205
1172 #define S_THUNK_V1      0x0206
1173 #define S_BLOCK_V1      0x0207
1174 #define S_WITH_V1       0x0208
1175 #define S_LABEL_V1      0x0209
1176 #define S_CEXMODEL_V1   0x020a
1177 #define S_VFTPATH_V1    0x020b
1178 #define S_REGREL_V1     0x020c
1179 #define S_LTHREAD_V1    0x020d
1180 #define S_GTHREAD_V1    0x020e
1181
1182 #define S_PROCREF_V1    0x0400
1183 #define S_DATAREF_V1    0x0401
1184 #define S_ALIGN_V1      0x0402
1185 #define S_LPROCREF_V1   0x0403
1186
1187 #define S_REGISTER_V2   0x1001 /* Variants with new 32-bit type indices */
1188 #define S_CONSTANT_V2   0x1002
1189 #define S_UDT_V2        0x1003
1190 #define S_COBOLUDT_V2   0x1004
1191 #define S_MANYREG_V2    0x1005
1192 #define S_BPREL_V2      0x1006
1193 #define S_LDATA_V2      0x1007
1194 #define S_GDATA_V2      0x1008
1195 #define S_PUB_V2        0x1009
1196 #define S_LPROC_V2      0x100a
1197 #define S_GPROC_V2      0x100b
1198 #define S_VFTTABLE_V2   0x100c
1199 #define S_REGREL_V2     0x100d
1200 #define S_LTHREAD_V2    0x100e
1201 #define S_GTHREAD_V2    0x100f
1202 #if 0
1203 #define S_XXXXXXXXX_32  0x1012  /* seems linked to a function, content unknown */
1204 #endif
1205 #define S_COMPILE_V2    0x1013
1206
1207 #define S_COMPILE_V3    0x1101
1208 #define S_THUNK_V3      0x1102
1209 #define S_BLOCK_V3      0x1103
1210 #define S_LABEL_V3      0x1105
1211 #define S_CONSTANT_V3   0x1107
1212 #define S_UDT_V3        0x1108
1213 #define S_BPREL_V3      0x110B
1214 #define S_LDATA_V3      0x110C
1215 #define S_GDATA_V3      0x110D
1216 #define S_PUB_DATA_V3   0x110E
1217 #define S_LPROC_V3      0x110F
1218 #define S_GPROC_V3      0x1110
1219 #define S_MSTOOL_V3     0x1116  /* not really understood */
1220 #define S_PUB_FUNC1_V3  0x1125  /* didn't get the difference between the two */
1221 #define S_PUB_FUNC2_V3  0x1127
1222
1223 /* ======================================== *
1224  *          Line number information
1225  * ======================================== */
1226
1227 union any_size
1228 {
1229     const char*                 c;
1230     const unsigned char*        uc;
1231     const short*                s;
1232     const int*                  i;
1233     const unsigned int*         ui;
1234 };
1235
1236 struct startend
1237 {
1238     unsigned int                start;
1239     unsigned int                end;
1240 };
1241
1242 struct codeview_linetab
1243 {
1244     unsigned int                nline;
1245     unsigned int                segno;
1246     unsigned int                start;
1247     unsigned int                end;
1248     unsigned int                source;
1249     const unsigned short*       linetab;
1250     const unsigned int*         offtab;
1251 };
1252
1253
1254 /* ======================================== *
1255  *            PDB file information
1256  * ======================================== */
1257
1258
1259 struct PDB_FILE
1260 {
1261     DWORD               size;
1262     DWORD               unknown;
1263 };
1264
1265 struct PDB_JG_HEADER
1266 {
1267     CHAR                ident[40];
1268     DWORD               signature;
1269     DWORD               block_size;
1270     WORD                free_list;
1271     WORD                total_alloc;
1272     struct PDB_FILE     toc;
1273     WORD                toc_block[1];
1274 };
1275
1276 struct PDB_DS_HEADER
1277 {
1278     char                signature[32];
1279     DWORD               block_size;
1280     DWORD               unknown1;
1281     DWORD               num_pages;
1282     DWORD               toc_size;
1283     DWORD               unknown2;
1284     DWORD               toc_page;
1285 };
1286
1287 struct PDB_JG_TOC
1288 {
1289     DWORD               num_files;
1290     struct PDB_FILE     file[1];
1291 };
1292
1293 struct PDB_DS_TOC
1294 {
1295     DWORD               num_files;
1296     DWORD               file_size[1];
1297 };
1298
1299 struct PDB_JG_ROOT
1300 {
1301     DWORD               Version;
1302     DWORD               TimeDateStamp;
1303     DWORD               Age;
1304     DWORD               cbNames;
1305     CHAR                names[1];
1306 };
1307
1308 struct PDB_DS_ROOT
1309 {
1310     DWORD               Version;
1311     DWORD               TimeDateStamp;
1312     DWORD               Age;
1313     GUID                guid;
1314     DWORD               cbNames;
1315     CHAR                names[1];
1316 };
1317
1318 typedef struct _PDB_TYPES_OLD
1319 {
1320     DWORD       version;
1321     WORD        first_index;
1322     WORD        last_index;
1323     DWORD       type_size;
1324     WORD        file;
1325     WORD        pad;
1326 } PDB_TYPES_OLD, *PPDB_TYPES_OLD;
1327
1328 typedef struct _PDB_TYPES
1329 {
1330     DWORD       version;
1331     DWORD       type_offset;
1332     DWORD       first_index;
1333     DWORD       last_index;
1334     DWORD       type_size;
1335     WORD        file;
1336     WORD        pad;
1337     DWORD       hash_size;
1338     DWORD       hash_base;
1339     DWORD       hash_offset;
1340     DWORD       hash_len;
1341     DWORD       search_offset;
1342     DWORD       search_len;
1343     DWORD       unknown_offset;
1344     DWORD       unknown_len;
1345 } PDB_TYPES, *PPDB_TYPES;
1346
1347 typedef struct _PDB_SYMBOL_RANGE
1348 {
1349     WORD        segment;
1350     WORD        pad1;
1351     DWORD       offset;
1352     DWORD       size;
1353     DWORD       characteristics;
1354     WORD        index;
1355     WORD        pad2;
1356 } PDB_SYMBOL_RANGE, *PPDB_SYMBOL_RANGE;
1357
1358 typedef struct _PDB_SYMBOL_RANGE_EX
1359 {
1360     WORD        segment;
1361     WORD        pad1;
1362     DWORD       offset;
1363     DWORD       size;
1364     DWORD       characteristics;
1365     WORD        index;
1366     WORD        pad2;
1367     DWORD       timestamp;
1368     DWORD       unknown;
1369 } PDB_SYMBOL_RANGE_EX, *PPDB_SYMBOL_RANGE_EX;
1370
1371 typedef struct _PDB_SYMBOL_FILE
1372 {
1373     DWORD       unknown1;
1374     PDB_SYMBOL_RANGE range;
1375     WORD        flag;
1376     WORD        file;
1377     DWORD       symbol_size;
1378     DWORD       lineno_size;
1379     DWORD       unknown2;
1380     DWORD       nSrcFiles;
1381     DWORD       attribute;
1382     CHAR        filename[1];
1383 } PDB_SYMBOL_FILE, *PPDB_SYMBOL_FILE;
1384
1385 typedef struct _PDB_SYMBOL_FILE_EX
1386 {
1387     DWORD       unknown1;
1388     PDB_SYMBOL_RANGE_EX range;
1389     WORD        flag;
1390     WORD        file;
1391     DWORD       symbol_size;
1392     DWORD       lineno_size;
1393     DWORD       unknown2;
1394     DWORD       nSrcFiles;
1395     DWORD       attribute;
1396     DWORD       reserved[2];
1397     CHAR        filename[1];
1398 } PDB_SYMBOL_FILE_EX, *PPDB_SYMBOL_FILE_EX;
1399
1400 typedef struct _PDB_SYMBOL_SOURCE
1401 {
1402     WORD        nModules;
1403     WORD        nSrcFiles;
1404     WORD        table[1];
1405 } PDB_SYMBOL_SOURCE, *PPDB_SYMBOL_SOURCE;
1406
1407 typedef struct _PDB_SYMBOL_IMPORT
1408 {
1409     DWORD       unknown1;
1410     DWORD       unknown2;
1411     DWORD       TimeDateStamp;
1412     DWORD       Age;
1413     CHAR        filename[1];
1414 } PDB_SYMBOL_IMPORT, *PPDB_SYMBOL_IMPORT;
1415
1416 typedef struct _PDB_SYMBOLS_OLD
1417 {
1418     WORD        hash1_file;
1419     WORD        hash2_file;
1420     WORD        gsym_file;
1421     WORD        pad;
1422     DWORD       module_size;
1423     DWORD       offset_size;
1424     DWORD       hash_size;
1425     DWORD       srcmodule_size;
1426 } PDB_SYMBOLS_OLD, *PPDB_SYMBOLS_OLD;
1427
1428 typedef struct _PDB_SYMBOLS
1429 {
1430     DWORD       signature;
1431     DWORD       version;
1432     DWORD       unknown;
1433     DWORD       hash1_file;
1434     DWORD       hash2_file;
1435     DWORD       gsym_file;
1436     DWORD       module_size;
1437     DWORD       offset_size;
1438     DWORD       hash_size;
1439     DWORD       srcmodule_size;
1440     DWORD       pdbimport_size;
1441     DWORD       resvd[5];
1442 } PDB_SYMBOLS, *PPDB_SYMBOLS;
1443
1444 #include "poppack.h"
1445
1446 /* ----------------------------------------------
1447  * Information used for parsing
1448  * ---------------------------------------------- */
1449
1450 typedef struct
1451 {
1452     DWORD  from;
1453     DWORD  to;
1454 } OMAP_DATA;
1455
1456 struct msc_debug_info
1457 {
1458     struct module*              module;
1459     int                         nsect;
1460     const IMAGE_SECTION_HEADER* sectp;
1461     int                         nomap;
1462     const OMAP_DATA*            omapp;
1463     const BYTE*                 root;
1464 };
1465
1466 /* coff.c */
1467 extern BOOL coff_process_info(const struct msc_debug_info* msc_dbg);
1468
1469 /* ===================================================
1470  * The old CodeView stuff (for NB09 and NB11)
1471  * =================================================== */
1472
1473 #define sstModule      0x120
1474 #define sstTypes       0x121
1475 #define sstPublic      0x122
1476 #define sstPublicSym   0x123
1477 #define sstSymbols     0x124
1478 #define sstAlignSym    0x125
1479 #define sstSrcLnSeg    0x126
1480 #define sstSrcModule   0x127
1481 #define sstLibraries   0x128
1482 #define sstGlobalSym   0x129
1483 #define sstGlobalPub   0x12a
1484 #define sstGlobalTypes 0x12b
1485 #define sstMPC         0x12c
1486 #define sstSegMap      0x12d
1487 #define sstSegName     0x12e
1488 #define sstPreComp     0x12f
1489 #define sstFileIndex   0x133
1490 #define sstStaticSym   0x134
1491
1492 typedef struct _CODEVIEW_HEADER_NBxx
1493 {
1494     DWORD       dwSignature;
1495     DWORD       lfoDirectory;
1496 } CODEVIEW_HEADER_NBxx,* PCODEVIEW_HEADER_NBxx;
1497
1498 typedef struct _CODEVIEW_HEADER_RSDS
1499 {
1500     DWORD       dwSignature;
1501     GUID        guid;
1502     DWORD       unknown;
1503     CHAR        name[1];
1504 } CODEVIEW_HEADER_RSDS,* PCODEVIEW_HEADER_RSDS;
1505
1506 typedef struct _CODEVIEW_PDB_DATA
1507 {
1508     DWORD       timestamp;
1509     DWORD       unknown;
1510     CHAR        name[1];
1511 } CODEVIEW_PDB_DATA, *PCODEVIEW_PDB_DATA;
1512
1513 typedef struct _CV_DIRECTORY_HEADER
1514 {
1515     WORD        cbDirHeader;
1516     WORD        cbDirEntry;
1517     DWORD       cDir;
1518     DWORD       lfoNextDir;
1519     DWORD       flags;
1520 } CV_DIRECTORY_HEADER, *PCV_DIRECTORY_HEADER;
1521
1522 typedef struct _CV_DIRECTORY_ENTRY
1523 {
1524     WORD        subsection;
1525     WORD        iMod;
1526     DWORD       lfo;
1527     DWORD       cb;
1528 } CV_DIRECTORY_ENTRY, *PCV_DIRECTORY_ENTRY;
1529
1530 typedef struct _CV_ENTRY_MODULE_SEGINFO
1531 {
1532     WORD        seg;
1533     WORD        pad;
1534     DWORD       offset;
1535     DWORD       cbSeg;
1536 } CV_ENTRY_MODULE_SEGINFO;
1537
1538 typedef struct _CV_ENTRY_MODULE
1539 {
1540     WORD        ovlNumber;
1541     WORD        iLib;
1542     WORD        cSeg;
1543     WORD        Style;
1544 /*
1545     CV_ENTRY_MODULE_SEGINFO     SegInfo[cSeg];
1546     p_string    Name;
1547 */
1548 } CV_ENTRY_MODULE;
1549
1550 typedef struct _CV_ENTRY_GLOBAL_TYPES
1551 {
1552     DWORD       flags;
1553     DWORD       cTypes;
1554 /*
1555     DWORD       offset[cTypes];
1556                 types_record[];
1557 */
1558 } CV_ENTRY_GLOBAL_TYPES;