1 /**
2  * CodeView 4 symbolic debug info declarations
3  *
4  * See "Microsoft Symbol and Type OMF" document
5  *
6  * Compiler implementation of the
7  * $(LINK2 https://www.dlang.org, D programming language).
8  *
9  * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/backend/cv4.d, backend/_cv4.d)
10  */
11 
12 module dmd.backend.cv4;
13 
14 @safe:
15 
16 // Online documentation: https://dlang.org/phobos/dmd_backend_cv4.html
17 
18 enum OEM = 0x42;        // Digital Mars OEM number (picked at random)
19 
20 // Symbol Indices
21 enum
22 {
23     S_COMPILE     = 1,
24     S_REGISTER    = 2,
25     S_CONST       = 3,
26     S_UDT         = 4,
27     S_SSEARCH     = 5,
28     S_END         = 6,
29     S_SKIP        = 7,
30     S_CVRESERVE   = 8,
31     S_OBJNAME     = 9,
32     S_ENDARG      = 0x0A,
33     S_COBOLUDT    = 0x0B,
34     S_MANYREG     = 0x0C,
35     S_RETURN      = 0x0D,
36     S_ENTRYTHIS   = 0x0E,
37     S_TDBNAME     = 0x0F,
38 
39     S_BPREL16     = 0x100,
40     S_LDATA16     = 0x101,
41     S_GDATA16     = 0x102,
42     S_PUB16       = 0x103,
43     S_LPROC16     = 0x104,
44     S_GPROC16     = 0x105,
45     S_THUNK16     = 0x106,
46     S_BLOCK16     = 0x107,
47     S_WITH16      = 0x108,
48     S_LABEL16     = 0x109,
49     S_CEXMODEL16  = 0x10A,
50     S_VFTPATH16   = 0x10B,
51 
52     S_BPREL32     = 0x200,
53     S_LDATA32     = 0x201,
54     S_GDATA32     = 0x202,
55     S_PUB32       = 0x203,
56     S_LPROC32     = 0x204,
57     S_GPROC32     = 0x205,
58     S_THUNK32     = 0x206,
59     S_BLOCK32     = 0x207,
60     S_WITH32      = 0x208,
61     S_LABEL32     = 0x209,
62     S_CEXMODEL32  = 0x20A,
63     S_VFTPATH32   = 0x20B,
64 
65     /************** Added Since CV4 *********************/
66 
67     S_REGISTER_V2         = 0x1001,
68     S_CONSTANT_V2         = 0x1002,
69     S_UDT_V2              = 0x1003,
70     S_COBOLUDT_V2         = 0x1004,
71     S_MANYREG_V2          = 0x1005,
72     S_BPREL_V2            = 0x1006,
73     S_LDATA_V2            = 0x1007,
74     S_GDATA_V2            = 0x1008,
75     S_PUB_V2              = 0x1009,
76     S_LPROC_V2            = 0x100A,
77     S_GPROC_V2            = 0x100B,
78     S_VFTTABLE_V2         = 0x100C,
79     S_REGREL_V2           = 0x100D,
80     S_LTHREAD_V2          = 0x100E,
81     S_GTHREAD_V2          = 0x100F,
82     S_FUNCINFO_V2         = 0x1012,
83     S_COMPILAND_V2        = 0x1013,
84 
85     S_COMPILAND_V3        = 0x1101,
86     S_THUNK_V3            = 0x1102,
87     S_BLOCK_V3            = 0x1103,
88     S_LABEL_V3            = 0x1105,
89     S_REGISTER_V3         = 0x1106,
90     S_CONSTANT_V3         = 0x1107,
91     S_UDT_V3              = 0x1108,
92     S_BPREL_V3            = 0x110B,
93     S_LDATA_V3            = 0x110C,
94     S_GDATA_V3            = 0x110D,
95     S_PUB_V3              = 0x110E,
96     S_LPROC_V3            = 0x110F,
97     S_GPROC_V3            = 0x1110,
98     S_BPREL_XXXX_V3       = 0x1111,
99     S_MSTOOL_V3           = 0x1116,
100     S_PUB_FUNC1_V3        = 0x1125,
101     S_PUB_FUNC2_V3        = 0x1127,
102     S_SECTINFO_V3         = 0x1136,
103     S_SUBSECTINFO_V3      = 0x1137,
104     S_ENTRYPOINT_V3       = 0x1138,
105     S_SECUCOOKIE_V3       = 0x113A,
106     S_MSTOOLINFO_V3       = 0x113C,
107     S_MSTOOLENV_V3        = 0x113D,
108 }
109 
110 // Leaf Indices
111 enum
112 {
113     LF_MODIFIER    = 1,
114     LF_POINTER     = 2,
115     LF_ARRAY       = 3,
116     LF_CLASS       = 4,
117     LF_STRUCTURE   = 5,
118     LF_UNION       = 6,
119     LF_ENUM        = 7,
120     LF_PROCEDURE   = 8,
121     LF_MFUNCTION   = 9,
122     LF_VTSHAPE     = 0x0A,
123     LF_COBOL0      = 0x0B,
124     LF_COBOL1      = 0x0C,
125     LF_BARRAY      = 0x0D,
126     LF_LABEL       = 0x0E,
127     LF_NULL        = 0x0F,
128     LF_NOTTRAN     = 0x10,
129     LF_DIMARRAY    = 0x11,
130     LF_VFTPATH     = 0x12,
131     LF_PRECOMP     = 0x13,
132     LF_ENDPRECOMP  = 0x14,
133     LF_OEM         = 0x15,
134     LF_TYPESERVER  = 0x16,
135 
136     // D extensions (not used, causes linker to fail)
137     LF_DYN_ARRAY   = 0x17,
138     LF_ASSOC_ARRAY = 0x18,
139     LF_DELEGATE    = 0x19,
140 
141     LF_SKIP        = 0x200,
142     LF_ARGLIST     = 0x201,
143     LF_DEFARG      = 0x202,
144     LF_LIST        = 0x203,
145     LF_FIELDLIST   = 0x204,
146     LF_DERIVED     = 0x205,
147     LF_BITFIELD    = 0x206,
148     LF_METHODLIST  = 0x207,
149     LF_DIMCONU     = 0x208,
150     LF_DIMCONLU    = 0x209,
151     LF_DIMVARU     = 0x20A,
152     LF_DIMVARLU    = 0x20B,
153     LF_REFSYM      = 0x20C,
154 
155     LF_BCLASS      = 0x400,
156     LF_VBCLASS     = 0x401,
157     LF_IVBCLASS    = 0x402,
158     LF_ENUMERATE   = 0x403,
159     LF_FRIENDFCN   = 0x404,
160     LF_INDEX       = 0x405,
161     LF_MEMBER      = 0x406,
162     LF_STMEMBER    = 0x407,
163     LF_METHOD      = 0x408,
164     LF_NESTTYPE    = 0x409,
165     LF_VFUNCTAB    = 0x40A,
166     LF_FRIENDCLS   = 0x40B,
167 
168     LF_NUMERIC     = 0x8000,
169     LF_CHAR        = 0x8000,
170     LF_SHORT       = 0x8001,
171     LF_USHORT      = 0x8002,
172     LF_LONG        = 0x8003,
173     LF_ULONG       = 0x8004,
174     LF_REAL32      = 0x8005,
175     LF_REAL64      = 0x8006,
176     LF_REAL80      = 0x8007,
177     LF_REAL128     = 0x8008,
178     LF_QUADWORD    = 0x8009,
179     LF_UQUADWORD   = 0x800A,
180     LF_REAL48      = 0x800B,
181 
182     LF_COMPLEX32   = 0x800C,
183     LF_COMPLEX64   = 0x800D,
184     LF_COMPLEX80   = 0x800E,
185     LF_COMPLEX128  = 0x800F,
186 
187     LF_VARSTRING   = 0x8010,
188 
189     /************** Added Since CV4 *********************/
190 
191     LF_MODIFIER_V2        = 0x1001,
192     LF_POINTER_V2         = 0x1002,
193     LF_ARRAY_V2           = 0x1003,
194     LF_CLASS_V2           = 0x1004,
195     LF_STRUCTURE_V2       = 0x1005,
196     LF_UNION_V2           = 0x1006,
197     LF_ENUM_V2            = 0x1007,
198     LF_PROCEDURE_V2       = 0x1008,
199     LF_MFUNCTION_V2       = 0x1009,
200     LF_COBOL0_V2          = 0x100A,
201     LF_BARRAY_V2          = 0x100B,
202     LF_DIMARRAY_V2        = 0x100C,
203     LF_VFTPATH_V2         = 0x100D,
204     LF_PRECOMP_V2         = 0x100E,
205     LF_OEM_V2             = 0x100F,
206 
207     LF_SKIP_V2            = 0x1200,
208     LF_ARGLIST_V2         = 0x1201,
209     LF_DEFARG_V2          = 0x1202,
210     LF_FIELDLIST_V2       = 0x1203,
211     LF_DERIVED_V2         = 0x1204,
212     LF_BITFIELD_V2        = 0x1205,
213     LF_METHODLIST_V2      = 0x1206,
214     LF_DIMCONU_V2         = 0x1207,
215     LF_DIMCONLU_V2        = 0x1208,
216     LF_DIMVARU_V2         = 0x1209,
217     LF_DIMVARLU_V2        = 0x120A,
218 
219     LF_BCLASS_V2          = 0x1400,
220     LF_VBCLASS_V2         = 0x1401,
221     LF_IVBCLASS_V2        = 0x1402,
222     LF_FRIENDFCN_V2       = 0x1403,
223     LF_INDEX_V2           = 0x1404,
224     LF_MEMBER_V2          = 0x1405,
225     LF_STMEMBER_V2        = 0x1406,
226     LF_METHOD_V2          = 0x1407,
227     LF_NESTTYPE_V2        = 0x1408,
228     LF_VFUNCTAB_V2        = 0x1409,
229     LF_FRIENDCLS_V2       = 0x140A,
230     LF_ONEMETHOD_V2       = 0x140B,
231     LF_VFUNCOFF_V2        = 0x140C,
232     LF_NESTTYPEEX_V2      = 0x140D,
233 
234     LF_ENUMERATE_V3       = 0x1502,
235     LF_ARRAY_V3           = 0x1503,
236     LF_CLASS_V3           = 0x1504,
237     LF_STRUCTURE_V3       = 0x1505,
238     LF_UNION_V3           = 0x1506,
239     LF_ENUM_V3            = 0x1507,
240     LF_MEMBER_V3          = 0x150D,
241     LF_STMEMBER_V3        = 0x150E,
242     LF_METHOD_V3          = 0x150F,
243     LF_NESTTYPE_V3        = 0x1510,
244     LF_ONEMETHOD_V3       = 0x1511,
245 }