This repository has been archived by the owner on Mar 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
PDBHeaders.h
1848 lines (1531 loc) · 51 KB
/
PDBHeaders.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* -*- Mode: C++; ; indent-tabs-mode: t; c-file-style: "linux" -*- */
// Copyright (C) 2013 Jake Shadle
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// Original author: Jake Shadle <[email protected]>
#pragma once
#include <stdint.h>
#ifdef _WIN32
#include <Guiddef.h>
#endif
namespace google_breakpad
{
// All the structs here are read in-place from the PDB, so they need to be packed to match their figurative size
#pragma pack(push, 1)
#ifndef _WIN32
struct GUID
{
uint32_t Data1;
uint16_t Data2;
uint16_t Data3;
uint8_t Data4[8];
};
#endif
struct PDBHeader
{
char signature[32];
int32_t pageSize;
int32_t freePageMap;
int32_t pagesUsed;
int32_t directorySize;
uint32_t reserved;
};
struct NameIndexHeader
{
uint32_t version;
uint32_t timeDateStamp;
uint32_t age;
GUID guid;
uint32_t names;
};
struct DBIHeader
{
uint32_t signature; // 0xFFFFFFFF
uint32_t version;
uint32_t age;
int16_t gssymStream;
uint16_t vers;
int16_t pssymStream;
uint16_t pdbVersion;
int16_t symRecordStream; // Stream index containing global symbols
uint16_t pdbVersion2;
uint32_t moduleSize;
uint32_t secConSize;
uint32_t secMapSize;
uint32_t fileInfoSize;
uint32_t srcModuleSize;
uint32_t mfcIndex;
uint32_t dbgHeaderSize;
uint32_t ecInfoSize;
uint16_t flags;
uint16_t machine; // ImageFileMachine
uint32_t reserved;
};
struct DBIDebugHeader
{
uint16_t FPO;
uint16_t exception;
uint16_t fixup;
uint16_t omapToSource;
uint16_t omapFromSource;
uint16_t sectionHdr;
uint16_t tokenRidMap;
uint16_t XData;
uint16_t PData;
uint16_t newFPO;
uint16_t sectionHdrOriginal;
};
struct DBISecCon
{
int16_t section;
uint16_t padding1;
int32_t offset;
uint32_t size;
uint32_t flags;
int16_t module;
uint16_t pad2;
uint32_t dataCrc;
uint32_t relocCrc;
};
struct DBIModuleInfo
{
int32_t opened;
DBISecCon sector;
uint16_t lags;
int16_t stream;
int32_t cbSyms;
int32_t cbOldLines;
int32_t cbLines;
int16_t files;
int16_t padding;
uint32_t offsets;
int32_t niSource;
int32_t niCompiler;
// const char* moduleName;
// const char* objectName;
};
struct OffCb
{
int32_t off;
int32_t cb;
};
struct TypeInfoHeader
{
uint32_t version;
int32_t headerSize;
uint32_t min;
uint32_t max;
uint32_t followSize;
uint16_t sn;
uint16_t padding;
int32_t hashKey;
int32_t buckets;
OffCb hashVals;
OffCb tiOff;
OffCb hashAdjust;
};
struct float10
{
int8_t val[10];
};
struct CV_SIGNATURE
{
enum Enum
{
C6=0, // Actual signature is >64K
C7=1, // First explicit signature
C11=2, // C11 (vc5.x) 32-bit types
C13=4, // C13 (vc7.x) zero terminated names
RESERVERD=5, // All signatures from 5 to 64K are reserved
};
};
// CodeView Symbol and Type OMF type information is broken up into two
// ranges. Type indices less than 0x1000 describe type information
// that is frequently used. Type indices above 0x1000 are used to
// describe more complex features such as functions, arrays and
// structures.
//
// Primitive types have predefined meaning that is encoded in the
// values of the various bit fields in the value.
//
// A CodeView primitive type is defined as:
//
// 1 1
// 1 089 7654 3 210
// r mode type r sub
//
// Where
// mode is the pointer mode
// type is a type indicator
// sub is a subtype enumeration
// r is a reserved field
//
// See Microsoft Symbol and Type OMF (Version 4.0) for more
// information.
//
// pointer mode enumeration values
struct CV_prmode
{
enum Enum
{
CV_TM_DIRECT=0, // mode is not a pointer
CV_TM_NPTR32=4, // mode is a 32 bit near pointer
CV_TM_NPTR64=6, // mode is a 64 bit near pointer
CV_TM_NPTR128=7, // mode is a 128 bit near pointer
};
};
// type enumeration values
struct CV_type
{
enum Enum
{
CV_SPECIAL=0x00, // special type size values
CV_SIGNED=0x01, // signed integral size values
CV_UNSIGNED=0x02, // unsigned integral size values
CV_BOOLEAN=0x03, // Boolean size values
CV_REAL=0x04, // real number size values
CV_COMPLEX=0x05, // complex number size values
CV_SPECIAL2=0x06, // second set of special types
CV_INT=0x07, // integral (int) values
CV_CVRESERVED=0x0f,
};
};
// subtype enumeration values for CV_SPECIAL
struct CV_special
{
enum Enum
{
CV_SP_NOTYPE=0x00,
CV_SP_ABS=0x01,
CV_SP_SEGMENT=0x02,
CV_SP_VOID=0x03,
CV_SP_CURRENCY=0x04,
CV_SP_NBASICSTR=0x05,
CV_SP_FBASICSTR=0x06,
CV_SP_NOTTRANS=0x07,
CV_SP_HRESULT=0x08,
};
};
// subtype enumeration values for CV_SPECIAL2
struct CV_special2
{
enum Enum
{
CV_S2_BIT=0x00,
CV_S2_PASCHAR=0x01, // Pascal CHAR
};
};
// subtype enumeration values for CV_SIGNED, CV_UNSIGNED and CV_BOOLEAN
struct CV_integral
{
enum Enum
{
CV_IN_1BYTE=0x00,
CV_IN_2BYTE=0x01,
CV_IN_4BYTE=0x02,
CV_IN_8BYTE=0x03,
CV_IN_16BYTE=0x04,
};
};
// subtype enumeration values for CV_REAL and CV_COMPLEX
struct CV_real
{
enum Enum
{
CV_RC_REAL32=0x00,
CV_RC_REAL64=0x01,
CV_RC_REAL80=0x02,
CV_RC_REAL128=0x03,
};
};
// subtype enumeration values for CV_INT (really int)
struct CV_int
{
enum Enum
{
CV_RI_CHAR=0x00,
CV_RI_INT1=0x00,
CV_RI_WCHAR=0x01,
CV_RI_UINT1=0x01,
CV_RI_INT2=0x02,
CV_RI_UINT2=0x03,
CV_RI_INT4=0x04,
CV_RI_UINT4=0x05,
CV_RI_INT8=0x06,
CV_RI_UINT8=0x07,
CV_RI_INT16=0x08,
CV_RI_UINT16=0x09,
};
};
struct CV_PRIMITIVE_TYPE
{
static const uint32_t CV_MMASK = 0x700; // mode mask
static const uint32_t CV_TMASK = 0x0f0; // type mask
static const uint32_t CV_SMASK = 0x00f; // subtype mask
static const int CV_MSHIFT = 8; // primitive mode right shift count
static const int CV_TSHIFT = 4; // primitive type right shift count
static const int CV_SSHIFT = 0; // primitive subtype right shift count
static const uint32_t CV_FIRST_NONPRIM = 0x1000;
};
// selected values for type_index - for a more complete definition, see
// Microsoft Symbol and Type OMF document
// Special Types
struct TYPE_ENUM
{
enum Enum
{
T_NOTYPE=0x0000, // uncharacterized type (no type)
T_ABS=0x0001, // absolute symbol
T_SEGMENT=0x0002, // segment type
T_VOID=0x0003, // void
T_HRESULT=0x0008, // OLE/COM HRESULT
T_32PHRESULT=0x0408, // OLE/COM HRESULT __ptr32//
T_64PHRESULT=0x0608, // OLE/COM HRESULT __ptr64//
T_PVOID=0x0103, // near pointer to void
T_PFVOID=0x0203, // far pointer to void
T_PHVOID=0x0303, // huge pointer to void
T_32PVOID=0x0403, // 32 bit pointer to void
T_64PVOID=0x0603, // 64 bit pointer to void
T_CURRENCY=0x0004, // BASIC 8 byte currency value
T_NOTTRANS=0x0007, // type not translated by cvpack
T_BIT=0x0060, // bit
T_PASCHAR=0x0061, // Pascal CHAR
// Character types
T_CHAR=0x0010, // 8 bit signed
T_32PCHAR=0x0410, // 32 bit pointer to 8 bit signed
T_64PCHAR=0x0610, // 64 bit pointer to 8 bit signed
T_UCHAR=0x0020, // 8 bit unsigned
T_32PUCHAR=0x0420, // 32 bit pointer to 8 bit unsigned
T_64PUCHAR=0x0620, // 64 bit pointer to 8 bit unsigned
// really a character types
T_RCHAR=0x0070, // really a char
T_32PRCHAR=0x0470, // 32 bit pointer to a real char
T_64PRCHAR=0x0670, // 64 bit pointer to a real char
// really a wide character types
T_WCHAR=0x0071, // wide char
T_32PWCHAR=0x0471, // 32 bit pointer to a wide char
T_64PWCHAR=0x0671, // 64 bit pointer to a wide char
// 8 bit int types
T_INT1=0x0068, // 8 bit signed int
T_32PINT1=0x0468, // 32 bit pointer to 8 bit signed int
T_64PINT1=0x0668, // 64 bit pointer to 8 bit signed int
T_UINT1=0x0069, // 8 bit unsigned int
T_32PUINT1=0x0469, // 32 bit pointer to 8 bit unsigned int
T_64PUINT1=0x0669, // 64 bit pointer to 8 bit unsigned int
// 16 bit short types
T_SHORT=0x0011, // 16 bit signed
T_32PSHORT=0x0411, // 32 bit pointer to 16 bit signed
T_64PSHORT=0x0611, // 64 bit pointer to 16 bit signed
T_USHORT=0x0021, // 16 bit unsigned
T_32PUSHORT=0x0421, // 32 bit pointer to 16 bit unsigned
T_64PUSHORT=0x0621, // 64 bit pointer to 16 bit unsigned
// 16 bit int types
T_INT2=0x0072, // 16 bit signed int
T_32PINT2=0x0472, // 32 bit pointer to 16 bit signed int
T_64PINT2=0x0672, // 64 bit pointer to 16 bit signed int
T_UINT2=0x0073, // 16 bit unsigned int
T_32PUINT2=0x0473, // 32 bit pointer to 16 bit unsigned int
T_64PUINT2=0x0673, // 64 bit pointer to 16 bit unsigned int
// 32 bit long types
T_LONG=0x0012, // 32 bit signed
T_ULONG=0x0022, // 32 bit unsigned
T_32PLONG=0x0412, // 32 bit pointer to 32 bit signed
T_32PULONG=0x0422, // 32 bit pointer to 32 bit unsigned
T_64PLONG=0x0612, // 64 bit pointer to 32 bit signed
T_64PULONG=0x0622, // 64 bit pointer to 32 bit unsigned
// 32 bit int types
T_INT4=0x0074, // 32 bit signed int
T_32PINT4=0x0474, // 32 bit pointer to 32 bit signed int
T_64PINT4=0x0674, // 64 bit pointer to 32 bit signed int
T_UINT4=0x0075, // 32 bit unsigned int
T_32PUINT4=0x0475, // 32 bit pointer to 32 bit unsigned int
T_64PUINT4=0x0675, // 64 bit pointer to 32 bit unsigned int
// 64 bit quad types
T_QUAD=0x0013, // 64 bit signed
T_32PQUAD=0x0413, // 32 bit pointer to 64 bit signed
T_64PQUAD=0x0613, // 64 bit pointer to 64 bit signed
T_UQUAD=0x0023, // 64 bit unsigned
T_32PUQUAD=0x0423, // 32 bit pointer to 64 bit unsigned
T_64PUQUAD=0x0623, // 64 bit pointer to 64 bit unsigned
// 64 bit int types
T_INT8=0x0076, // 64 bit signed int
T_32PINT8=0x0476, // 32 bit pointer to 64 bit signed int
T_64PINT8=0x0676, // 64 bit pointer to 64 bit signed int
T_UINT8=0x0077, // 64 bit unsigned int
T_32PUINT8=0x0477, // 32 bit pointer to 64 bit unsigned int
T_64PUINT8=0x0677, // 64 bit pointer to 64 bit unsigned int
// 128 bit octet types
T_OCT=0x0014, // 128 bit signed
T_32POCT=0x0414, // 32 bit pointer to 128 bit signed
T_64POCT=0x0614, // 64 bit pointer to 128 bit signed
T_UOCT=0x0024, // 128 bit unsigned
T_32PUOCT=0x0424, // 32 bit pointer to 128 bit unsigned
T_64PUOCT=0x0624, // 64 bit pointer to 128 bit unsigned
// 128 bit int types
T_INT16=0x0078, // 128 bit signed int
T_32PINT16=0x0478, // 32 bit pointer to 128 bit signed int
T_64PINT16=0x0678, // 64 bit pointer to 128 bit signed int
T_UINT16=0x0079, // 128 bit unsigned int
T_32PUINT16=0x0479, // 32 bit pointer to 128 bit unsigned int
T_64PUINT16=0x0679, // 64 bit pointer to 128 bit unsigned int
// 32 bit real types
T_REAL32=0x0040, // 32 bit real
T_32PREAL32=0x0440, // 32 bit pointer to 32 bit real
T_64PREAL32=0x0640, // 64 bit pointer to 32 bit real
// 64 bit real types
T_REAL64=0x0041, // 64 bit real
T_32PREAL64=0x0441, // 32 bit pointer to 64 bit real
T_64PREAL64=0x0641, // 64 bit pointer to 64 bit real
// 80 bit real types
T_REAL80=0x0042, // 80 bit real
T_32PREAL80=0x0442, // 32 bit pointer to 80 bit real
T_64PREAL80=0x0642, // 64 bit pointer to 80 bit real
// 128 bit real types
T_REAL128=0x0043, // 128 bit real
T_32PREAL128=0x0443, // 32 bit pointer to 128 bit real
T_64PREAL128=0x0643, // 64 bit pointer to 128 bit real
// 32 bit complex types
T_CPLX32=0x0050, // 32 bit complex
T_32PCPLX32=0x0450, // 32 bit pointer to 32 bit complex
T_64PCPLX32=0x0650, // 64 bit pointer to 32 bit complex
// 64 bit complex types
T_CPLX64=0x0051, // 64 bit complex
T_32PCPLX64=0x0451, // 32 bit pointer to 64 bit complex
T_64PCPLX64=0x0651, // 64 bit pointer to 64 bit complex
// 80 bit complex types
T_CPLX80=0x0052, // 80 bit complex
T_32PCPLX80=0x0452, // 32 bit pointer to 80 bit complex
T_64PCPLX80=0x0652, // 64 bit pointer to 80 bit complex
// 128 bit complex types
T_CPLX128=0x0053, // 128 bit complex
T_32PCPLX128=0x0453, // 32 bit pointer to 128 bit complex
T_64PCPLX128=0x0653, // 64 bit pointer to 128 bit complex
// boolean types
T_BOOL08=0x0030, // 8 bit boolean
T_32PBOOL08=0x0430, // 32 bit pointer to 8 bit boolean
T_64PBOOL08=0x0630, // 64 bit pointer to 8 bit boolean
T_BOOL16=0x0031, // 16 bit boolean
T_32PBOOL16=0x0431, // 32 bit pointer to 18 bit boolean
T_64PBOOL16=0x0631, // 64 bit pointer to 18 bit boolean
T_BOOL32=0x0032, // 32 bit boolean
T_32PBOOL32=0x0432, // 32 bit pointer to 32 bit boolean
T_64PBOOL32=0x0632, // 64 bit pointer to 32 bit boolean
T_BOOL64=0x0033, // 64 bit boolean
T_32PBOOL64=0x0433, // 32 bit pointer to 64 bit boolean
T_64PBOOL64=0x0633, // 64 bit pointer to 64 bit boolean
};
};
// No leaf index can have a value of 0x0000. The leaf indices are
// separated into ranges depending upon the use of the type record.
// The second range is for the type records that are directly referenced
// in symbols. The first range is for type records that are not
// referenced by symbols but instead are referenced by other type
// records. All type records must have a starting leaf index in these
// first two ranges. The third range of leaf indices are used to build
// up complex lists such as the field list of a class type record. No
// type record can begin with one of the leaf indices. The fourth ranges
// of type indices are used to represent numeric data in a symbol or
// type record. These leaf indices are greater than 0x8000. At the
// point that type or symbol processor is expecting a numeric field, the
// next two bytes in the type record are examined. If the value is less
// than 0x8000, then the two bytes contain the numeric value. If the
// value is greater than 0x8000, then the data follows the leaf index in
// a format specified by the leaf index. The final range of leaf indices
// are used to force alignment of subfields within a complex type record..
//
struct LEAF
{
enum Enum
{
// leaf indices starting records but referenced from symbol records
LF_VTSHAPE=0x000a,
LF_COBOL1=0x000c,
LF_LABEL=0x000e,
LF_NULL=0x000f,
LF_NOTTRAN=0x0010,
LF_ENDPRECOMP=0x0014, // not referenced from symbol
LF_TYPESERVER_ST=0x0016, // not referenced from symbol
// leaf indices starting records but referenced only from type records
LF_LIST=0x0203,
LF_REFSYM=0x020c,
LF_ENUMERATE_ST=0x0403,
// 32-bit type index versions of leaves, all have the 0x1000 bit set
//
LF_TI16_MAX=0x1000,
LF_MODIFIER=0x1001,
LF_POINTER=0x1002,
LF_ARRAY_ST=0x1003,
LF_CLASS_ST=0x1004,
LF_STRUCTURE_ST=0x1005,
LF_UNION_ST=0x1006,
LF_ENUM_ST=0x1007,
LF_PROCEDURE=0x1008,
LF_MFUNCTION=0x1009,
LF_COBOL0=0x100a,
LF_BARRAY=0x100b,
LF_DIMARRAY_ST=0x100c,
LF_VFTPATH=0x100d,
LF_PRECOMP_ST=0x100e, // not referenced from symbol
LF_OEM=0x100f, // oem definable type string
LF_ALIAS_ST=0x1010, // alias (typedef) type
LF_OEM2=0x1011, // oem definable type string
// leaf indices starting records but referenced only from type records
LF_SKIP=0x1200,
LF_ARGLIST=0x1201,
LF_DEFARG_ST=0x1202,
LF_FIELDLIST=0x1203,
LF_DERIVED=0x1204,
LF_BITFIELD=0x1205,
LF_METHODLIST=0x1206,
LF_DIMCONU=0x1207,
LF_DIMCONLU=0x1208,
LF_DIMVARU=0x1209,
LF_DIMVARLU=0x120a,
LF_BCLASS=0x1400,
LF_VBCLASS=0x1401,
LF_IVBCLASS=0x1402,
LF_FRIENDFCN_ST=0x1403,
LF_INDEX=0x1404,
LF_MEMBER_ST=0x1405,
LF_STMEMBER_ST=0x1406,
LF_METHOD_ST=0x1407,
LF_NESTTYPE_ST=0x1408,
LF_VFUNCTAB=0x1409,
LF_FRIENDCLS=0x140a,
LF_ONEMETHOD_ST=0x140b,
LF_VFUNCOFF=0x140c,
LF_NESTTYPEEX_ST=0x140d,
LF_MEMBERMODIFY_ST=0x140e,
LF_MANAGED_ST=0x140f,
// Types w/ SZ names
LF_ST_MAX=0x1500,
LF_TYPESERVER=0x1501, // not referenced from symbol
LF_ENUMERATE=0x1502,
LF_ARRAY=0x1503,
LF_CLASS=0x1504,
LF_STRUCTURE=0x1505,
LF_UNION=0x1506,
LF_ENUM=0x1507,
LF_DIMARRAY=0x1508,
LF_PRECOMP=0x1509, // not referenced from symbol
LF_ALIAS=0x150a, // alias (typedef) type
LF_DEFARG=0x150b,
LF_FRIENDFCN=0x150c,
LF_MEMBER=0x150d,
LF_STMEMBER=0x150e,
LF_METHOD=0x150f,
LF_NESTTYPE=0x1510,
LF_ONEMETHOD=0x1511,
LF_NESTTYPEEX=0x1512,
LF_MEMBERMODIFY=0x1513,
LF_MANAGED=0x1514,
LF_TYPESERVER2=0x1515,
LF_NUMERIC=0x8000,
LF_CHAR=0x8000,
LF_SHORT=0x8001,
LF_USHORT=0x8002,
LF_LONG=0x8003,
LF_ULONG=0x8004,
LF_REAL32=0x8005,
LF_REAL64=0x8006,
LF_REAL80=0x8007,
LF_REAL128=0x8008,
LF_QUADWORD=0x8009,
LF_UQUADWORD=0x800a,
LF_COMPLEX32=0x800c,
LF_COMPLEX64=0x800d,
LF_COMPLEX80=0x800e,
LF_COMPLEX128=0x800f,
LF_VARSTRING=0x8010,
LF_OCTWORD=0x8017,
LF_UOCTWORD=0x8018,
LF_DECIMAL=0x8019,
LF_DATE=0x801a,
LF_UTF8STRING=0x801b,
LF_PAD0=0xf0,
LF_PAD1=0xf1,
LF_PAD2=0xf2,
LF_PAD3=0xf3,
LF_PAD4=0xf4,
LF_PAD5=0xf5,
LF_PAD6=0xf6,
LF_PAD7=0xf7,
LF_PAD8=0xf8,
LF_PAD9=0xf9,
LF_PAD10=0xfa,
LF_PAD11=0xfb,
LF_PAD12=0xfc,
LF_PAD13=0xfd,
LF_PAD14=0xfe,
LF_PAD15=0xff,
};
};
// end of leaf indices
// Type enum for pointer records
// Pointers can be one of the following types
struct CV_ptrtype
{
enum Enum
{
CV_PTR_BASE_SEG=0x03, // based on segment
CV_PTR_BASE_VAL=0x04, // based on value of base
CV_PTR_BASE_SEGVAL=0x05, // based on segment value of base
CV_PTR_BASE_ADDR=0x06, // based on address of base
CV_PTR_BASE_SEGADDR=0x07, // based on segment address of base
CV_PTR_BASE_TYPE=0x08, // based on type
CV_PTR_BASE_SELF=0x09, // based on self
CV_PTR_NEAR32=0x0a, // 32 bit pointer
CV_PTR_64=0x0c, // 64 bit pointer
CV_PTR_UNUSEDPTR=0x0d // first unused pointer type
};
};
// Mode enum for pointers
// Pointers can have one of the following modes
struct CV_ptrmode
{
enum Enum
{
CV_PTR_MODE_PTR=0x00, // "normal" pointer
CV_PTR_MODE_REF=0x01, // reference
CV_PTR_MODE_PMEM=0x02, // pointer to data member
CV_PTR_MODE_PMFUNC=0x03, // pointer to member function
CV_PTR_MODE_RESERVED=0x04 // first unused pointer mode
};
};
// enumeration for pointer-to-member types
struct CV_pmtype
{
enum Enum
{
CV_PMTYPE_Undef=0x00, // not specified (pre VC8)
CV_PMTYPE_D_Single=0x01, // member data, single inheritance
CV_PMTYPE_D_Multiple=0x02, // member data, multiple inheritance
CV_PMTYPE_D_Virtual=0x03, // member data, virtual inheritance
CV_PMTYPE_D_General=0x04, // member data, most general
CV_PMTYPE_F_Single=0x05, // member function, single inheritance
CV_PMTYPE_F_Multiple=0x06, // member function, multiple inheritance
CV_PMTYPE_F_Virtual=0x07, // member function, virtual inheritance
CV_PMTYPE_F_General=0x08, // member function, most general
};
};
// enumeration for method properties
struct CV_methodprop
{
enum Enum
{
CV_MTvanilla=0x00,
CV_MTvirtual=0x01,
CV_MTstatic=0x02,
CV_MTfriend=0x03,
CV_MTintro=0x04,
CV_MTpurevirt=0x05,
CV_MTpureintro=0x06
};
};
// enumeration for virtual shape table entries
struct CV_VTS_desc
{
enum Enum
{
CV_VTS_near=0x00,
CV_VTS_far=0x01,
CV_VTS_thin=0x02,
CV_VTS_outer=0x03,
CV_VTS_meta=0x04,
CV_VTS_near32=0x05,
CV_VTS_far32=0x06,
CV_VTS_unused=0x07
};
};
// enumeration for LF_LABEL address modes
struct CV_LABEL_TYPE
{
enum Enum
{
CV_LABEL_NEAR=0, // near return
CV_LABEL_FAR=4 // far return
};
};
// enumeration for LF_MODIFIER values
struct CV_modifier
{
enum Enum
{
MOD_const=0x0001,
MOD_volatile=0x0002,
MOD_unaligned=0x0004,
};
};
// bit field structure describing class/struct/union/enum properties
struct CV_prop
{
enum Enum
{
packed=0x0001, // true if structure is packed
ctor=0x0002, // true if constructors or destructors present
ovlops=0x0004, // true if overloaded operators present
isnested=0x0008, // true if this is a nested class
cnested=0x0010, // true if this class contains nested types
opassign=0x0020, // true if overloaded assignment (=)
opcast=0x0040, // true if casting methods
fwdref=0x0080, // true if forward reference (incomplete defn)
scoped=0x0100, // scoped definition
};
};
// class field attribute
struct CV_fldattr
{
enum Enum
{
access=0x0003, // access protection CV_access_t
mprop=0x001c, // method properties CV_methodprop_t
pseudo=0x0020, // compiler generated fcn and does not exist
noinherit=0x0040, // true if class cannot be inherited
noconstruct=0x0080, // true if class cannot be constructed
compgenx=0x0100, // compiler generated fcn and does exist
};
};
// Structures to access to the type records
struct TYPTYPE
{
uint16_t len;
uint16_t leaf;
// byte data[];
// char *NextType (char * pType) {
// return (pType + ((TYPTYPE *)pType)->len + sizeof(ushort));
// }
}; // general types record
// memory representation of pointer to member. These representations are
// indexed by the enumeration above in the LF_POINTER record
// representation of a 32 bit pointer to data for a class with
// or without virtual functions and no virtual bases
struct CV_PDMR32_NVVFCN
{
int32_t mdisp; // displacement to data (NULL = 0x80000000)
};
// representation of a 32 bit pointer to data for a class
// with virtual bases
struct CV_PDMR32_VBASE
{
int32_t mdisp; // displacement to data
int32_t pdisp; // this pointer displacement
int32_t vdisp; // vbase table displacement
// NULL = (,,0xffffffff)
};
// representation of a 32 bit pointer to member function for a
// class with no virtual bases and a single address point
struct CV_PMFR32_NVSA
{
uint32_t off; // near address of function (NULL = 0L)
};
// representation of a 32 bit pointer to member function for a
// class with no virtual bases and multiple address points
struct CV_PMFR32_NVMA
{
uint32_t off; // near address of function (NULL = 0L,x)
int32_t disp;
};
// representation of a 32 bit pointer to member function for a
// class with virtual bases
struct CV_PMFR32_VBASE
{
uint32_t off; // near address of function (NULL = 0L,x,x,x)
int32_t mdisp; // displacement to data
int32_t pdisp; // this pointer displacement
int32_t vdisp; // vbase table displacement
};
//////////////////////////////////////////////////////////////////////////////
//
// The following type records are basically variant records of the
// above structure. The "ushort leaf" of the above structure and
// the "ushort leaf" of the following type definitions are the same
// symbol.
//
// Notes on alignment
// Alignment of the fields in most of the type records is done on the
// basis of the TYPTYPE record base. That is why in most of the lf*
// records that the type is located on what appears to
// be a offset mod 4 == 2 boundary. The exception to this rule are those
// records that are in a list (lfFieldList, lfMethodList), which are
// aligned to their own bases since they don't have the length field
//
// Type record for LF_MODIFIER
struct LeafModifier
{
// internal ushort leaf; // LF_MODIFIER [TYPTYPE]
uint32_t type; // (type index) modified type
uint16_t attr; // modifier attribute modifier_t CV_modifier
};
// type record for LF_POINTER
struct LeafPointerAttr
{
enum Enum
{
ptrtype=0x0000001f, // ordinal specifying pointer type (CV_ptrtype)
ptrmode=0x000000e0, // ordinal specifying pointer mode (CV_ptrmode)
isflat32=0x00000100, // true if 0:32 pointer
isvolatile=0x00000200, // TRUE if volatile pointer
isconst=0x00000400, // TRUE if const pointer
isunaligned=0x00000800, // TRUE if unaligned pointer
isrestrict=0x00001000, // TRUE if restricted pointer (allow agressive opts)
};
};
struct LeafPointer
{
uint32_t utype; // (type index) type index of the underlying type
uint32_t attr; // LeafPointerAttr::Enum
};
// type record for LF_ARRAY
struct LeafArray
{
// internal ushort leaf; // LF_ARRAY [TYPTYPE]
uint32_t elemtype; // (type index) type index of element type
uint32_t idxtype; // (type index) type index of indexing type
//internal byte[] data; // variable length data specifying size in bytes
//internal string name;
};
// type record for LF_CLASS, LF_STRUCTURE
struct LeafClass
{
// internal ushort leaf; // LF_CLASS, LF_STRUCT [TYPTYPE]
uint16_t count; // count of number of elements in class
uint16_t prop; // (CV_prop_t) property attribute field (prop_t)
uint32_t field; // (type index) type index of LF_FIELD descriptor list
uint32_t derived; // (type index) type index of derived from list if not zero
uint32_t vshape; // (type index) type index of vshape table for this class
//internal byte[] data; // data describing length of structure in bytes
//internal string name;
};
// type record for LF_UNION
struct LeafUnion
{
// internal ushort leaf; // LF_UNION [TYPTYPE]
uint16_t count; // count of number of elements in class
uint16_t prop; // (CV_prop_t) property attribute field
uint32_t field; // (type index) type index of LF_FIELD descriptor list
//internal byte[] data; // variable length data describing length of
//internal string name;
};
// type record for LF_ALIAS
struct LeafAlias
{
// internal ushort leaf; // LF_ALIAS [TYPTYPE]
uint32_t utype; // (type index) underlying type
//internal string name; // alias name
};
// type record for LF_MANAGED
struct LeafManaged {
// internal ushort leaf; // LF_MANAGED [TYPTYPE]
//internal string name; // utf8, zero terminated managed type name
};
// type record for LF_ENUM