Debian Codegraph @

external/cecil/symbols/pdb/Microsoft.Cci.Pdb/CvInfo.cs

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