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