Merge pull request #2593 from ludovic-henry/coop-fix-native-to-managed
[mono.git] / mcs / tools / pdb2mdb / CvInfo.cs
1 //-----------------------------------------------------------------------------
2 //
3 // Copyright (C) Microsoft Corporation.  All Rights Reserved.
4 //
5 //-----------------------------------------------------------------------------
6 //
7 //  File:   CvInfo.cs
8 //
9 //  Generic CodeView information definitions
10 //
11 //  Structures, constants, etc. for accessing and interpreting
12 //  CodeView information.
13 //
14 //  The master copy of this file resides in the langapi project (in C++).
15 //  All Microsoft projects are required to use the master copy without
16 //  modification.  Modification of the master version or a copy
17 //  without consultation with all parties concerned is extremely
18 //  risky.
19 //
20 //  When this file is modified, the corresponding documentation file
21 //  omfdeb.doc in the langapi project must be updated.
22 //
23 //  This is a read-only copy of the C++ file converted to C#.
24 //
25 using System;
26
27 namespace Microsoft.Cci.Pdb {
28   internal struct FLOAT10 {
29     internal byte Data_0;
30     internal byte Data_1;
31     internal byte Data_2;
32     internal byte Data_3;
33     internal byte Data_4;
34     internal byte Data_5;
35     internal byte Data_6;
36     internal byte Data_7;
37     internal byte Data_8;
38     internal byte Data_9;
39   };
40
41   internal enum CV_SIGNATURE {
42     C6=0,    // Actual signature is >64K
43     C7=1,    // First explicit signature
44     C11=2,    // C11 (vc5.x) 32-bit types
45     C13=4,    // C13 (vc7.x) zero terminated names
46     RESERVERD=5,    // All signatures from 5 to 64K are reserved
47   };
48
49   //  CodeView Symbol and Type OMF type information is broken up into two
50   //  ranges.  Type indices less than 0x1000 describe type information
51   //  that is frequently used.  Type indices above 0x1000 are used to
52   //  describe more complex features such as functions, arrays and
53   //  structures.
54   //
55
56   //  Primitive types have predefined meaning that is encoded in the
57   //  values of the various bit fields in the value.
58   //
59   //  A CodeView primitive type is defined as:
60   //
61   //  1 1
62   //  1 089  7654  3  210
63   //  r mode type  r  sub
64   //
65   //  Where
66   //      mode is the pointer mode
67   //      type is a type indicator
68   //      sub  is a subtype enumeration
69   //      r    is a reserved field
70   //
71   //  See Microsoft Symbol and Type OMF (Version 4.0) for more
72   //  information.
73   //
74
75   //  pointer mode enumeration values
76
77   internal enum CV_prmode {
78     CV_TM_DIRECT=0,        // mode is not a pointer
79     CV_TM_NPTR32=4,        // mode is a 32 bit near pointer
80     CV_TM_NPTR64=6,        // mode is a 64 bit near pointer
81     CV_TM_NPTR128=7,        // mode is a 128 bit near pointer
82   };
83
84   //  type enumeration values
85
86   internal enum CV_type {
87     CV_SPECIAL=0x00,     // special type size values
88     CV_SIGNED=0x01,     // signed integral size values
89     CV_UNSIGNED=0x02,     // unsigned integral size values
90     CV_BOOLEAN=0x03,     // Boolean size values
91     CV_REAL=0x04,     // real number size values
92     CV_COMPLEX=0x05,     // complex number size values
93     CV_SPECIAL2=0x06,     // second set of special types
94     CV_INT=0x07,     // integral (int) values
95     CV_CVRESERVED=0x0f,
96   };
97
98   //  subtype enumeration values for CV_SPECIAL
99
100   internal enum CV_special {
101     CV_SP_NOTYPE=0x00,
102     CV_SP_ABS=0x01,
103     CV_SP_SEGMENT=0x02,
104     CV_SP_VOID=0x03,
105     CV_SP_CURRENCY=0x04,
106     CV_SP_NBASICSTR=0x05,
107     CV_SP_FBASICSTR=0x06,
108     CV_SP_NOTTRANS=0x07,
109     CV_SP_HRESULT=0x08,
110   };
111
112   //  subtype enumeration values for CV_SPECIAL2
113
114   internal enum CV_special2 {
115     CV_S2_BIT=0x00,
116     CV_S2_PASCHAR=0x01,     // Pascal CHAR
117   };
118
119   //  subtype enumeration values for CV_SIGNED, CV_UNSIGNED and CV_BOOLEAN
120
121   internal enum CV_integral {
122     CV_IN_1BYTE=0x00,
123     CV_IN_2BYTE=0x01,
124     CV_IN_4BYTE=0x02,
125     CV_IN_8BYTE=0x03,
126     CV_IN_16BYTE=0x04,
127   };
128
129   //  subtype enumeration values for CV_REAL and CV_COMPLEX
130
131   internal enum CV_real {
132     CV_RC_REAL32=0x00,
133     CV_RC_REAL64=0x01,
134     CV_RC_REAL80=0x02,
135     CV_RC_REAL128=0x03,
136   };
137
138   //  subtype enumeration values for CV_INT (really int)
139
140   internal enum CV_int {
141     CV_RI_CHAR=0x00,
142     CV_RI_INT1=0x00,
143     CV_RI_WCHAR=0x01,
144     CV_RI_UINT1=0x01,
145     CV_RI_INT2=0x02,
146     CV_RI_UINT2=0x03,
147     CV_RI_INT4=0x04,
148     CV_RI_UINT4=0x05,
149     CV_RI_INT8=0x06,
150     CV_RI_UINT8=0x07,
151     CV_RI_INT16=0x08,
152     CV_RI_UINT16=0x09,
153   };
154
155   internal struct CV_PRIMITIVE_TYPE {
156     const uint CV_MMASK     = 0x700;       // mode mask
157     const uint CV_TMASK     = 0x0f0;       // type mask
158     const uint CV_SMASK     = 0x00f;       // subtype mask
159
160     const int CV_MSHIFT     = 8;           // primitive mode right shift count
161     const int CV_TSHIFT     = 4;           // primitive type right shift count
162     const int CV_SSHIFT     = 0;           // primitive subtype right shift count
163
164     // function to extract primitive mode, type and size
165
166     internal static CV_prmode CV_MODE(TYPE_ENUM typ) {
167       return (CV_prmode)((((uint)typ) & CV_MMASK) >> CV_MSHIFT);
168     }
169
170     internal static CV_type CV_TYPE(TYPE_ENUM typ) {
171       return (CV_type)((((uint)typ) & CV_TMASK) >> CV_TSHIFT);
172     }
173
174     internal static uint CV_SUBT(TYPE_ENUM typ) {
175       return ((((uint)typ) & CV_SMASK) >> CV_SSHIFT);
176     }
177
178     // functions to check the type of a primitive
179
180     internal static bool CV_TYP_IS_DIRECT(TYPE_ENUM typ) {
181       return (CV_MODE(typ) == CV_prmode.CV_TM_DIRECT);
182     }
183
184     internal static bool CV_TYP_IS_PTR(TYPE_ENUM typ) {
185       return (CV_MODE(typ) != CV_prmode.CV_TM_DIRECT);
186     }
187
188     internal static bool CV_TYP_IS_SIGNED(TYPE_ENUM typ) {
189       return
190           (((CV_TYPE(typ) == CV_type.CV_SIGNED) && CV_TYP_IS_DIRECT(typ)) ||
191                  (typ == TYPE_ENUM.T_INT1)  ||
192                  (typ == TYPE_ENUM.T_INT2)  ||
193                  (typ == TYPE_ENUM.T_INT4)  ||
194                  (typ == TYPE_ENUM.T_INT8)  ||
195                  (typ == TYPE_ENUM.T_INT16) ||
196                  (typ == TYPE_ENUM.T_RCHAR));
197     }
198
199     internal static bool CV_TYP_IS_UNSIGNED(TYPE_ENUM typ) {
200       return (((CV_TYPE(typ) == CV_type.CV_UNSIGNED) && CV_TYP_IS_DIRECT(typ)) ||
201                     (typ == TYPE_ENUM.T_UINT1) ||
202                     (typ == TYPE_ENUM.T_UINT2) ||
203                     (typ == TYPE_ENUM.T_UINT4) ||
204                     (typ == TYPE_ENUM.T_UINT8) ||
205                     (typ == TYPE_ENUM.T_UINT16));
206     }
207
208     internal static bool CV_TYP_IS_REAL(TYPE_ENUM typ) {
209       return ((CV_TYPE(typ) == CV_type.CV_REAL)  && CV_TYP_IS_DIRECT(typ));
210     }
211
212     const uint CV_FIRST_NONPRIM = 0x1000;
213
214     internal static bool CV_IS_PRIMITIVE(TYPE_ENUM typ) {
215       return ((uint)(typ) < CV_FIRST_NONPRIM);
216     }
217
218     internal static bool CV_TYP_IS_COMPLEX(TYPE_ENUM typ) {
219       return ((CV_TYPE(typ) == CV_type.CV_COMPLEX) && CV_TYP_IS_DIRECT(typ));
220     }
221
222     internal static bool CV_IS_INTERNAL_PTR(TYPE_ENUM typ) {
223       return (CV_IS_PRIMITIVE(typ) &&
224                     CV_TYPE(typ) == CV_type.CV_CVRESERVED &&
225                     CV_TYP_IS_PTR(typ));
226     }
227   }
228
229   // selected values for type_index - for a more complete definition, see
230   // Microsoft Symbol and Type OMF document
231
232   //  Special Types
233
234   internal enum TYPE_ENUM {
235     //  Special Types
236
237     T_NOTYPE=0x0000,   // uncharacterized type (no type)
238     T_ABS=0x0001,   // absolute symbol
239     T_SEGMENT=0x0002,   // segment type
240     T_VOID=0x0003,   // void
241     T_HRESULT=0x0008,   // OLE/COM HRESULT
242     T_32PHRESULT=0x0408,   // OLE/COM HRESULT __ptr32//
243     T_64PHRESULT=0x0608,   // OLE/COM HRESULT __ptr64//
244     T_PVOID=0x0103,   // near pointer to void
245     T_PFVOID=0x0203,   // far pointer to void
246     T_PHVOID=0x0303,   // huge pointer to void
247     T_32PVOID=0x0403,   // 32 bit pointer to void
248     T_64PVOID=0x0603,   // 64 bit pointer to void
249     T_CURRENCY=0x0004,   // BASIC 8 byte currency value
250     T_NOTTRANS=0x0007,   // type not translated by cvpack
251     T_BIT=0x0060,   // bit
252     T_PASCHAR=0x0061,   // Pascal CHAR
253
254     //  Character types
255
256     T_CHAR=0x0010,   // 8 bit signed
257     T_32PCHAR=0x0410,   // 32 bit pointer to 8 bit signed
258     T_64PCHAR=0x0610,   // 64 bit pointer to 8 bit signed
259
260     T_UCHAR=0x0020,   // 8 bit unsigned
261     T_32PUCHAR=0x0420,   // 32 bit pointer to 8 bit unsigned
262     T_64PUCHAR=0x0620,   // 64 bit pointer to 8 bit unsigned
263
264     //  really a character types
265
266     T_RCHAR=0x0070,   // really a char
267     T_32PRCHAR=0x0470,   // 32 bit pointer to a real char
268     T_64PRCHAR=0x0670,   // 64 bit pointer to a real char
269
270     //  really a wide character types
271
272     T_WCHAR=0x0071,   // wide char
273     T_32PWCHAR=0x0471,   // 32 bit pointer to a wide char
274     T_64PWCHAR=0x0671,   // 64 bit pointer to a wide char
275
276     //  8 bit int types
277
278     T_INT1=0x0068,   // 8 bit signed int
279     T_32PINT1=0x0468,   // 32 bit pointer to 8 bit signed int
280     T_64PINT1=0x0668,   // 64 bit pointer to 8 bit signed int
281
282     T_UINT1=0x0069,   // 8 bit unsigned int
283     T_32PUINT1=0x0469,   // 32 bit pointer to 8 bit unsigned int
284     T_64PUINT1=0x0669,   // 64 bit pointer to 8 bit unsigned int
285
286     //  16 bit short types
287
288     T_SHORT=0x0011,   // 16 bit signed
289     T_32PSHORT=0x0411,   // 32 bit pointer to 16 bit signed
290     T_64PSHORT=0x0611,   // 64 bit pointer to 16 bit signed
291
292     T_USHORT=0x0021,   // 16 bit unsigned
293     T_32PUSHORT=0x0421,   // 32 bit pointer to 16 bit unsigned
294     T_64PUSHORT=0x0621,   // 64 bit pointer to 16 bit unsigned
295
296     //  16 bit int types
297
298     T_INT2=0x0072,   // 16 bit signed int
299     T_32PINT2=0x0472,   // 32 bit pointer to 16 bit signed int
300     T_64PINT2=0x0672,   // 64 bit pointer to 16 bit signed int
301
302     T_UINT2=0x0073,   // 16 bit unsigned int
303     T_32PUINT2=0x0473,   // 32 bit pointer to 16 bit unsigned int
304     T_64PUINT2=0x0673,   // 64 bit pointer to 16 bit unsigned int
305
306     //  32 bit long types
307
308     T_LONG=0x0012,   // 32 bit signed
309     T_ULONG=0x0022,   // 32 bit unsigned
310     T_32PLONG=0x0412,   // 32 bit pointer to 32 bit signed
311     T_32PULONG=0x0422,   // 32 bit pointer to 32 bit unsigned
312     T_64PLONG=0x0612,   // 64 bit pointer to 32 bit signed
313     T_64PULONG=0x0622,   // 64 bit pointer to 32 bit unsigned
314
315     //  32 bit int types
316
317     T_INT4=0x0074,   // 32 bit signed int
318     T_32PINT4=0x0474,   // 32 bit pointer to 32 bit signed int
319     T_64PINT4=0x0674,   // 64 bit pointer to 32 bit signed int
320
321     T_UINT4=0x0075,   // 32 bit unsigned int
322     T_32PUINT4=0x0475,   // 32 bit pointer to 32 bit unsigned int
323     T_64PUINT4=0x0675,   // 64 bit pointer to 32 bit unsigned int
324
325     //  64 bit quad types
326
327     T_QUAD=0x0013,   // 64 bit signed
328     T_32PQUAD=0x0413,   // 32 bit pointer to 64 bit signed
329     T_64PQUAD=0x0613,   // 64 bit pointer to 64 bit signed
330
331     T_UQUAD=0x0023,   // 64 bit unsigned
332     T_32PUQUAD=0x0423,   // 32 bit pointer to 64 bit unsigned
333     T_64PUQUAD=0x0623,   // 64 bit pointer to 64 bit unsigned
334
335     //  64 bit int types
336
337     T_INT8=0x0076,   // 64 bit signed int
338     T_32PINT8=0x0476,   // 32 bit pointer to 64 bit signed int
339     T_64PINT8=0x0676,   // 64 bit pointer to 64 bit signed int
340
341     T_UINT8=0x0077,   // 64 bit unsigned int
342     T_32PUINT8=0x0477,   // 32 bit pointer to 64 bit unsigned int
343     T_64PUINT8=0x0677,   // 64 bit pointer to 64 bit unsigned int
344
345     //  128 bit octet types
346
347     T_OCT=0x0014,   // 128 bit signed
348     T_32POCT=0x0414,   // 32 bit pointer to 128 bit signed
349     T_64POCT=0x0614,   // 64 bit pointer to 128 bit signed
350
351     T_UOCT=0x0024,   // 128 bit unsigned
352     T_32PUOCT=0x0424,   // 32 bit pointer to 128 bit unsigned
353     T_64PUOCT=0x0624,   // 64 bit pointer to 128 bit unsigned
354
355     //  128 bit int types
356
357     T_INT16=0x0078,   // 128 bit signed int
358     T_32PINT16=0x0478,   // 32 bit pointer to 128 bit signed int
359     T_64PINT16=0x0678,   // 64 bit pointer to 128 bit signed int
360
361     T_UINT16=0x0079,   // 128 bit unsigned int
362     T_32PUINT16=0x0479,   // 32 bit pointer to 128 bit unsigned int
363     T_64PUINT16=0x0679,   // 64 bit pointer to 128 bit unsigned int
364
365     //  32 bit real types
366
367     T_REAL32=0x0040,   // 32 bit real
368     T_32PREAL32=0x0440,   // 32 bit pointer to 32 bit real
369     T_64PREAL32=0x0640,   // 64 bit pointer to 32 bit real
370
371     //  64 bit real types
372
373     T_REAL64=0x0041,   // 64 bit real
374     T_32PREAL64=0x0441,   // 32 bit pointer to 64 bit real
375     T_64PREAL64=0x0641,   // 64 bit pointer to 64 bit real
376
377     //  80 bit real types
378
379     T_REAL80=0x0042,   // 80 bit real
380     T_32PREAL80=0x0442,   // 32 bit pointer to 80 bit real
381     T_64PREAL80=0x0642,   // 64 bit pointer to 80 bit real
382
383     //  128 bit real types
384
385     T_REAL128=0x0043,   // 128 bit real
386     T_32PREAL128=0x0443,   // 32 bit pointer to 128 bit real
387     T_64PREAL128=0x0643,   // 64 bit pointer to 128 bit real
388
389     //  32 bit complex types
390
391     T_CPLX32=0x0050,   // 32 bit complex
392     T_32PCPLX32=0x0450,   // 32 bit pointer to 32 bit complex
393     T_64PCPLX32=0x0650,   // 64 bit pointer to 32 bit complex
394
395     //  64 bit complex types
396
397     T_CPLX64=0x0051,   // 64 bit complex
398     T_32PCPLX64=0x0451,   // 32 bit pointer to 64 bit complex
399     T_64PCPLX64=0x0651,   // 64 bit pointer to 64 bit complex
400
401     //  80 bit complex types
402
403     T_CPLX80=0x0052,   // 80 bit complex
404     T_32PCPLX80=0x0452,   // 32 bit pointer to 80 bit complex
405     T_64PCPLX80=0x0652,   // 64 bit pointer to 80 bit complex
406
407     //  128 bit complex types
408
409     T_CPLX128=0x0053,   // 128 bit complex
410     T_32PCPLX128=0x0453,   // 32 bit pointer to 128 bit complex
411     T_64PCPLX128=0x0653,   // 64 bit pointer to 128 bit complex
412
413     //  boolean types
414
415     T_BOOL08=0x0030,   // 8 bit boolean
416     T_32PBOOL08=0x0430,   // 32 bit pointer to 8 bit boolean
417     T_64PBOOL08=0x0630,   // 64 bit pointer to 8 bit boolean
418
419     T_BOOL16=0x0031,   // 16 bit boolean
420     T_32PBOOL16=0x0431,   // 32 bit pointer to 18 bit boolean
421     T_64PBOOL16=0x0631,   // 64 bit pointer to 18 bit boolean
422
423     T_BOOL32=0x0032,   // 32 bit boolean
424     T_32PBOOL32=0x0432,   // 32 bit pointer to 32 bit boolean
425     T_64PBOOL32=0x0632,   // 64 bit pointer to 32 bit boolean
426
427     T_BOOL64=0x0033,   // 64 bit boolean
428     T_32PBOOL64=0x0433,   // 32 bit pointer to 64 bit boolean
429     T_64PBOOL64=0x0633,   // 64 bit pointer to 64 bit boolean
430   };
431
432   //  No leaf index can have a value of 0x0000.  The leaf indices are
433   //  separated into ranges depending upon the use of the type record.
434   //  The second range is for the type records that are directly referenced
435   //  in symbols. The first range is for type records that are not
436   //  referenced by symbols but instead are referenced by other type
437   //  records.  All type records must have a starting leaf index in these
438   //  first two ranges.  The third range of leaf indices are used to build
439   //  up complex lists such as the field list of a class type record.  No
440   //  type record can begin with one of the leaf indices. The fourth ranges
441   //  of type indices are used to represent numeric data in a symbol or
442   //  type record. These leaf indices are greater than 0x8000.  At the
443   //  point that type or symbol processor is expecting a numeric field, the
444   //  next two bytes in the type record are examined.  If the value is less
445   //  than 0x8000, then the two bytes contain the numeric value.  If the
446   //  value is greater than 0x8000, then the data follows the leaf index in
447   //  a format specified by the leaf index. The final range of leaf indices
448   //  are used to force alignment of subfields within a complex type record..
449   //
450
451   internal enum LEAF {
452     // leaf indices starting records but referenced from symbol records
453
454     LF_VTSHAPE=0x000a,
455     LF_COBOL1=0x000c,
456     LF_LABEL=0x000e,
457     LF_NULL=0x000f,
458     LF_NOTTRAN=0x0010,
459     LF_ENDPRECOMP=0x0014,       // not referenced from symbol
460     LF_TYPESERVER_ST=0x0016,       // not referenced from symbol
461
462     // leaf indices starting records but referenced only from type records
463
464     LF_LIST=0x0203,
465     LF_REFSYM=0x020c,
466
467     LF_ENUMERATE_ST=0x0403,
468
469     // 32-bit type index versions of leaves, all have the 0x1000 bit set
470     //
471     LF_TI16_MAX=0x1000,
472
473     LF_MODIFIER=0x1001,
474     LF_POINTER=0x1002,
475     LF_ARRAY_ST=0x1003,
476     LF_CLASS_ST=0x1004,
477     LF_STRUCTURE_ST=0x1005,
478     LF_UNION_ST=0x1006,
479     LF_ENUM_ST=0x1007,
480     LF_PROCEDURE=0x1008,
481     LF_MFUNCTION=0x1009,
482     LF_COBOL0=0x100a,
483     LF_BARRAY=0x100b,
484     LF_DIMARRAY_ST=0x100c,
485     LF_VFTPATH=0x100d,
486     LF_PRECOMP_ST=0x100e,       // not referenced from symbol
487     LF_OEM=0x100f,       // oem definable type string
488     LF_ALIAS_ST=0x1010,       // alias (typedef) type
489     LF_OEM2=0x1011,       // oem definable type string
490
491     // leaf indices starting records but referenced only from type records
492
493     LF_SKIP=0x1200,
494     LF_ARGLIST=0x1201,
495     LF_DEFARG_ST=0x1202,
496     LF_FIELDLIST=0x1203,
497     LF_DERIVED=0x1204,
498     LF_BITFIELD=0x1205,
499     LF_METHODLIST=0x1206,
500     LF_DIMCONU=0x1207,
501     LF_DIMCONLU=0x1208,
502     LF_DIMVARU=0x1209,
503     LF_DIMVARLU=0x120a,
504
505     LF_BCLASS=0x1400,
506     LF_VBCLASS=0x1401,
507     LF_IVBCLASS=0x1402,
508     LF_FRIENDFCN_ST=0x1403,
509     LF_INDEX=0x1404,
510     LF_MEMBER_ST=0x1405,
511     LF_STMEMBER_ST=0x1406,
512     LF_METHOD_ST=0x1407,
513     LF_NESTTYPE_ST=0x1408,
514     LF_VFUNCTAB=0x1409,
515     LF_FRIENDCLS=0x140a,
516     LF_ONEMETHOD_ST=0x140b,
517     LF_VFUNCOFF=0x140c,
518     LF_NESTTYPEEX_ST=0x140d,
519     LF_MEMBERMODIFY_ST=0x140e,
520     LF_MANAGED_ST=0x140f,
521
522     // Types w/ SZ names
523
524     LF_ST_MAX=0x1500,
525
526     LF_TYPESERVER=0x1501,       // not referenced from symbol
527     LF_ENUMERATE=0x1502,
528     LF_ARRAY=0x1503,
529     LF_CLASS=0x1504,
530     LF_STRUCTURE=0x1505,
531     LF_UNION=0x1506,
532     LF_ENUM=0x1507,
533     LF_DIMARRAY=0x1508,
534     LF_PRECOMP=0x1509,       // not referenced from symbol
535     LF_ALIAS=0x150a,       // alias (typedef) type
536     LF_DEFARG=0x150b,
537     LF_FRIENDFCN=0x150c,
538     LF_MEMBER=0x150d,
539     LF_STMEMBER=0x150e,
540     LF_METHOD=0x150f,
541     LF_NESTTYPE=0x1510,
542     LF_ONEMETHOD=0x1511,
543     LF_NESTTYPEEX=0x1512,
544     LF_MEMBERMODIFY=0x1513,
545     LF_MANAGED=0x1514,
546     LF_TYPESERVER2=0x1515,
547
548     LF_NUMERIC=0x8000,
549     LF_CHAR=0x8000,
550     LF_SHORT=0x8001,
551     LF_USHORT=0x8002,
552     LF_LONG=0x8003,
553     LF_ULONG=0x8004,
554     LF_REAL32=0x8005,
555     LF_REAL64=0x8006,
556     LF_REAL80=0x8007,
557     LF_REAL128=0x8008,
558     LF_QUADWORD=0x8009,
559     LF_UQUADWORD=0x800a,
560     LF_COMPLEX32=0x800c,
561     LF_COMPLEX64=0x800d,
562     LF_COMPLEX80=0x800e,
563     LF_COMPLEX128=0x800f,
564     LF_VARSTRING=0x8010,
565
566     LF_OCTWORD=0x8017,
567     LF_UOCTWORD=0x8018,
568
569     LF_DECIMAL=0x8019,
570     LF_DATE=0x801a,
571     LF_UTF8STRING=0x801b,
572
573     LF_PAD0=0xf0,
574     LF_PAD1=0xf1,
575     LF_PAD2=0xf2,
576     LF_PAD3=0xf3,
577     LF_PAD4=0xf4,
578     LF_PAD5=0xf5,
579     LF_PAD6=0xf6,
580     LF_PAD7=0xf7,
581     LF_PAD8=0xf8,
582     LF_PAD9=0xf9,
583     LF_PAD10=0xfa,
584     LF_PAD11=0xfb,
585     LF_PAD12=0xfc,
586     LF_PAD13=0xfd,
587     LF_PAD14=0xfe,
588     LF_PAD15=0xff,
589
590   };
591
592   // end of leaf indices
593
594   //  Type enum for pointer records
595   //  Pointers can be one of the following types
596
597   internal enum CV_ptrtype {
598     CV_PTR_BASE_SEG=0x03, // based on segment
599     CV_PTR_BASE_VAL=0x04, // based on value of base
600     CV_PTR_BASE_SEGVAL=0x05, // based on segment value of base
601     CV_PTR_BASE_ADDR=0x06, // based on address of base
602     CV_PTR_BASE_SEGADDR=0x07, // based on segment address of base
603     CV_PTR_BASE_TYPE=0x08, // based on type
604     CV_PTR_BASE_SELF=0x09, // based on self
605     CV_PTR_NEAR32=0x0a, // 32 bit pointer
606     CV_PTR_64=0x0c, // 64 bit pointer
607     CV_PTR_UNUSEDPTR=0x0d  // first unused pointer type
608   };
609
610   //  Mode enum for pointers
611   //  Pointers can have one of the following modes
612
613   internal enum CV_ptrmode {
614     CV_PTR_MODE_PTR=0x00, // "normal" pointer
615     CV_PTR_MODE_REF=0x01, // reference
616     CV_PTR_MODE_PMEM=0x02, // pointer to data member
617     CV_PTR_MODE_PMFUNC=0x03, // pointer to member function
618     CV_PTR_MODE_RESERVED=0x04  // first unused pointer mode
619   };
620
621   //  enumeration for pointer-to-member types
622
623   internal enum CV_pmtype {
624     CV_PMTYPE_Undef=0x00, // not specified (pre VC8)
625     CV_PMTYPE_D_Single=0x01, // member data, single inheritance
626     CV_PMTYPE_D_Multiple=0x02, // member data, multiple inheritance
627     CV_PMTYPE_D_Virtual=0x03, // member data, virtual inheritance
628     CV_PMTYPE_D_General=0x04, // member data, most general
629     CV_PMTYPE_F_Single=0x05, // member function, single inheritance
630     CV_PMTYPE_F_Multiple=0x06, // member function, multiple inheritance
631     CV_PMTYPE_F_Virtual=0x07, // member function, virtual inheritance
632     CV_PMTYPE_F_General=0x08, // member function, most general
633   };
634
635   //  enumeration for method properties
636
637   internal enum CV_methodprop {
638     CV_MTvanilla=0x00,
639     CV_MTvirtual=0x01,
640     CV_MTstatic=0x02,
641     CV_MTfriend=0x03,
642     CV_MTintro=0x04,
643     CV_MTpurevirt=0x05,
644     CV_MTpureintro=0x06
645   };
646
647   //  enumeration for virtual shape table entries
648
649   internal enum CV_VTS_desc {
650     CV_VTS_near=0x00,
651     CV_VTS_far=0x01,
652     CV_VTS_thin=0x02,
653     CV_VTS_outer=0x03,
654     CV_VTS_meta=0x04,
655     CV_VTS_near32=0x05,
656     CV_VTS_far32=0x06,
657     CV_VTS_unused=0x07
658   };
659
660   //  enumeration for LF_LABEL address modes
661
662   internal enum CV_LABEL_TYPE {
663     CV_LABEL_NEAR=0,       // near return
664     CV_LABEL_FAR=4        // far return
665   };
666
667   //  enumeration for LF_MODIFIER values
668
669   [Flags]
670   internal enum CV_modifier : ushort {
671     MOD_const=0x0001,
672     MOD_volatile=0x0002,
673     MOD_unaligned=0x0004,
674   };
675
676   //  bit field structure describing class/struct/union/enum properties
677
678   [Flags]
679   internal enum CV_prop : ushort {
680     packed=0x0001,   // true if structure is packed
681     ctor=0x0002,   // true if constructors or destructors present
682     ovlops=0x0004,   // true if overloaded operators present
683     isnested=0x0008,   // true if this is a nested class
684     cnested=0x0010,   // true if this class contains nested types
685     opassign=0x0020,   // true if overloaded assignment (=)
686     opcast=0x0040,   // true if casting methods
687     fwdref=0x0080,   // true if forward reference (incomplete defn)
688     scoped=0x0100,   // scoped definition
689   }
690
691   //  class field attribute
692
693   [Flags]
694   internal enum CV_fldattr {
695     access=0x0003,   // access protection CV_access_t
696     mprop=0x001c,   // method properties CV_methodprop_t
697     pseudo=0x0020,   // compiler generated fcn and does not exist
698     noinherit=0x0040,   // true if class cannot be inherited
699     noconstruct=0x0080,   // true if class cannot be constructed
700     compgenx=0x0100,   // compiler generated fcn and does exist
701   }
702
703   //  Structures to access to the type records
704
705   internal struct TYPTYPE {
706     internal ushort len;
707     internal ushort leaf;
708     // byte data[];
709
710     //  char *NextType (char * pType) {
711     //  return (pType + ((TYPTYPE *)pType)->len + sizeof(ushort));
712     //  }
713   };          // general types record
714
715   //  memory representation of pointer to member.  These representations are
716   //  indexed by the enumeration above in the LF_POINTER record
717
718   //  representation of a 32 bit pointer to data for a class with
719   //  or without virtual functions and no virtual bases
720
721   internal struct CV_PDMR32_NVVFCN {
722     internal int mdisp;      // displacement to data (NULL = 0x80000000)
723   };
724
725   //  representation of a 32 bit pointer to data for a class
726   //  with virtual bases
727
728   internal struct CV_PDMR32_VBASE {
729     internal int mdisp;      // displacement to data
730     internal int pdisp;      // this pointer displacement
731     internal int vdisp;      // vbase table displacement
732     // NULL = (,,0xffffffff)
733   };
734
735   //  representation of a 32 bit pointer to member function for a
736   //  class with no virtual bases and a single address point
737
738   internal struct CV_PMFR32_NVSA {
739     internal uint off;        // near address of function (NULL = 0L)
740   };
741
742   //  representation of a 32 bit pointer to member function for a
743   //  class with no virtual bases and multiple address points
744
745   internal struct CV_PMFR32_NVMA {
746     internal uint off;        // near address of function (NULL = 0L,x)
747     internal int disp;
748   };
749
750   //  representation of a 32 bit pointer to member function for a
751   //  class with virtual bases
752
753   internal struct CV_PMFR32_VBASE {
754     internal uint off;        // near address of function (NULL = 0L,x,x,x)
755     internal int mdisp;      // displacement to data
756     internal int pdisp;      // this pointer displacement
757     internal int vdisp;      // vbase table displacement
758   };
759
760   //////////////////////////////////////////////////////////////////////////////
761   //
762   //  The following type records are basically variant records of the
763   //  above structure.  The "ushort leaf" of the above structure and
764   //  the "ushort leaf" of the following type definitions are the same
765   //  symbol.
766   //
767
768   //  Notes on alignment
769   //  Alignment of the fields in most of the type records is done on the
770   //  basis of the TYPTYPE record base.  That is why in most of the lf*
771   //  records that the type is located on what appears to
772   //  be a offset mod 4 == 2 boundary.  The exception to this rule are those
773   //  records that are in a list (lfFieldList, lfMethodList), which are
774   //  aligned to their own bases since they don't have the length field
775   //
776
777   //  Type record for LF_MODIFIER
778
779   internal struct LeafModifier {
780     // internal ushort leaf;      // LF_MODIFIER [TYPTYPE]
781     internal uint type;       // (type index) modified type
782     internal CV_modifier attr;    // modifier attribute modifier_t
783   };
784
785   //  type record for LF_POINTER
786
787   [Flags]
788   internal enum LeafPointerAttr : uint {
789     ptrtype=0x0000001f,   // ordinal specifying pointer type (CV_ptrtype)
790     ptrmode=0x000000e0,   // ordinal specifying pointer mode (CV_ptrmode)
791     isflat32=0x00000100,   // true if 0:32 pointer
792     isvolatile=0x00000200,   // TRUE if volatile pointer
793     isconst=0x00000400,   // TRUE if const pointer
794     isunaligned=0x00000800,   // TRUE if unaligned pointer
795     isrestrict=0x00001000,   // TRUE if restricted pointer (allow agressive opts)
796   };
797
798   internal struct LeafPointer {
799     internal struct LeafPointerBody {
800       // internal ushort leaf;  // LF_POINTER [TYPTYPE]
801       internal uint utype;  // (type index) type index of the underlying type
802       internal LeafPointerAttr attr;
803     };
804 #if false
805         union {
806             internal struct {
807                 uint    pmclass;    // (type index) index of containing class for pointer to member
808                 ushort  pmenum;     // enumeration specifying pm format (CV_pmtype)
809             };
810             ushort  bseg;           // base segment if PTR_BASE_SEG
811             byte[]  Sym;            // copy of base symbol record (including length)
812             internal struct  {
813                 uint    index;      // (type index) type index if CV_PTR_BASE_TYPE
814                 string  name;       // name of base type
815             } btype;
816         } pbase;
817 #endif
818   }
819
820   //  type record for LF_ARRAY
821
822   internal struct LeafArray {
823     // internal ushort leaf;      // LF_ARRAY [TYPTYPE]
824     internal uint elemtype;   // (type index) type index of element type
825     internal uint idxtype;    // (type index) type index of indexing type
826     internal byte[] data;       // variable length data specifying size in bytes
827     internal string name;
828   };
829
830   //  type record for LF_CLASS, LF_STRUCTURE
831
832   internal struct LeafClass {
833     // internal ushort leaf;      // LF_CLASS, LF_STRUCT [TYPTYPE]
834     internal ushort count;      // count of number of elements in class
835     internal ushort property;   // (CV_prop_t) property attribute field (prop_t)
836     internal uint field;      // (type index) type index of LF_FIELD descriptor list
837     internal uint derived;    // (type index) type index of derived from list if not zero
838     internal uint vshape;     // (type index) type index of vshape table for this class
839     internal byte[] data;       // data describing length of structure in bytes
840     internal string name;
841   };
842
843   //  type record for LF_UNION
844
845   internal struct LeafUnion {
846     // internal ushort leaf;      // LF_UNION [TYPTYPE]
847     internal ushort count;      // count of number of elements in class
848     internal ushort property;   // (CV_prop_t) property attribute field
849     internal uint field;      // (type index) type index of LF_FIELD descriptor list
850     internal byte[] data;       // variable length data describing length of
851     internal string name;
852   };
853
854   //  type record for LF_ALIAS
855
856   internal struct LeafAlias {
857     // internal ushort leaf;      // LF_ALIAS [TYPTYPE]
858     internal uint utype;      // (type index) underlying type
859     internal string name;       // alias name
860   };
861
862   //  type record for LF_MANAGED
863
864   internal struct LeafManaged {
865     // internal ushort leaf;      // LF_MANAGED [TYPTYPE]
866     internal string name;       // utf8, zero terminated managed type name
867   };
868
869   //  type record for LF_ENUM
870
871   internal struct LeafEnum {
872     // internal ushort leaf;      // LF_ENUM [TYPTYPE]
873     internal ushort count;      // count of number of elements in class
874     internal ushort property;   // (CV_propt_t) property attribute field
875     internal uint utype;      // (type index) underlying type of the enum
876     internal uint field;      // (type index) type index of LF_FIELD descriptor list
877     internal string name;       // length prefixed name of enum
878   };
879
880   //  Type record for LF_PROCEDURE
881
882   internal struct LeafProc {
883     // internal ushort leaf;      // LF_PROCEDURE [TYPTYPE]
884     internal uint rvtype;     // (type index) type index of return value
885     internal byte calltype;   // calling convention (CV_call_t)
886     internal byte reserved;   // reserved for future use
887     internal ushort parmcount;  // number of parameters
888     internal uint arglist;    // (type index) type index of argument list
889   };
890
891   //  Type record for member function
892
893   internal struct LeafMFunc {
894     // internal ushort leaf;      // LF_MFUNCTION [TYPTYPE]
895     internal uint rvtype;     // (type index) type index of return value
896     internal uint classtype;  // (type index) type index of containing class
897     internal uint thistype;   // (type index) type index of this pointer (model specific)
898     internal byte calltype;   // calling convention (call_t)
899     internal byte reserved;   // reserved for future use
900     internal ushort parmcount;  // number of parameters
901     internal uint arglist;    // (type index) type index of argument list
902     internal int thisadjust; // this adjuster (long because pad required anyway)
903   };
904
905   //  type record for virtual function table shape
906
907   internal struct LeafVTShape {
908     // internal ushort leaf;      // LF_VTSHAPE [TYPTYPE]
909     internal ushort count;      // number of entries in vfunctable
910     internal byte[] desc;       // 4 bit (CV_VTS_desc) descriptors
911   };
912
913   //  type record for cobol0
914
915   internal struct LeafCobol0 {
916     // internal ushort leaf;      // LF_COBOL0 [TYPTYPE]
917     internal uint type;       // (type index) parent type record index
918     internal byte[] data;
919   };
920
921   //  type record for cobol1
922
923   internal struct LeafCobol1 {
924     // internal ushort leaf;      // LF_COBOL1 [TYPTYPE]
925     internal byte[] data;
926   };
927
928   //  type record for basic array
929
930   internal struct LeafBArray {
931     // internal ushort leaf;      // LF_BARRAY [TYPTYPE]
932     internal uint utype;      // (type index) type index of underlying type
933   };
934
935   //  type record for assembler labels
936
937   internal struct LeafLabel {
938     // internal ushort leaf;      // LF_LABEL [TYPTYPE]
939     internal ushort mode;       // addressing mode of label
940   };
941
942   //  type record for dimensioned arrays
943
944   internal struct LeafDimArray {
945     // internal ushort leaf;      // LF_DIMARRAY [TYPTYPE]
946     internal uint utype;      // (type index) underlying type of the array
947     internal uint diminfo;    // (type index) dimension information
948     internal string name;       // length prefixed name
949   };
950
951   //  type record describing path to virtual function table
952
953   internal struct LeafVFTPath {
954     // internal ushort leaf;      // LF_VFTPATH [TYPTYPE]
955     internal uint count;      // count of number of bases in path
956     internal uint[] bases;      // (type index) bases from root to leaf
957   };
958
959   //  type record describing inclusion of precompiled types
960
961   internal struct LeafPreComp {
962     // internal ushort leaf;      // LF_PRECOMP [TYPTYPE]
963     internal uint start;      // starting type index included
964     internal uint count;      // number of types in inclusion
965     internal uint signature;  // signature
966     internal string name;       // length prefixed name of included type file
967   };
968
969   //  type record describing end of precompiled types that can be
970   //  included by another file
971
972   internal struct LeafEndPreComp {
973     // internal ushort leaf;      // LF_ENDPRECOMP [TYPTYPE]
974     internal uint signature;  // signature
975   };
976
977   //  type record for OEM definable type strings
978
979   internal struct LeafOEM {
980     // internal ushort leaf;      // LF_OEM [TYPTYPE]
981     internal ushort cvOEM;      // MS assigned OEM identified
982     internal ushort recOEM;     // OEM assigned type identifier
983     internal uint count;      // count of type indices to follow
984     internal uint[] index;      // (type index) array of type indices followed
985     // by OEM defined data
986   };
987
988   internal enum OEM_ID {
989     OEM_MS_FORTRAN90=0xF090,
990     OEM_ODI=0x0010,
991     OEM_THOMSON_SOFTWARE=0x5453,
992     OEM_ODI_REC_BASELIST=0x0000,
993   };
994
995   internal struct LeafOEM2 {
996     // internal ushort leaf;      // LF_OEM2 [TYPTYPE]
997     internal Guid idOem;      // an oem ID (Guid)
998     internal uint count;      // count of type indices to follow
999     internal uint[] index;      // (type index) array of type indices followed
1000     // by OEM defined data
1001   };
1002
1003   //  type record describing using of a type server
1004
1005   internal struct LeafTypeServer {
1006     // internal ushort leaf;      // LF_TYPESERVER [TYPTYPE]
1007     internal uint signature;  // signature
1008     internal uint age;        // age of database used by this module
1009     internal string name;       // length prefixed name of PDB
1010   };
1011
1012   //  type record describing using of a type server with v7 (GUID) signatures
1013
1014   internal struct LeafTypeServer2 {
1015     // internal ushort leaf;      // LF_TYPESERVER2 [TYPTYPE]
1016     internal Guid sig70;      // guid signature
1017     internal uint age;        // age of database used by this module
1018     internal string name;       // length prefixed name of PDB
1019   };
1020
1021   //  description of type records that can be referenced from
1022   //  type records referenced by symbols
1023
1024   //  type record for skip record
1025
1026   internal struct LeafSkip {
1027     // internal ushort leaf;      // LF_SKIP [TYPTYPE]
1028     internal uint type;       // (type index) next valid index
1029     internal byte[] data;       // pad data
1030   };
1031
1032   //  argument list leaf
1033
1034   internal struct LeafArgList {
1035     // internal ushort leaf;      // LF_ARGLIST [TYPTYPE]
1036     internal uint count;      // number of arguments
1037     internal uint[] arg;        // (type index) number of arguments
1038   };
1039
1040   //  derived class list leaf
1041
1042   internal struct LeafDerived {
1043     // internal ushort leaf;      // LF_DERIVED [TYPTYPE]
1044     internal uint count;      // number of arguments
1045     internal uint[] drvdcls;    // (type index) type indices of derived classes
1046   };
1047
1048   //  leaf for default arguments
1049
1050   internal struct LeafDefArg {
1051     // internal ushort leaf;      // LF_DEFARG [TYPTYPE]
1052     internal uint type;       // (type index) type of resulting expression
1053     internal byte[] expr;       // length prefixed expression string
1054   };
1055
1056   //  list leaf
1057   //      This list should no longer be used because the utilities cannot
1058   //      verify the contents of the list without knowing what type of list
1059   //      it is.  New specific leaf indices should be used instead.
1060
1061   internal struct LeafList {
1062     // internal ushort leaf;      // LF_LIST [TYPTYPE]
1063     internal byte[] data;       // data format specified by indexing type
1064   };
1065
1066   //  field list leaf
1067   //  This is the header leaf for a complex list of class and structure
1068   //  subfields.
1069
1070   internal struct LeafFieldList {
1071     // internal ushort leaf;      // LF_FIELDLIST [TYPTYPE]
1072     internal char[] data;       // field list sub lists
1073   };
1074
1075   //  type record for non-static methods and friends in overloaded method list
1076
1077   internal struct mlMethod {
1078     internal ushort attr;       // (CV_fldattr_t) method attribute
1079     internal ushort pad0;       // internal padding, must be 0
1080     internal uint index;      // (type index) index to type record for procedure
1081     internal uint[] vbaseoff;   // offset in vfunctable if intro virtual
1082   };
1083
1084   internal struct LeafMethodList {
1085     // internal ushort leaf;      // LF_METHODLIST [TYPTYPE]
1086     internal byte[] mList;      // really a mlMethod type
1087   };
1088
1089   //  type record for LF_BITFIELD
1090
1091   internal struct LeafBitfield {
1092     // internal ushort leaf;      // LF_BITFIELD [TYPTYPE]
1093     internal uint type;       // (type index) type of bitfield
1094     internal byte length;
1095     internal byte position;
1096   };
1097
1098   //  type record for dimensioned array with constant bounds
1099
1100   internal struct LeafDimCon {
1101     // internal ushort leaf;      // LF_DIMCONU or LF_DIMCONLU [TYPTYPE]
1102     internal uint typ;        // (type index) type of index
1103     internal ushort rank;       // number of dimensions
1104     internal byte[] dim;        // array of dimension information with
1105     // either upper bounds or lower/upper bound
1106   };
1107
1108   //  type record for dimensioned array with variable bounds
1109
1110   internal struct LeafDimVar {
1111     // internal ushort leaf;      // LF_DIMVARU or LF_DIMVARLU [TYPTYPE]
1112     internal uint rank;       // number of dimensions
1113     internal uint typ;        // (type index) type of index
1114     internal uint[] dim;        // (type index) array of type indices for either
1115     // variable upper bound or variable
1116     // lower/upper bound.  The count of type
1117     // indices is rank or rank*2 depending on
1118     // whether it is LFDIMVARU or LF_DIMVARLU.
1119     // The referenced types must be
1120     // LF_REFSYM or T_VOID
1121   };
1122
1123   //  type record for referenced symbol
1124
1125   internal struct LeafRefSym {
1126     // internal ushort leaf;      // LF_REFSYM [TYPTYPE]
1127     internal byte[] Sym;        // copy of referenced symbol record
1128     // (including length)
1129   };
1130
1131   //  the following are numeric leaves.  They are used to indicate the
1132   //  size of the following variable length data.  When the numeric
1133   //  data is a single byte less than 0x8000, then the data is output
1134   //  directly.  If the data is more the 0x8000 or is a negative value,
1135   //  then the data is preceeded by the proper index.
1136   //
1137
1138   //  signed character leaf
1139
1140   internal struct LeafChar {
1141     // internal ushort leaf;      // LF_CHAR [TYPTYPE]
1142     internal sbyte val;        // signed 8-bit value
1143   };
1144
1145   //  signed short leaf
1146
1147   internal struct LeafShort {
1148     // internal ushort leaf;      // LF_SHORT [TYPTYPE]
1149     internal short val;        // signed 16-bit value
1150   };
1151
1152   //  ushort leaf
1153
1154   internal struct LeafUShort {
1155     // internal ushort leaf;      // LF_ushort [TYPTYPE]
1156     internal ushort val;        // unsigned 16-bit value
1157   };
1158
1159   //  signed (32-bit) long leaf
1160
1161   internal struct LeafLong {
1162     // internal ushort leaf;      // LF_LONG [TYPTYPE]
1163     internal int val;        // signed 32-bit value
1164   };
1165
1166   //  uint    leaf
1167
1168   internal struct LeafULong {
1169     // internal ushort leaf;      // LF_ULONG [TYPTYPE]
1170     internal uint val;        // unsigned 32-bit value
1171   };
1172
1173   //  signed quad leaf
1174
1175   internal struct LeafQuad {
1176     // internal ushort leaf;      // LF_QUAD [TYPTYPE]
1177     internal long val;        // signed 64-bit value
1178   };
1179
1180   //  unsigned quad leaf
1181
1182   internal struct LeafUQuad {
1183     // internal ushort leaf;      // LF_UQUAD [TYPTYPE]
1184     internal ulong val;        // unsigned 64-bit value
1185   };
1186
1187   //  signed int128 leaf
1188
1189   internal struct LeafOct {
1190     // internal ushort leaf;      // LF_OCT [TYPTYPE]
1191     internal ulong val0;
1192     internal ulong val1;       // signed 128-bit value
1193   };
1194
1195   //  unsigned int128 leaf
1196
1197   internal struct LeafUOct {
1198     // internal ushort leaf;      // LF_UOCT [TYPTYPE]
1199     internal ulong val0;
1200     internal ulong val1;       // unsigned 128-bit value
1201   };
1202
1203   //  real 32-bit leaf
1204
1205   internal struct LeafReal32 {
1206     // internal ushort leaf;      // LF_REAL32 [TYPTYPE]
1207     internal float val;        // 32-bit real value
1208   };
1209
1210   //  real 64-bit leaf
1211
1212   internal struct LeafReal64 {
1213     // internal ushort leaf;      // LF_REAL64 [TYPTYPE]
1214     internal double val;        // 64-bit real value
1215   };
1216
1217   //  real 80-bit leaf
1218
1219   internal struct LeafReal80 {
1220     // internal ushort leaf;      // LF_REAL80 [TYPTYPE]
1221     internal FLOAT10 val;        // real 80-bit value
1222   };
1223
1224   //  real 128-bit leaf
1225
1226   internal struct LeafReal128 {
1227     // internal ushort leaf;      // LF_REAL128 [TYPTYPE]
1228     internal ulong val0;
1229     internal ulong val1;       // real 128-bit value
1230   };
1231
1232   //  complex 32-bit leaf
1233
1234   internal struct LeafCmplx32 {
1235     // internal ushort leaf;      // LF_COMPLEX32 [TYPTYPE]
1236     internal float val_real;   // real component
1237     internal float val_imag;   // imaginary component
1238   };
1239
1240   //  complex 64-bit leaf
1241
1242   internal struct LeafCmplx64 {
1243     // internal ushort leaf;      // LF_COMPLEX64 [TYPTYPE]
1244     internal double val_real;   // real component
1245     internal double val_imag;   // imaginary component
1246   };
1247
1248   //  complex 80-bit leaf
1249
1250   internal struct LeafCmplx80 {
1251     // internal ushort leaf;      // LF_COMPLEX80 [TYPTYPE]
1252     internal FLOAT10 val_real;   // real component
1253     internal FLOAT10 val_imag;   // imaginary component
1254   };
1255
1256   //  complex 128-bit leaf
1257
1258   internal struct LeafCmplx128 {
1259     // internal ushort leaf;      // LF_COMPLEX128 [TYPTYPE]
1260     internal ulong val0_real;
1261     internal ulong val1_real;  // real component
1262     internal ulong val0_imag;
1263     internal ulong val1_imag;  // imaginary component
1264   };
1265
1266   //  variable length numeric field
1267
1268   internal struct LeafVarString {
1269     // internal ushort leaf;      // LF_VARSTRING [TYPTYPE]
1270     internal ushort len;        // length of value in bytes
1271     internal byte[] value;      // value
1272   };
1273
1274   //  index leaf - contains type index of another leaf
1275   //  a major use of this leaf is to allow the compilers to emit a
1276   //  long complex list (LF_FIELD) in smaller pieces.
1277
1278   internal struct LeafIndex {
1279     // internal ushort leaf;      // LF_INDEX [TYPTYPE]
1280     internal ushort pad0;       // internal padding, must be 0
1281     internal uint index;      // (type index) type index of referenced leaf
1282   };
1283
1284   //  subfield record for base class field
1285
1286   internal struct LeafBClass {
1287     // internal ushort leaf;      // LF_BCLASS [TYPTYPE]
1288     internal ushort attr;       // (CV_fldattr_t) attribute
1289     internal uint index;      // (type index) type index of base class
1290     internal byte[] offset;     // variable length offset of base within class
1291   };
1292
1293   //  subfield record for direct and indirect virtual base class field
1294
1295   internal struct LeafVBClass {
1296     // internal ushort leaf;      // LF_VBCLASS | LV_IVBCLASS [TYPTYPE]
1297     internal ushort attr;       // (CV_fldattr_t) attribute
1298     internal uint index;      // (type index) type index of direct virtual base class
1299     internal uint vbptr;      // (type index) type index of virtual base pointer
1300     internal byte[] vbpoff;     // virtual base pointer offset from address point
1301     // followed by virtual base offset from vbtable
1302   };
1303
1304   //  subfield record for friend class
1305
1306   internal struct LeafFriendCls {
1307     // internal ushort leaf;      // LF_FRIENDCLS [TYPTYPE]
1308     internal ushort pad0;       // internal padding, must be 0
1309     internal uint index;      // (type index) index to type record of friend class
1310   };
1311
1312   //  subfield record for friend function
1313
1314   internal struct LeafFriendFcn {
1315     // internal ushort leaf;      // LF_FRIENDFCN [TYPTYPE]
1316     internal ushort pad0;       // internal padding, must be 0
1317     internal uint index;      // (type index) index to type record of friend function
1318     internal string name;       // name of friend function
1319   };
1320
1321   //  subfield record for non-static data members
1322
1323   internal struct LeafMember {
1324     // internal ushort leaf;      // LF_MEMBER [TYPTYPE]
1325     internal ushort attr;       // (CV_fldattr_t)attribute mask
1326     internal uint index;      // (type index) index of type record for field
1327     internal byte[] offset;     // variable length offset of field
1328     internal string name;       // length prefixed name of field
1329   };
1330
1331   //  type record for static data members
1332
1333   internal struct LeafSTMember {
1334     // internal ushort leaf;      // LF_STMEMBER [TYPTYPE]
1335     internal ushort attr;       // (CV_fldattr_t) attribute mask
1336     internal uint index;      // (type index) index of type record for field
1337     internal string name;       // length prefixed name of field
1338   };
1339
1340   //  subfield record for virtual function table pointer
1341
1342   internal struct LeafVFuncTab {
1343     // internal ushort leaf;      // LF_VFUNCTAB [TYPTYPE]
1344     internal ushort pad0;       // internal padding, must be 0
1345     internal uint type;       // (type index) type index of pointer
1346   };
1347
1348   //  subfield record for virtual function table pointer with offset
1349
1350   internal struct LeafVFuncOff {
1351     // internal ushort leaf;      // LF_VFUNCOFF [TYPTYPE]
1352     internal ushort pad0;       // internal padding, must be 0.
1353     internal uint type;       // (type index) type index of pointer
1354     internal int offset;     // offset of virtual function table pointer
1355   };
1356
1357   //  subfield record for overloaded method list
1358
1359   internal struct LeafMethod {
1360     // internal ushort leaf;      // LF_METHOD [TYPTYPE]
1361     internal ushort count;      // number of occurrences of function
1362     internal uint mList;      // (type index) index to LF_METHODLIST record
1363     internal string name;       // length prefixed name of method
1364   };
1365
1366   //  subfield record for nonoverloaded method
1367
1368   internal struct LeafOneMethod {
1369     // internal ushort leaf;      // LF_ONEMETHOD [TYPTYPE]
1370     internal ushort attr;       // (CV_fldattr_t) method attribute
1371     internal uint index;      // (type index) index to type record for procedure
1372     internal uint[] vbaseoff;   // offset in vfunctable if intro virtual
1373     internal string name;
1374   };
1375
1376   //  subfield record for enumerate
1377
1378   internal struct LeafEnumerate {
1379     // internal ushort leaf;      // LF_ENUMERATE [TYPTYPE]
1380     internal ushort attr;       // (CV_fldattr_t) access
1381     internal byte[] value;      // variable length value field
1382     internal string name;
1383   };
1384
1385   //  type record for nested (scoped) type definition
1386
1387   internal struct LeafNestType {
1388     // internal ushort leaf;      // LF_NESTTYPE [TYPTYPE]
1389     internal ushort pad0;       // internal padding, must be 0
1390     internal uint index;      // (type index) index of nested type definition
1391     internal string name;       // length prefixed type name
1392   };
1393
1394   //  type record for nested (scoped) type definition, with attributes
1395   //  new records for vC v5.0, no need to have 16-bit ti versions.
1396
1397   internal struct LeafNestTypeEx {
1398     // internal ushort leaf;      // LF_NESTTYPEEX [TYPTYPE]
1399     internal ushort attr;       // (CV_fldattr_t) member access
1400     internal uint index;      // (type index) index of nested type definition
1401     internal string name;       // length prefixed type name
1402   };
1403
1404   //  type record for modifications to members
1405
1406   internal struct LeafMemberModify {
1407     // internal ushort leaf;      // LF_MEMBERMODIFY [TYPTYPE]
1408     internal ushort attr;       // (CV_fldattr_t) the new attributes
1409     internal uint index;      // (type index) index of base class type definition
1410     internal string name;       // length prefixed member name
1411   };
1412
1413   //  type record for pad leaf
1414
1415   internal struct LeafPad {
1416     internal byte leaf;
1417   };
1418
1419   //  Symbol definitions
1420
1421   internal enum SYM {
1422     S_END=0x0006,  // Block, procedure, "with" or thunk end
1423     S_OEM=0x0404,  // OEM defined symbol
1424
1425     S_REGISTER_ST=0x1001,  // Register variable
1426     S_CONSTANT_ST=0x1002,  // constant symbol
1427     S_UDT_ST=0x1003,  // User defined type
1428     S_COBOLUDT_ST=0x1004,  // special UDT for cobol that does not symbol pack
1429     S_MANYREG_ST=0x1005,  // multiple register variable
1430     S_BPREL32_ST=0x1006,  // BP-relative
1431     S_LDATA32_ST=0x1007,  // Module-local symbol
1432     S_GDATA32_ST=0x1008,  // Global data symbol
1433     S_PUB32_ST=0x1009,  // a internal symbol (CV internal reserved)
1434     S_LPROC32_ST=0x100a,  // Local procedure start
1435     S_GPROC32_ST=0x100b,  // Global procedure start
1436     S_VFTABLE32=0x100c,  // address of virtual function table
1437     S_REGREL32_ST=0x100d,  // register relative address
1438     S_LTHREAD32_ST=0x100e,  // local thread storage
1439     S_GTHREAD32_ST=0x100f,  // global thread storage
1440
1441     S_LPROCMIPS_ST=0x1010,  // Local procedure start
1442     S_GPROCMIPS_ST=0x1011,  // Global procedure start
1443
1444     // new symbol records for edit and continue information
1445
1446     S_FRAMEPROC=0x1012,  // extra frame and proc information
1447     S_COMPILE2_ST=0x1013,  // extended compile flags and info
1448
1449     // new symbols necessary for 16-bit enumerates of IA64 registers
1450     // and IA64 specific symbols
1451
1452     S_MANYREG2_ST=0x1014,  // multiple register variable
1453     S_LPROCIA64_ST=0x1015,  // Local procedure start (IA64)
1454     S_GPROCIA64_ST=0x1016,  // Global procedure start (IA64)
1455
1456     // Local symbols for IL
1457     S_LOCALSLOT_ST=0x1017,  // local IL sym with field for local slot index
1458     S_PARAMSLOT_ST=0x1018,  // local IL sym with field for parameter slot index
1459
1460     S_ANNOTATION=0x1019,  // Annotation string literals
1461
1462     // symbols to support managed code debugging
1463     S_GMANPROC_ST=0x101a,  // Global proc
1464     S_LMANPROC_ST=0x101b,  // Local proc
1465     S_RESERVED1=0x101c,  // reserved
1466     S_RESERVED2=0x101d,  // reserved
1467     S_RESERVED3=0x101e,  // reserved
1468     S_RESERVED4=0x101f,  // reserved
1469     S_LMANDATA_ST=0x1020,
1470     S_GMANDATA_ST=0x1021,
1471     S_MANFRAMEREL_ST=0x1022,
1472     S_MANREGISTER_ST=0x1023,
1473     S_MANSLOT_ST=0x1024,
1474     S_MANMANYREG_ST=0x1025,
1475     S_MANREGREL_ST=0x1026,
1476     S_MANMANYREG2_ST=0x1027,
1477     S_MANTYPREF=0x1028,  // Index for type referenced by name from metadata
1478     S_UNAMESPACE_ST=0x1029,  // Using namespace
1479
1480     // Symbols w/ SZ name fields. All name fields contain utf8 encoded strings.
1481     S_ST_MAX=0x1100,  // starting point for SZ name symbols
1482
1483     S_OBJNAME=0x1101,  // path to object file name
1484     S_THUNK32=0x1102,  // Thunk Start
1485     S_BLOCK32=0x1103,  // block start
1486     S_WITH32=0x1104,  // with start
1487     S_LABEL32=0x1105,  // code label
1488     S_REGISTER=0x1106,  // Register variable
1489     S_CONSTANT=0x1107,  // constant symbol
1490     S_UDT=0x1108,  // User defined type
1491     S_COBOLUDT=0x1109,  // special UDT for cobol that does not symbol pack
1492     S_MANYREG=0x110a,  // multiple register variable
1493     S_BPREL32=0x110b,  // BP-relative
1494     S_LDATA32=0x110c,  // Module-local symbol
1495     S_GDATA32=0x110d,  // Global data symbol
1496     S_PUB32=0x110e,  // a internal symbol (CV internal reserved)
1497     S_LPROC32=0x110f,  // Local procedure start
1498     S_GPROC32=0x1110,  // Global procedure start
1499     S_REGREL32=0x1111,  // register relative address
1500     S_LTHREAD32=0x1112,  // local thread storage
1501     S_GTHREAD32=0x1113,  // global thread storage
1502
1503     S_LPROCMIPS=0x1114,  // Local procedure start
1504     S_GPROCMIPS=0x1115,  // Global procedure start
1505     S_COMPILE2=0x1116,  // extended compile flags and info
1506     S_MANYREG2=0x1117,  // multiple register variable
1507     S_LPROCIA64=0x1118,  // Local procedure start (IA64)
1508     S_GPROCIA64=0x1119,  // Global procedure start (IA64)
1509     S_LOCALSLOT=0x111a,  // local IL sym with field for local slot index
1510     S_SLOT=S_LOCALSLOT,  // alias for LOCALSLOT
1511     S_PARAMSLOT=0x111b,  // local IL sym with field for parameter slot index
1512
1513     // symbols to support managed code debugging
1514     S_LMANDATA=0x111c,
1515     S_GMANDATA=0x111d,
1516     S_MANFRAMEREL=0x111e,
1517     S_MANREGISTER=0x111f,
1518     S_MANSLOT=0x1120,
1519     S_MANMANYREG=0x1121,
1520     S_MANREGREL=0x1122,
1521     S_MANMANYREG2=0x1123,
1522     S_UNAMESPACE=0x1124,  // Using namespace
1523
1524     // ref symbols with name fields
1525     S_PROCREF=0x1125,  // Reference to a procedure
1526     S_DATAREF=0x1126,  // Reference to data
1527     S_LPROCREF=0x1127,  // Local Reference to a procedure
1528     S_ANNOTATIONREF=0x1128,  // Reference to an S_ANNOTATION symbol
1529     S_TOKENREF=0x1129,  // Reference to one of the many MANPROCSYM's
1530
1531     // continuation of managed symbols
1532     S_GMANPROC=0x112a,  // Global proc
1533     S_LMANPROC=0x112b,  // Local proc
1534
1535     // short, light-weight thunks
1536     S_TRAMPOLINE=0x112c,  // trampoline thunks
1537     S_MANCONSTANT=0x112d,  // constants with metadata type info
1538
1539     // native attributed local/parms
1540     S_ATTR_FRAMEREL=0x112e,  // relative to virtual frame ptr
1541     S_ATTR_REGISTER=0x112f,  // stored in a register
1542     S_ATTR_REGREL=0x1130,  // relative to register (alternate frame ptr)
1543     S_ATTR_MANYREG=0x1131,  // stored in >1 register
1544
1545     // Separated code (from the compiler) support
1546     S_SEPCODE=0x1132,
1547
1548     S_LOCAL=0x1133,  // defines a local symbol in optimized code
1549     S_DEFRANGE=0x1134,  // defines a single range of addresses in which symbol can be evaluated
1550     S_DEFRANGE2=0x1135,  // defines ranges of addresses in which symbol can be evaluated
1551
1552     S_SECTION=0x1136,  // A COFF section in a PE executable
1553     S_COFFGROUP=0x1137,  // A COFF group
1554     S_EXPORT=0x1138,  // A export
1555
1556     S_CALLSITEINFO=0x1139,  // Indirect call site information
1557     S_FRAMECOOKIE=0x113a,  // Security cookie information
1558
1559     S_DISCARDED=0x113b,  // Discarded by LINK /OPT:REF (experimental, see richards)
1560
1561     S_RECTYPE_MAX,              // one greater than last
1562     S_RECTYPE_LAST=S_RECTYPE_MAX - 1,
1563
1564   };
1565
1566   //  enum describing compile flag ambient data model
1567
1568   internal enum CV_CFL_DATA {
1569     CV_CFL_DNEAR=0x00,
1570     CV_CFL_DFAR=0x01,
1571     CV_CFL_DHUGE=0x02
1572   };
1573
1574   //  enum describing compile flag ambiant code model
1575
1576   internal enum CV_CFL_CODE {
1577     CV_CFL_CNEAR=0x00,
1578     CV_CFL_CFAR=0x01,
1579     CV_CFL_CHUGE=0x02
1580   };
1581
1582   //  enum describing compile flag target floating point package
1583
1584   internal enum CV_CFL_FPKG {
1585     CV_CFL_NDP=0x00,
1586     CV_CFL_EMU=0x01,
1587     CV_CFL_ALT=0x02
1588   };
1589
1590   // enum describing function return method
1591
1592   [Flags]
1593   internal enum CV_PROCFLAGS : byte {
1594     CV_PFLAG_NOFPO=0x01, // frame pointer present
1595     CV_PFLAG_INT=0x02, // interrupt return
1596     CV_PFLAG_FAR=0x04, // far return
1597     CV_PFLAG_NEVER=0x08, // function does not return
1598     CV_PFLAG_NOTREACHED=0x10, // label isn't fallen into
1599     CV_PFLAG_CUST_CALL=0x20, // custom calling convention
1600     CV_PFLAG_NOINLINE=0x40, // function marked as noinline
1601     CV_PFLAG_OPTDBGINFO=0x80, // function has debug information for optimized code
1602   };
1603
1604   // Extended proc flags
1605   //
1606   internal struct CV_EXPROCFLAGS {
1607     internal byte flags;      // (CV_PROCFLAGS)
1608     internal byte reserved;   // must be zero
1609   };
1610
1611   // local variable flags
1612   [Flags]
1613   internal enum CV_LVARFLAGS : ushort {
1614     fIsParam=0x0001,   // variable is a parameter
1615     fAddrTaken=0x0002,   // address is taken
1616     fCompGenx=0x0004,   // variable is compiler generated
1617     fIsAggregate=0x0008,   // the symbol is splitted in temporaries,
1618     // which are treated by compiler as
1619     // independent entities
1620     fIsAggregated=0x0010,   // Counterpart of fIsAggregate - tells
1621     // that it is a part of a fIsAggregate symbol
1622     fIsAliased=0x0020,   // variable has multiple simultaneous lifetimes
1623     fIsAlias=0x0040,   // represents one of the multiple simultaneous lifetimes
1624   };
1625
1626   // represents an address range, used for optimized code debug info
1627   internal struct CV_lvar_addr_range {       // defines a range of addresses
1628     internal uint offStart;
1629     internal ushort isectStart;
1630     internal uint cbRange;
1631   };
1632
1633   // enum describing function data return method
1634
1635   internal enum CV_GENERIC_STYLE {
1636     CV_GENERIC_VOID=0x00,   // void return type
1637     CV_GENERIC_REG=0x01,   // return data is in registers
1638     CV_GENERIC_ICAN=0x02,   // indirect caller allocated near
1639     CV_GENERIC_ICAF=0x03,   // indirect caller allocated far
1640     CV_GENERIC_IRAN=0x04,   // indirect returnee allocated near
1641     CV_GENERIC_IRAF=0x05,   // indirect returnee allocated far
1642     CV_GENERIC_UNUSED=0x06    // first unused
1643   };
1644
1645   [Flags]
1646   internal enum CV_GENERIC_FLAG : ushort {
1647     cstyle=0x0001,       // true push varargs right to left
1648     rsclean=0x0002,       // true if returnee stack cleanup
1649   };
1650
1651   // flag bitfields for separated code attributes
1652
1653   [Flags]
1654   internal enum CV_SEPCODEFLAGS : uint {
1655     fIsLexicalScope=0x00000001,   // S_SEPCODE doubles as lexical scope
1656     fReturnsToParent=0x00000002,   // code frag returns to parent
1657   };
1658
1659   // Generic layout for symbol records
1660
1661   internal struct SYMTYPE {
1662     internal ushort reclen;     // Record length
1663     internal ushort rectyp;     // Record type
1664     // byte        data[CV_ZEROLEN];
1665     //  SYMTYPE *NextSym (SYMTYPE * pSym) {
1666     //  return (SYMTYPE *) ((char *)pSym + pSym->reclen + sizeof(ushort));
1667     //  }
1668   };
1669
1670   //  non-model specific symbol types
1671
1672   internal struct RegSym {
1673     // internal ushort reclen;    // Record length [SYMTYPE]
1674     // internal ushort rectyp;    // S_REGISTER
1675     internal uint typind;     // (type index) Type index or Metadata token
1676     internal ushort reg;        // register enumerate
1677     internal string name;       // Length-prefixed name
1678   };
1679
1680   internal struct AttrRegSym {
1681     // internal ushort reclen;    // Record length [SYMTYPE]
1682     // internal ushort rectyp;    // S_MANREGISTER | S_ATTR_REGISTER
1683     internal uint typind;     // (type index) Type index or Metadata token
1684     internal uint offCod;     // first code address where var is live
1685     internal ushort segCod;
1686     internal ushort flags;      // (CV_LVARFLAGS)local var flags
1687     internal ushort reg;        // register enumerate
1688     internal string name;       // Length-prefixed name
1689   };
1690
1691   internal struct ManyRegSym {
1692     // internal ushort reclen;    // Record length [SYMTYPE]
1693     // internal ushort rectyp;    // S_MANYREG
1694     internal uint typind;     // (type index) Type index or metadata token
1695     internal byte count;      // count of number of registers
1696     internal byte[] reg;        // count register enumerates, most-sig first
1697     internal string name;       // length-prefixed name.
1698   };
1699
1700   internal struct ManyRegSym2 {
1701     // internal ushort reclen;    // Record length [SYMTYPE]
1702     // internal ushort rectyp;    // S_MANYREG2
1703     internal uint typind;     // (type index) Type index or metadata token
1704     internal ushort count;      // count of number of registers,
1705     internal ushort[] reg;        // count register enumerates, most-sig first
1706     internal string name;       // length-prefixed name.
1707   };
1708
1709   internal struct AttrManyRegSym {
1710     // internal ushort reclen;    // Record length [SYMTYPE]
1711     // internal ushort rectyp;    // S_MANMANYREG
1712     internal uint typind;     // (type index) Type index or metadata token
1713     internal uint offCod;     // first code address where var is live
1714     internal ushort segCod;
1715     internal ushort flags;      // (CV_LVARFLAGS)local var flags
1716     internal byte count;      // count of number of registers
1717     internal byte[] reg;        // count register enumerates, most-sig first
1718     internal string name;       // utf-8 encoded zero terminate name
1719   };
1720
1721   internal struct AttrManyRegSym2 {
1722     // internal ushort reclen;    // Record length [SYMTYPE]
1723     // internal ushort rectyp;    // S_MANMANYREG2 | S_ATTR_MANYREG
1724     internal uint typind;     // (type index) Type index or metadata token
1725     internal uint offCod;     // first code address where var is live
1726     internal ushort segCod;
1727     internal ushort flags;      // (CV_LVARFLAGS)local var flags
1728     internal ushort count;      // count of number of registers
1729     internal ushort[] reg;        // count register enumerates, most-sig first
1730     internal string name;       // utf-8 encoded zero terminate name
1731   };
1732
1733   internal struct ConstSym {
1734     // internal ushort reclen;    // Record length [SYMTYPE]
1735     // internal ushort rectyp;    // S_CONSTANT or S_MANCONSTANT
1736     internal uint typind;     // (type index) Type index (containing enum if enumerate) or metadata token
1737     internal ushort value;      // numeric leaf containing value
1738     internal string name;       // Length-prefixed name
1739   };
1740
1741   internal struct UdtSym {
1742     // internal ushort reclen;    // Record length [SYMTYPE]
1743     // internal ushort rectyp;    // S_UDT | S_COBOLUDT
1744     internal uint typind;     // (type index) Type index
1745     internal string name;       // Length-prefixed name
1746   };
1747
1748   internal struct ManyTypRef {
1749     // internal ushort reclen;    // Record length [SYMTYPE]
1750     // internal ushort rectyp;    // S_MANTYPREF
1751     internal uint typind;     // (type index) Type index
1752   };
1753
1754   internal struct SearchSym {
1755     // internal ushort reclen;    // Record length [SYMTYPE]
1756     // internal ushort rectyp;    // S_SSEARCH
1757     internal uint startsym;   // offset of the procedure
1758     internal ushort seg;        // segment of symbol
1759   };
1760
1761   [Flags]
1762   internal enum CFLAGSYM_FLAGS : ushort {
1763     pcode=0x0001,   // true if pcode present
1764     floatprec=0x0006,   // floating precision
1765     floatpkg=0x0018,   // float package
1766     ambdata=0x00e0,   // ambient data model
1767     ambcode=0x0700,   // ambient code model
1768     mode32=0x0800,   // true if compiled 32 bit mode
1769   };
1770
1771   internal struct CFlagSym {
1772     // internal ushort reclen;    // Record length [SYMTYPE]
1773     // internal ushort rectyp;    // S_COMPILE
1774     internal byte machine;    // target processor
1775     internal byte language;   // language index
1776     internal ushort flags;      // (CFLAGSYM_FLAGS)
1777     internal string ver;        // Length-prefixed compiler version string
1778   };
1779
1780   [Flags]
1781   internal enum COMPILESYM_FLAGS : uint {
1782     iLanguage=0x000000ff,   // language index
1783     fEC=0x00000100,   // compiled for E/C
1784     fNoDbgInfo=0x00000200,   // not compiled with debug info
1785     fLTCG=0x00000400,   // compiled with LTCG
1786     fNoDataAlign=0x00000800,   // compiled with -Bzalign
1787     fManagedPresent=0x00001000,   // managed code/data present
1788     fSecurityChecks=0x00002000,   // compiled with /GS
1789     fHotPatch=0x00004000,   // compiled with /hotpatch
1790     fCVTCIL=0x00008000,   // converted with CVTCIL
1791     fMSILModule=0x00010000,   // MSIL netmodule
1792   };
1793
1794   internal struct CompileSym {
1795     // internal ushort reclen;    // Record length [SYMTYPE]
1796     // internal ushort rectyp;    // S_COMPILE2
1797     internal uint flags;      // (COMPILESYM_FLAGS)
1798     internal ushort machine;    // target processor
1799     internal ushort verFEMajor; // front end major version #
1800     internal ushort verFEMinor; // front end minor version #
1801     internal ushort verFEBuild; // front end build version #
1802     internal ushort verMajor;   // back end major version #
1803     internal ushort verMinor;   // back end minor version #
1804     internal ushort verBuild;   // back end build version #
1805     internal string verSt;      // Length-prefixed compiler version string, followed
1806     internal string[] verArgs;    // block of zero terminated strings, ended by double-zero.
1807   };
1808
1809   internal struct ObjNameSym {
1810     // internal ushort reclen;    // Record length [SYMTYPE]
1811     // internal ushort rectyp;    // S_OBJNAME
1812     internal uint signature;  // signature
1813     internal string name;       // Length-prefixed name
1814   };
1815
1816   internal struct EndArgSym {
1817     // internal ushort reclen;    // Record length [SYMTYPE]
1818     // internal ushort rectyp;    // S_ENDARG
1819   };
1820
1821   internal struct ReturnSym {
1822     // internal ushort reclen;    // Record length [SYMTYPE]
1823     // internal ushort rectyp;    // S_RETURN
1824     internal CV_GENERIC_FLAG flags; // flags
1825     internal byte style;      // CV_GENERIC_STYLE return style
1826     // followed by return method data
1827   };
1828
1829   internal struct EntryThisSym {
1830     // internal ushort reclen;    // Record length [SYMTYPE]
1831     // internal ushort rectyp;    // S_ENTRYTHIS
1832     internal byte thissym;    // symbol describing this pointer on entry
1833   };
1834
1835   internal struct BpRelSym32 {
1836     // internal ushort reclen;    // Record length [SYMTYPE]
1837     // internal ushort rectyp;    // S_BPREL32
1838     internal int off;        // BP-relative offset
1839     internal uint typind;     // (type index) Type index or Metadata token
1840     internal string name;       // Length-prefixed name
1841   };
1842
1843   internal struct FrameRelSym {
1844     // internal ushort reclen;    // Record length [SYMTYPE]
1845     // internal ushort rectyp;    // S_MANFRAMEREL | S_ATTR_FRAMEREL
1846     internal int off;        // Frame relative offset
1847     internal uint typind;     // (type index) Type index or Metadata token
1848     internal uint offCod;     // first code address where var is live
1849     internal ushort segCod;
1850     internal ushort flags;      // (CV_LVARFLAGS)local var flags
1851     internal string name;       // Length-prefixed name
1852   };
1853
1854   internal struct SlotSym32 {
1855     // internal ushort reclen;    // Record length [SYMTYPE]
1856     // internal ushort rectyp;    // S_LOCALSLOT or S_PARAMSLOT
1857     internal uint index;      // slot index
1858     internal uint typind;     // (type index) Type index or Metadata token
1859     internal string name;       // Length-prefixed name
1860   };
1861
1862   internal struct AttrSlotSym {
1863     // internal ushort reclen;    // Record length [SYMTYPE]
1864     // internal ushort rectyp;    // S_MANSLOT
1865     internal uint index;      // slot index
1866     internal uint typind;     // (type index) Type index or Metadata token
1867     internal uint offCod;     // first code address where var is live
1868     internal ushort segCod;
1869     internal ushort flags;      // (CV_LVARFLAGS)local var flags
1870     internal string name;       // Length-prefixed name
1871
1872   };
1873
1874   internal struct AnnotationSym {
1875     // internal ushort reclen;    // Record length [SYMTYPE]
1876     // internal ushort rectyp;    // S_ANNOTATION
1877     internal uint off;
1878     internal ushort seg;
1879     internal ushort csz;        // Count of zero terminated annotation strings
1880     internal string[] rgsz;       // Sequence of zero terminated annotation strings
1881   };
1882
1883   internal struct DatasSym32 {
1884     // internal ushort reclen;    // Record length [SYMTYPE]
1885     // internal ushort rectyp;    // S_LDATA32, S_GDATA32 or S_PUB32, S_LMANDATA, S_GMANDATA
1886     internal uint typind;     // (type index) Type index, or Metadata token if a managed symbol
1887     internal uint off;
1888     internal ushort seg;
1889     internal string name;       // Length-prefixed name
1890   };
1891
1892   [Flags]
1893   internal enum CV_PUBSYMFLAGS : uint {
1894     fNone=0,
1895     fCode=0x00000001,     // set if internal symbol refers to a code address
1896     fFunction=0x00000002,     // set if internal symbol is a function
1897     fManaged=0x00000004,     // set if managed code (native or IL)
1898     fMSIL=0x00000008,     // set if managed IL code
1899   };
1900
1901   internal struct PubSym32 {
1902     // internal ushort reclen;    // Record length [SYMTYPE]
1903     // internal ushort rectyp;    // S_PUB32
1904     internal uint flags;      // (CV_PUBSYMFLAGS)
1905     internal uint off;
1906     internal ushort seg;
1907     internal string name;       // Length-prefixed name
1908   };
1909
1910   internal struct ProcSym32 {
1911     // internal ushort reclen;    // Record length [SYMTYPE]
1912     // internal ushort rectyp;    // S_GPROC32 or S_LPROC32
1913     internal uint parent;     // pointer to the parent
1914     internal uint end;        // pointer to this blocks end
1915     internal uint next;       // pointer to next symbol
1916     internal uint len;        // Proc length
1917     internal uint dbgStart;   // Debug start offset
1918     internal uint dbgEnd;     // Debug end offset
1919     internal uint typind;     // (type index) Type index
1920     internal uint off;
1921     internal ushort seg;
1922     internal byte flags;      // (CV_PROCFLAGS) Proc flags
1923     internal string name;       // Length-prefixed name
1924   };
1925
1926   internal struct ManProcSym {
1927     // internal ushort reclen;    // Record length [SYMTYPE]
1928     // internal ushort rectyp;    // S_GMANPROC, S_LMANPROC, S_GMANPROCIA64 or S_LMANPROCIA64
1929     internal uint parent;     // pointer to the parent
1930     internal uint end;        // pointer to this blocks end
1931     internal uint next;       // pointer to next symbol
1932     internal uint len;        // Proc length
1933     internal uint dbgStart;   // Debug start offset
1934     internal uint dbgEnd;     // Debug end offset
1935     internal uint token;      // COM+ metadata token for method
1936     internal uint off;
1937     internal ushort seg;
1938     internal byte flags;      // (CV_PROCFLAGS) Proc flags
1939     internal ushort retReg;     // Register return value is in (may not be used for all archs)
1940     internal string name;       // optional name field
1941   };
1942
1943   internal struct ManProcSymMips {
1944     // internal ushort reclen;    // Record length [SYMTYPE]
1945     // internal ushort rectyp;    // S_GMANPROCMIPS or S_LMANPROCMIPS
1946     internal uint parent;     // pointer to the parent
1947     internal uint end;        // pointer to this blocks end
1948     internal uint next;       // pointer to next symbol
1949     internal uint len;        // Proc length
1950     internal uint dbgStart;   // Debug start offset
1951     internal uint dbgEnd;     // Debug end offset
1952     internal uint regSave;    // int register save mask
1953     internal uint fpSave;     // fp register save mask
1954     internal uint intOff;     // int register save offset
1955     internal uint fpOff;      // fp register save offset
1956     internal uint token;      // COM+ token type
1957     internal uint off;
1958     internal ushort seg;
1959     internal byte retReg;     // Register return value is in
1960     internal byte frameReg;   // Frame pointer register
1961     internal string name;       // optional name field
1962   };
1963
1964   internal struct ThunkSym32 {
1965     // internal ushort reclen;    // Record length [SYMTYPE]
1966     // internal ushort rectyp;    // S_THUNK32
1967     internal uint parent;     // pointer to the parent
1968     internal uint end;        // pointer to this blocks end
1969     internal uint next;       // pointer to next symbol
1970     internal uint off;
1971     internal ushort seg;
1972     internal ushort len;        // length of thunk
1973     internal byte ord;        // THUNK_ORDINAL specifying type of thunk
1974     internal string name;       // Length-prefixed name
1975     internal byte[] variant;    // variant portion of thunk
1976   };
1977
1978   internal enum TRAMP {             // Trampoline subtype
1979     trampIncremental,           // incremental thunks
1980     trampBranchIsland,          // Branch island thunks
1981   };
1982
1983   internal struct TrampolineSym {   // Trampoline thunk symbol
1984     // internal ushort reclen;    // Record length [SYMTYPE]
1985     // internal ushort rectyp;    // S_TRAMPOLINE
1986     internal ushort trampType;  // trampoline sym subtype
1987     internal ushort cbThunk;    // size of the thunk
1988     internal uint offThunk;   // offset of the thunk
1989     internal uint offTarget;  // offset of the target of the thunk
1990     internal ushort sectThunk;  // section index of the thunk
1991     internal ushort sectTarget; // section index of the target of the thunk
1992   };
1993
1994   internal struct LabelSym32 {
1995     // internal ushort reclen;    // Record length [SYMTYPE]
1996     // internal ushort rectyp;    // S_LABEL32
1997     internal uint off;
1998     internal ushort seg;
1999     internal byte flags;      // (CV_PROCFLAGS) flags
2000     internal string name;       // Length-prefixed name
2001   };
2002
2003   internal struct BlockSym32 {
2004     // internal ushort reclen;    // Record length [SYMTYPE]
2005     // internal ushort rectyp;    // S_BLOCK32
2006     internal uint parent;     // pointer to the parent
2007     internal uint end;        // pointer to this blocks end
2008     internal uint len;        // Block length
2009     internal uint off;        // Offset in code segment
2010     internal ushort seg;        // segment of label
2011     internal string name;       // Length-prefixed name
2012   };
2013
2014   internal struct WithSym32 {
2015     // internal ushort reclen;    // Record length [SYMTYPE]
2016     // internal ushort rectyp;    // S_WITH32
2017     internal uint parent;     // pointer to the parent
2018     internal uint end;        // pointer to this blocks end
2019     internal uint len;        // Block length
2020     internal uint off;        // Offset in code segment
2021     internal ushort seg;        // segment of label
2022     internal string expr;       // Length-prefixed expression string
2023   };
2024
2025   internal struct VpathSym32 {
2026     // internal ushort reclen;    // record length
2027     // internal ushort rectyp;    // S_VFTABLE32
2028     internal uint root;       // (type index) type index of the root of path
2029     internal uint path;       // (type index) type index of the path record
2030     internal uint off;        // offset of virtual function table
2031     internal ushort seg;        // segment of virtual function table
2032   };
2033
2034   internal struct RegRel32 {
2035     // internal ushort reclen;    // Record length [SYMTYPE]
2036     // internal ushort rectyp;    // S_REGREL32
2037     internal uint off;        // offset of symbol
2038     internal uint typind;     // (type index) Type index or metadata token
2039     internal ushort reg;        // register index for symbol
2040     internal string name;       // Length-prefixed name
2041   };
2042
2043   internal struct AttrRegRel {
2044     // internal ushort reclen;    // Record length [SYMTYPE]
2045     // internal ushort rectyp;    // S_MANREGREL | S_ATTR_REGREL
2046     internal uint off;        // offset of symbol
2047     internal uint typind;     // (type index) Type index or metadata token
2048     internal ushort reg;        // register index for symbol
2049     internal uint offCod;     // first code address where var is live
2050     internal ushort segCod;
2051     internal ushort flags;      // (CV_LVARFLAGS)local var flags
2052     internal string name;       // Length-prefixed name
2053   };
2054
2055   internal struct ThreadSym32 {
2056     // internal ushort reclen;    // record length
2057     // internal ushort rectyp;    // S_LTHREAD32 | S_GTHREAD32
2058     internal uint typind;     // (type index) type index
2059     internal uint off;        // offset into thread storage
2060     internal ushort seg;        // segment of thread storage
2061     internal string name;       // length prefixed name
2062   };
2063
2064   internal struct Slink32 {
2065     // internal ushort reclen;    // record length
2066     // internal ushort rectyp;    // S_SLINK32
2067     internal uint framesize;  // frame size of parent procedure
2068     internal int off;        // signed offset where the static link was saved relative to the value of reg
2069     internal ushort reg;
2070   };
2071
2072   internal struct ProcSymMips {
2073     // internal ushort reclen;    // Record length [SYMTYPE]
2074     // internal ushort rectyp;    // S_GPROCMIPS or S_LPROCMIPS
2075     internal uint parent;     // pointer to the parent
2076     internal uint end;        // pointer to this blocks end
2077     internal uint next;       // pointer to next symbol
2078     internal uint len;        // Proc length
2079     internal uint dbgStart;   // Debug start offset
2080     internal uint dbgEnd;     // Debug end offset
2081     internal uint regSave;    // int register save mask
2082     internal uint fpSave;     // fp register save mask
2083     internal uint intOff;     // int register save offset
2084     internal uint fpOff;      // fp register save offset
2085     internal uint typind;     // (type index) Type index
2086     internal uint off;        // Symbol offset
2087     internal ushort seg;        // Symbol segment
2088     internal byte retReg;     // Register return value is in
2089     internal byte frameReg;   // Frame pointer register
2090     internal string name;       // Length-prefixed name
2091   };
2092
2093   internal struct ProcSymIa64 {
2094     // internal ushort reclen;    // Record length [SYMTYPE]
2095     // internal ushort rectyp;    // S_GPROCIA64 or S_LPROCIA64
2096     internal uint parent;     // pointer to the parent
2097     internal uint end;        // pointer to this blocks end
2098     internal uint next;       // pointer to next symbol
2099     internal uint len;        // Proc length
2100     internal uint dbgStart;   // Debug start offset
2101     internal uint dbgEnd;     // Debug end offset
2102     internal uint typind;     // (type index) Type index
2103     internal uint off;        // Symbol offset
2104     internal ushort seg;        // Symbol segment
2105     internal ushort retReg;     // Register return value is in
2106     internal byte flags;      // (CV_PROCFLAGS) Proc flags
2107     internal string name;       // Length-prefixed name
2108   };
2109
2110   internal struct RefSym {
2111     // internal ushort reclen;    // Record length [SYMTYPE]
2112     // internal ushort rectyp;    // S_PROCREF_ST, S_DATAREF_ST, or S_LPROCREF_ST
2113     internal uint sumName;    // SUC of the name
2114     internal uint ibSym;      // Offset of actual symbol in $$Symbols
2115     internal ushort imod;       // Module containing the actual symbol
2116     internal ushort usFill;     // align this record
2117   };
2118
2119   internal struct RefSym2 {
2120     // internal ushort reclen;    // Record length [SYMTYPE]
2121     // internal ushort rectyp;    // S_PROCREF, S_DATAREF, or S_LPROCREF
2122     internal uint sumName;    // SUC of the name
2123     internal uint ibSym;      // Offset of actual symbol in $$Symbols
2124     internal ushort imod;       // Module containing the actual symbol
2125     internal string name;       // hidden name made a first class member
2126   };
2127
2128   internal struct AlignSym {
2129     // internal ushort reclen;    // Record length [SYMTYPE]
2130     // internal ushort rectyp;    // S_ALIGN
2131   };
2132
2133   internal struct OemSymbol {
2134     // internal ushort reclen;    // Record length [SYMTYPE]
2135     // internal ushort rectyp;    // S_OEM
2136     internal Guid idOem;      // an oem ID (GUID)
2137     internal uint typind;     // (type index) Type index
2138     internal byte[] rgl;        // user data, force 4-byte alignment
2139   };
2140
2141   [Flags]
2142   internal enum FRAMEPROCSYM_FLAGS : uint {
2143     fHasAlloca=0x00000001,   // function uses _alloca()
2144     fHasSetJmp=0x00000002,   // function uses setjmp()
2145     fHasLongJmp=0x00000004,   // function uses longjmp()
2146     fHasInlAsm=0x00000008,   // function uses inline asm
2147     fHasEH=0x00000010,   // function has EH states
2148     fInlSpec=0x00000020,   // function was speced as inline
2149     fHasSEH=0x00000040,   // function has SEH
2150     fNaked=0x00000080,   // function is __declspec(naked)
2151     fSecurityChecks=0x00000100,   // function has buffer security check introduced by /GS.
2152     fAsyncEH=0x00000200,   // function compiled with /EHa
2153     fGSNoStackOrdering=0x00000400,   // function has /GS buffer checks, but stack ordering couldn't be done
2154     fWasInlined=0x00000800,   // function was inlined within another function
2155   };
2156
2157   internal struct FrameProcSym {
2158     // internal ushort reclen;    // Record length [SYMTYPE]
2159     // internal ushort rectyp;    // S_FRAMEPROC
2160     internal uint cbFrame;    // count of bytes of total frame of procedure
2161     internal uint cbPad;      // count of bytes of padding in the frame
2162     internal uint offPad;     // offset (rel to frame) to where padding starts
2163     internal uint cbSaveRegs; // count of bytes of callee save registers
2164     internal uint offExHdlr;  // offset of exception handler
2165     internal ushort secExHdlr;  // section id of exception handler
2166     internal uint flags;      // (FRAMEPROCSYM_FLAGS)
2167   }
2168
2169   internal struct UnamespaceSym {
2170     // internal ushort reclen;    // Record length [SYMTYPE]
2171     // internal ushort rectyp;    // S_UNAMESPACE
2172     internal string name;       // name
2173   };
2174
2175   internal struct SepCodSym {
2176     // internal ushort reclen;    // Record length [SYMTYPE]
2177     // internal ushort rectyp;    // S_SEPCODE
2178     internal uint parent;     // pointer to the parent
2179     internal uint end;        // pointer to this block's end
2180     internal uint length;     // count of bytes of this block
2181     internal uint scf;        // (CV_SEPCODEFLAGS) flags
2182     internal uint off;        // sec:off of the separated code
2183     internal uint offParent;  // secParent:offParent of the enclosing scope
2184     internal ushort sec;        //  (proc, block, or sepcode)
2185     internal ushort secParent;
2186   };
2187
2188   internal struct LocalSym {
2189     // internal ushort reclen;    // Record length [SYMTYPE]
2190     // internal ushort rectyp;    // S_LOCAL
2191     internal uint id;         // id of the local
2192     internal uint typind;     // (type index) type index
2193     internal ushort flags;      // (CV_LVARFLAGS) local var flags
2194     internal uint idParent;   // This is is parent variable - fIsAggregated or fIsAlias
2195     internal uint offParent;  // Offset in parent variable - fIsAggregated
2196
2197     internal uint expr;       // NI of expression that this temp holds
2198     internal uint pad0;       // pad, must be zero
2199     internal uint pad1;       // pad, must be zero
2200
2201     internal string name;       // Name of this symbol.
2202   }
2203
2204   internal struct DefRangeSym {
2205     // internal ushort reclen;    // Record length [SYMTYPE]
2206     // internal ushort rectyp;    // S_DEFRANGE
2207
2208     internal uint id;         // ID of the local symbol for which this formula holds
2209     internal uint program;    // program to evaluate the value of the symbol
2210
2211     internal CV_lvar_addr_range range;   // Range of addresses where this program is valid
2212   };
2213
2214   internal struct DefRangeSym2 {
2215     // internal ushort reclen;    // Record length [SYMTYPE]
2216     // internal ushort rectyp;    // S_DEFRANGE2
2217
2218     internal uint id;         // ID of the local symbol for which this formula holds
2219     internal uint program;    // program to evaluate the value of the symbol
2220
2221     internal ushort count;      // count of CV_lvar_addr_range records following
2222     internal CV_lvar_addr_range[] range;// Range of addresses where this program is valid
2223   };
2224
2225   internal struct SectionSym {
2226     // internal ushort reclen     // Record length
2227     // internal ushort rectyp;    // S_SECTION
2228
2229     internal ushort isec;       // Section number
2230     internal byte align;      // Alignment of this section (power of 2)
2231     internal byte bReserved;  // Reserved.  Must be zero.
2232     internal uint rva;
2233     internal uint cb;
2234     internal uint characteristics;
2235     internal string name;       // name
2236   };
2237
2238   internal struct CoffGroupSym {
2239     // internal ushort reclen;    // Record length [SYMTYPE]
2240     // internal ushort rectyp;    // S_COFFGROUP
2241
2242     internal uint cb;
2243     internal uint characteristics;
2244     internal uint off;        // Symbol offset
2245     internal ushort seg;        // Symbol segment
2246     internal string name;       // name
2247   };
2248
2249   [Flags]
2250   internal enum EXPORTSYM_FLAGS : ushort {
2251     fConstant=0x0001,   // CONSTANT
2252     fData=0x0002,   // DATA
2253     fPrivate=0x0004,   // PRIVATE
2254     fNoName=0x0008,   // NONAME
2255     fOrdinal=0x0010,   // Ordinal was explicitly assigned
2256     fForwarder=0x0020,   // This is a forwarder
2257   }
2258
2259   internal struct ExportSym {
2260     // internal ushort reclen;    // Record length [SYMTYPE]
2261     // internal ushort rectyp;    // S_EXPORT
2262
2263     internal ushort ordinal;
2264     internal ushort flags;      // (EXPORTSYM_FLAGS)
2265     internal string name;       // name of
2266   };
2267
2268   //
2269   // Symbol for describing indirect calls when they are using
2270   // a function pointer cast on some other type or temporary.
2271   // Typical content will be an LF_POINTER to an LF_PROCEDURE
2272   // type record that should mimic an actual variable with the
2273   // function pointer type in question.
2274   //
2275   // Since the compiler can sometimes tail-merge a function call
2276   // through a function pointer, there may be more than one
2277   // S_CALLSITEINFO record at an address.  This is similar to what
2278   // you could do in your own code by:
2279   //
2280   //  if (expr)
2281   //  pfn = &function1;
2282   //  else
2283   //  pfn = &function2;
2284   //
2285   //  (*pfn)(arg list);
2286   //
2287
2288   internal struct CallsiteInfo {
2289     // internal ushort reclen;    // Record length [SYMTYPE]
2290     // internal ushort rectyp;    // S_CALLSITEINFO
2291     internal int off;        // offset of call site
2292     internal ushort ect;        // section index of call site
2293     internal ushort pad0;       // alignment padding field, must be zero
2294     internal uint typind;     // (type index) type index describing function signature
2295   };
2296
2297   // Frame cookie information
2298
2299   internal enum CV_cookietype {
2300     CV_COOKIETYPE_COPY=0,
2301     CV_COOKIETYPE_XOR_SP,
2302     CV_COOKIETYPE_XOR_BP,
2303     CV_COOKIETYPE_XOR_R13,
2304   };
2305
2306   // Symbol for describing security cookie's position and type
2307   // (raw, xor'd with esp, xor'd with ebp).
2308
2309   internal struct FrameCookie {
2310     // internal ushort reclen;    // Record length [SYMTYPE]
2311     // internal ushort rectyp;    // S_FRAMECOOKIE
2312     internal int off;        // Frame relative offset
2313     internal ushort reg;        // Register index
2314     internal int cookietype; // (CV_cookietype) Type of the cookie
2315     internal byte flags;      // Flags describing this cookie
2316   };
2317
2318   internal enum CV_DISCARDED : uint {
2319     CV_DISCARDED_UNKNOWN=0,
2320     CV_DISCARDED_NOT_SELECTED=1,
2321     CV_DISCARDED_NOT_REFERENCED=2,
2322   };
2323
2324   internal struct DiscardedSym {
2325     // internal ushort reclen;    // Record length [SYMTYPE]
2326     // internal ushort rectyp;    // S_DISCARDED
2327     internal CV_DISCARDED iscarded;
2328     internal uint fileid;     // First FILEID if line number info present
2329     internal uint linenum;    // First line number
2330     internal byte[] data;       // Original record(s) with invalid indices
2331   };
2332
2333   //
2334   // V7 line number data types
2335   //
2336
2337   internal enum DEBUG_S_SUBSECTION_TYPE : uint {
2338     DEBUG_S_IGNORE=0x80000000,   // if this bit is set in a subsection type then ignore the subsection contents
2339
2340     DEBUG_S_SYMBOLS=0xf1,
2341     DEBUG_S_LINES=0xf2,
2342     DEBUG_S_STRINGTABLE=0xf3,
2343     DEBUG_S_FILECHKSMS=0xf4,
2344     DEBUG_S_FRAMEDATA=0xf5,
2345   };
2346
2347   //
2348   // Line flags (data present)
2349   //
2350   internal enum CV_LINE_SUBSECTION_FLAGS : ushort {
2351     CV_LINES_HAVE_COLUMNS=0x0001,
2352   }
2353
2354   internal struct CV_LineSection {
2355     internal uint off;
2356     internal ushort sec;
2357     internal ushort flags;
2358     internal uint cod;
2359   }
2360
2361   internal struct CV_SourceFile {
2362     internal uint index;          // Index to file in checksum section.
2363     internal uint count;          // Number of CV_Line records.
2364     internal uint linsiz;         // Size of CV_Line recods.
2365   }
2366
2367   [Flags]
2368   internal enum CV_Line_Flags : uint {
2369     linenumStart=0x00ffffff,   // line where statement/expression starts
2370     deltaLineEnd=0x7f000000,   // delta to line where statement ends (optional)
2371     fStatement=0x80000000,   // true if a statement linenumber, else an expression line num
2372   };
2373
2374   internal struct CV_Line {
2375     internal uint offset;         // Offset to start of code bytes for line number
2376     internal uint flags;          // (CV_Line_Flags)
2377   };
2378
2379   internal struct CV_Column {
2380     internal ushort offColumnStart;
2381     internal ushort offColumnEnd;
2382   };
2383
2384   //  File information
2385
2386   internal enum CV_FILE_CHECKSUM_TYPE : byte {
2387     None=0,
2388     MD5=1,
2389   };
2390
2391   internal struct CV_FileCheckSum {
2392     internal uint name;           // Index of name in name table.
2393     internal byte len;            // Hash length
2394     internal byte type;           // Hash type
2395   }
2396
2397   [Flags]
2398   internal enum FRAMEDATA_FLAGS : uint {
2399     fHasSEH=0x00000001,
2400     fHasEH=0x00000002,
2401     fIsFunctionStart=0x00000004,
2402   };
2403
2404   internal struct FrameData {
2405     internal uint ulRvaStart;
2406     internal uint cbBlock;
2407     internal uint cbLocals;
2408     internal uint cbParams;
2409     internal uint cbStkMax;
2410     internal uint frameFunc;
2411     internal ushort cbProlog;
2412     internal ushort cbSavedRegs;
2413     internal uint flags;          // (FRAMEDATA_FLAGS)
2414   };
2415
2416   internal struct XFixupData {
2417     internal ushort wType;
2418     internal ushort wExtra;
2419     internal uint rva;
2420     internal uint rvaTarget;
2421   };
2422
2423   internal enum DEBUG_S_SUBSECTION {
2424     SYMBOLS=0xF1,
2425     LINES=0xF2,
2426     STRINGTABLE=0xF3,
2427     FILECHKSMS=0xF4,
2428     FRAMEDATA=0xF5,
2429   }
2430 }