1 : // Copyright 2012 Google Inc. All Rights Reserved.
2 : //
3 : // Licensed under the Apache License, Version 2.0 (the "License");
4 : // you may not use this file except in compliance with the License.
5 : // You may obtain a copy of the License at
6 : //
7 : // http://www.apache.org/licenses/LICENSE-2.0
8 : //
9 : // Unless required by applicable law or agreed to in writing, software
10 : // distributed under the License is distributed on an "AS IS" BASIS,
11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : // See the License for the specific language governing permissions and
13 : // limitations under the License.
14 : //
15 : // This header is an extension to the cvinfo.h file from the CCI project.
16 :
17 : #ifndef SYZYGY_PE_CVINFO_EXT_H_
18 : #define SYZYGY_PE_CVINFO_EXT_H_
19 :
20 : #include <windows.h>
21 :
22 : #include "base/basictypes.h"
23 : #include "syzygy/common/assertions.h"
24 : #include "third_party/cci/files/cvinfo.h"
25 :
26 m : namespace Microsoft_Cci_Pdb {
27 :
28 : // CodeView2 symbols. These are superseded in CodeView4 symbol streams.
29 : // Taken from the Visual C++ 5.0 Symbolic Debug Information Specification.
30 m : const uint16 S_COMPILE_CV2 = 0x0001; // Compile flags symbol.
31 m : const uint16 S_SSEARCH = 0x0005; // Start search.
32 m : const uint16 S_SKIP = 0x0007; // Skip - Reserve symbol space.
33 m : const uint16 S_CVRESERVE = 0x0008; // Reserved for CodeView internal use.
34 m : const uint16 S_OBJNAME_CV2 = 0x0009; // Name of object file.
35 m : const uint16 S_ENDARG = 0x000A; // End of arguments in function symbols.
36 m : const uint16 S_COBOLUDT_CV2 = 0x000B; // Microfocus COBOL user-defined type.
37 m : const uint16 S_MANYREG_CV2 = 0x000C; // Many register symbol.
38 m : const uint16 S_RETURN = 0x000D; // Function return description.
39 m : const uint16 S_ENTRYTHIS = 0x000E; // Description of this pointer at entry.
40 :
41 : // Symbols that are not in the enum in the cv_info file.
42 m : const uint16 S_COMPILE3 = 0x113C;
43 m : const uint16 S_MSTOOLENV_V3 = 0x113D;
44 m : const uint16 S_LOCAL_VS2013 = 0x113E;
45 :
46 : // Provides the frame pointer offset for the S_LOCAL_VS2013 variables.
47 m : const uint16 S_FPOFF_VS2013 = 0x1144;
48 :
49 : // Since VS2013 it seems that the compiler isn't emitting the same value as
50 : // those in cvinfo.h for the S_GPROC32 and S_LPROC32 types, the following 2
51 : // values should be used instead.
52 m : const uint16 S_LPROC32_VS2013 = 0x1146;
53 m : const uint16 S_GPROC32_VS2013 = 0x1147;
54 m : } // namespace Microsoft_Cci_Pdb
55 :
56 : // This macro allow the easy construction of switch statements over the symbol
57 : // type enum. It define the case table, the first parameter of each entry is the
58 : // type of the symbol and the second one is the type of structure used to
59 : // represent this symbol.
60 : // NOTE: All _ST suffixed symbols are identical to those symbols without the _ST
61 : // suffix. However, the trailing string they contain is encoded as uint16
62 : // length prefixed string, versus a zero-terminated string.
63 : #define SYM_TYPE_CASE_TABLE(decl) \
64 m : decl(S_COMPILE_CV2, CompileSymCV2) \
65 m : decl(S_SSEARCH, SearchSym) \
66 m : decl(S_SKIP, Unknown) \
67 m : decl(S_CVRESERVE, Unknown) \
68 m : decl(S_OBJNAME_CV2, ObjNameSym) \
69 m : decl(S_ENDARG, EndArgSym) \
70 m : decl(S_COBOLUDT_CV2, UdtSym) \
71 m : decl(S_MANYREG_CV2, ManyRegSym) \
72 m : decl(S_RETURN, ReturnSym) \
73 m : decl(S_ENTRYTHIS, EntryThisSym) \
74 m : decl(S_END, Unknown) \
75 m : decl(S_OEM, OemSymbol) \
76 m : decl(S_REGISTER_ST, Unknown) \
77 m : decl(S_CONSTANT_ST, Unknown) \
78 m : decl(S_UDT_ST, UdtSym) \
79 m : decl(S_COBOLUDT_ST, Unknown) \
80 m : decl(S_MANYREG_ST, Unknown) \
81 m : decl(S_BPREL32_ST, BpRelSym32) \
82 m : decl(S_LDATA32_ST, DatasSym32) \
83 m : decl(S_GDATA32_ST, DatasSym32) \
84 m : decl(S_PUB32_ST, DatasSym32) \
85 m : decl(S_LPROC32_ST, ProcSym32) \
86 m : decl(S_GPROC32_ST, ProcSym32) \
87 m : decl(S_VFTABLE32, VpathSym32) \
88 m : decl(S_REGREL32_ST, Unknown) \
89 m : decl(S_LTHREAD32_ST, Unknown) \
90 m : decl(S_GTHREAD32_ST, Unknown) \
91 m : decl(S_LPROCMIPS_ST, Unknown) \
92 m : decl(S_GPROCMIPS_ST, Unknown) \
93 m : decl(S_FRAMEPROC, FrameProcSym) \
94 m : decl(S_COMPILE2_ST, Unknown) \
95 m : decl(S_MANYREG2_ST, Unknown) \
96 m : decl(S_LPROCIA64_ST, Unknown) \
97 m : decl(S_GPROCIA64_ST, Unknown) \
98 m : decl(S_LOCALSLOT_ST, Unknown) \
99 m : decl(S_PARAMSLOT_ST, Unknown) \
100 m : decl(S_ANNOTATION, AnnotationSym) \
101 m : decl(S_GMANPROC_ST, Unknown) \
102 m : decl(S_LMANPROC_ST, Unknown) \
103 m : decl(S_RESERVED1, Unknown) \
104 m : decl(S_RESERVED2, Unknown) \
105 m : decl(S_RESERVED3, Unknown) \
106 m : decl(S_RESERVED4, Unknown) \
107 m : decl(S_LMANDATA_ST, Unknown) \
108 m : decl(S_GMANDATA_ST, Unknown) \
109 m : decl(S_MANFRAMEREL_ST, Unknown) \
110 m : decl(S_MANREGISTER_ST, Unknown) \
111 m : decl(S_MANSLOT_ST, Unknown) \
112 m : decl(S_MANMANYREG_ST, Unknown) \
113 m : decl(S_MANREGREL_ST, Unknown) \
114 m : decl(S_MANMANYREG2_ST, Unknown) \
115 m : decl(S_MANTYPREF, ManyTypRef) \
116 m : decl(S_UNAMESPACE_ST, Unknown) \
117 m : decl(S_ST_MAX, Unknown) \
118 m : decl(S_OBJNAME, ObjNameSym) \
119 m : decl(S_THUNK32, ThunkSym32) \
120 m : decl(S_BLOCK32, BlockSym32) \
121 m : decl(S_WITH32, WithSym32) \
122 m : decl(S_LABEL32, LabelSym32) \
123 m : decl(S_REGISTER, RegSym) \
124 m : decl(S_CONSTANT, ConstSym) \
125 m : decl(S_UDT, UdtSym) \
126 m : decl(S_COBOLUDT, UdtSym) \
127 m : decl(S_MANYREG, ManyRegSym) \
128 m : decl(S_BPREL32, BpRelSym32) \
129 m : decl(S_LDATA32, DatasSym32) \
130 m : decl(S_GDATA32, DatasSym32) \
131 m : decl(S_PUB32, PubSym32) \
132 m : decl(S_LPROC32, ProcSym32) \
133 m : decl(S_GPROC32, ProcSym32) \
134 m : decl(S_REGREL32, RegRel32) \
135 m : decl(S_LTHREAD32, ThreadSym32) \
136 m : decl(S_GTHREAD32, ThreadSym32) \
137 m : decl(S_LPROCMIPS, ProcSymMips) \
138 m : decl(S_GPROCMIPS, ProcSymMips) \
139 m : decl(S_COMPILE2, CompileSym) \
140 m : decl(S_MANYREG2, ManyRegSym2) \
141 m : decl(S_LPROCIA64, ProcSymIa64) \
142 m : decl(S_GPROCIA64, ProcSymIa64) \
143 m : decl(S_LOCALSLOT, SlotSym32) \
144 m : decl(S_PARAMSLOT, SlotSym32) \
145 m : decl(S_LMANDATA, DatasSym32) \
146 m : decl(S_GMANDATA, DatasSym32) \
147 m : decl(S_MANFRAMEREL, FrameRelSym) \
148 m : decl(S_MANREGISTER, AttrRegSym) \
149 m : decl(S_MANSLOT, AttrSlotSym) \
150 m : decl(S_MANMANYREG, AttrManyRegSym) \
151 m : decl(S_MANREGREL, AttrRegRel) \
152 m : decl(S_MANMANYREG2, AttrManyRegSym2) \
153 m : decl(S_UNAMESPACE, UnamespaceSym) \
154 m : decl(S_PROCREF, RefSym2) \
155 m : decl(S_DATAREF, RefSym2) \
156 m : decl(S_LPROCREF, RefSym2) \
157 m : decl(S_ANNOTATIONREF, Unknown) \
158 m : decl(S_TOKENREF, Unknown) \
159 m : decl(S_GMANPROC, ManProcSym) \
160 m : decl(S_LMANPROC, ManProcSym) \
161 m : decl(S_TRAMPOLINE, TrampolineSym) \
162 m : decl(S_MANCONSTANT, ConstSym) \
163 m : decl(S_ATTR_FRAMEREL, FrameRelSym) \
164 m : decl(S_ATTR_REGISTER, AttrRegSym) \
165 m : decl(S_ATTR_REGREL, AttrRegRel) \
166 m : decl(S_ATTR_MANYREG, AttrManyRegSym2) \
167 m : decl(S_SEPCODE, SepCodSym) \
168 m : decl(S_LOCAL, LocalSym) \
169 m : decl(S_DEFRANGE, DefRangeSym) \
170 m : decl(S_DEFRANGE2, DefRangeSym2) \
171 m : decl(S_SECTION, SectionSym) \
172 m : decl(S_COFFGROUP, CoffGroupSym) \
173 m : decl(S_EXPORT, ExportSym) \
174 m : decl(S_CALLSITEINFO, CallsiteInfo) \
175 m : decl(S_FRAMECOOKIE, FrameCookie) \
176 m : decl(S_DISCARDED, DiscardedSym) \
177 m : decl(S_COMPILE3, CompileSym2) \
178 m : decl(S_MSTOOLENV_V3, MSToolEnvV3) \
179 m : decl(S_LOCAL_VS2013, LocalSym2013) \
180 m : decl(S_FPOFF_VS2013, FPOffs2013) \
181 m : decl(S_LPROC32_VS2013, ProcSym32) \
182 m : decl(S_GPROC32_VS2013, ProcSym32)
183 :
184 : // This macro allows the easy construction of switch statements over the
185 : // numeric leaves types.
186 : #define NUMERIC_LEAVES_CASE_TABLE(decl) \
187 m : decl(LF_CHAR, LeafChar) \
188 m : decl(LF_SHORT, LeafShort) \
189 m : decl(LF_USHORT, LeafUShort) \
190 m : decl(LF_LONG, LeafLong) \
191 m : decl(LF_ULONG, LeafULong) \
192 m : decl(LF_REAL32, LeafReal32) \
193 m : decl(LF_REAL64, LeafReal64) \
194 m : decl(LF_REAL80, LeafReal80) \
195 m : decl(LF_REAL128, LeafReal128) \
196 m : decl(LF_QUADWORD, LeafQuad) \
197 m : decl(LF_UQUADWORD, LeafUQuad) \
198 m : decl(LF_COMPLEX32, LeafCmplx32) \
199 m : decl(LF_COMPLEX64, LeafCmplx64) \
200 m : decl(LF_COMPLEX80, LeafCmplx80) \
201 m : decl(LF_COMPLEX128, LeafCmplx128)
202 :
203 : // This macro allow the easy construction of switch statements over the leaf
204 : // enum. It define the case table, the first parameter of each entry is the type
205 : // of the leaf record and the second one is the type of structure used to
206 : // represent this leaf.
207 : #define LEAF_CASE_TABLE(decl) \
208 m : decl(LF_VTSHAPE, LeafVTShape) \
209 m : decl(LF_COBOL1, LeafCobol1) \
210 m : decl(LF_LABEL, LeafLabel) \
211 m : decl(LF_NULL, UnknownLeaf) \
212 m : decl(LF_NOTTRAN, UnknownLeaf) \
213 m : decl(LF_ENDPRECOMP, LeafEndPreComp) \
214 m : decl(LF_TYPESERVER_ST, UnknownLeaf) \
215 m : decl(LF_LIST, LeafList) \
216 m : decl(LF_REFSYM, LeafRefSym) \
217 m : decl(LF_ENUMERATE_ST, UnknownLeaf) \
218 m : decl(LF_TI16_MAX, UnknownLeaf) \
219 m : decl(LF_MODIFIER, LeafModifier) \
220 m : decl(LF_POINTER, LeafPointer) \
221 m : decl(LF_ARRAY_ST, UnknownLeaf) \
222 m : decl(LF_CLASS_ST, UnknownLeaf) \
223 m : decl(LF_STRUCTURE_ST, UnknownLeaf) \
224 m : decl(LF_UNION_ST, UnknownLeaf) \
225 m : decl(LF_ENUM_ST, UnknownLeaf) \
226 m : decl(LF_PROCEDURE, LeafProc) \
227 m : decl(LF_MFUNCTION, LeafMFunc) \
228 m : decl(LF_COBOL0, LeafCobol0) \
229 m : decl(LF_BARRAY, LeafBArray) \
230 m : decl(LF_DIMARRAY_ST, UnknownLeaf) \
231 m : decl(LF_VFTPATH, LeafVFTPath) \
232 m : decl(LF_PRECOMP_ST, UnknownLeaf) \
233 m : decl(LF_OEM, LeafOEM) \
234 m : decl(LF_ALIAS_ST, UnknownLeaf) \
235 m : decl(LF_OEM2, LeafOEM2) \
236 m : decl(LF_SKIP, LeafSkip) \
237 m : decl(LF_ARGLIST, LeafArgList) \
238 m : decl(LF_DEFARG_ST, UnknownLeaf) \
239 m : decl(LF_FIELDLIST, LeafFieldList) \
240 m : decl(LF_DERIVED, LeafDerived) \
241 m : decl(LF_BITFIELD, LeafBitfield) \
242 m : decl(LF_METHODLIST, LeafMethodList) \
243 m : decl(LF_DIMCONU, LeafDimCon) \
244 m : decl(LF_DIMCONLU, LeafDimCon) \
245 m : decl(LF_DIMVARU, LeafDimVar) \
246 m : decl(LF_DIMVARLU, LeafDimVar) \
247 m : decl(LF_BCLASS, LeafBClass) \
248 m : decl(LF_VBCLASS, LeafVBClass) \
249 m : decl(LF_IVBCLASS, LeafVBClass) \
250 m : decl(LF_FRIENDFCN_ST, UnknownLeaf) \
251 m : decl(LF_INDEX, LeafIndex) \
252 m : decl(LF_MEMBER_ST, UnknownLeaf) \
253 m : decl(LF_STMEMBER_ST, UnknownLeaf) \
254 m : decl(LF_METHOD_ST, UnknownLeaf) \
255 m : decl(LF_NESTTYPE_ST, UnknownLeaf) \
256 m : decl(LF_VFUNCTAB, LeafVFuncTab) \
257 m : decl(LF_FRIENDCLS, UnknownLeaf) \
258 m : decl(LF_ONEMETHOD_ST, UnknownLeaf) \
259 m : decl(LF_VFUNCOFF, LeafVFuncOff) \
260 m : decl(LF_NESTTYPEEX_ST, UnknownLeaf) \
261 m : decl(LF_MEMBERMODIFY_ST, UnknownLeaf) \
262 m : decl(LF_MANAGED_ST, UnknownLeaf) \
263 m : decl(LF_TYPESERVER, LeafTypeServer) \
264 m : decl(LF_ENUMERATE, LeafEnumerate) \
265 m : decl(LF_ARRAY, LeafArray) \
266 m : decl(LF_CLASS, LeafClass) \
267 m : decl(LF_STRUCTURE, LeafClass) \
268 m : decl(LF_UNION, LeafUnion) \
269 m : decl(LF_ENUM, LeafEnum) \
270 m : decl(LF_DIMARRAY, LeafDimArray) \
271 m : decl(LF_PRECOMP, LeafPreComp) \
272 m : decl(LF_ALIAS, LeafAlias) \
273 m : decl(LF_DEFARG, LeafDefArg) \
274 m : decl(LF_FRIENDFCN, LeafFriendFcn) \
275 m : decl(LF_MEMBER, LeafMember) \
276 m : decl(LF_STMEMBER, LeafSTMember) \
277 m : decl(LF_METHOD, LeafMethod) \
278 m : decl(LF_NESTTYPE, LeafNestType) \
279 m : decl(LF_ONEMETHOD, LeafOneMethod) \
280 m : decl(LF_NESTTYPEEX, LeafNestTypeEx) \
281 m : decl(LF_MEMBERMODIFY, LeafMemberModify) \
282 m : decl(LF_MANAGED, LeafManaged) \
283 m : decl(LF_TYPESERVER2, LeafTypeServer2) \
284 m : decl(LF_VARSTRING, LeafVarString)
285 :
286 : // This macro allow the easy construction of switch statements over the special
287 : // types enum. It define the case table, the parameter of each entry is the type
288 : // of the special type record.
289 : #define SPECIAL_TYPE_CASE_TABLE(decl) \
290 m : decl(T_NOTYPE) \
291 m : decl(T_ABS) \
292 m : decl(T_SEGMENT) \
293 m : decl(T_VOID) \
294 m : decl(T_HRESULT) \
295 m : decl(T_32PHRESULT) \
296 m : decl(T_64PHRESULT) \
297 m : decl(T_PVOID) \
298 m : decl(T_PFVOID) \
299 m : decl(T_PHVOID) \
300 m : decl(T_32PVOID) \
301 m : decl(T_64PVOID) \
302 m : decl(T_CURRENCY) \
303 m : decl(T_NOTTRANS) \
304 m : decl(T_BIT) \
305 m : decl(T_PASCHAR) \
306 m : decl(T_CHAR) \
307 m : decl(T_32PCHAR) \
308 m : decl(T_64PCHAR) \
309 m : decl(T_UCHAR) \
310 m : decl(T_32PUCHAR) \
311 m : decl(T_64PUCHAR) \
312 m : decl(T_RCHAR) \
313 m : decl(T_32PRCHAR) \
314 m : decl(T_64PRCHAR) \
315 m : decl(T_WCHAR) \
316 m : decl(T_32PWCHAR) \
317 m : decl(T_64PWCHAR) \
318 m : decl(T_INT1) \
319 m : decl(T_32PINT1) \
320 m : decl(T_64PINT1) \
321 m : decl(T_UINT1) \
322 m : decl(T_32PUINT1) \
323 m : decl(T_64PUINT1) \
324 m : decl(T_SHORT) \
325 m : decl(T_32PSHORT) \
326 m : decl(T_64PSHORT) \
327 m : decl(T_USHORT) \
328 m : decl(T_32PUSHORT) \
329 m : decl(T_64PUSHORT) \
330 m : decl(T_INT2) \
331 m : decl(T_32PINT2) \
332 m : decl(T_64PINT2) \
333 m : decl(T_UINT2) \
334 m : decl(T_32PUINT2) \
335 m : decl(T_64PUINT2) \
336 m : decl(T_LONG) \
337 m : decl(T_ULONG) \
338 m : decl(T_32PLONG) \
339 m : decl(T_32PULONG) \
340 m : decl(T_64PLONG) \
341 m : decl(T_64PULONG) \
342 m : decl(T_INT4) \
343 m : decl(T_32PINT4) \
344 m : decl(T_64PINT4) \
345 m : decl(T_UINT4) \
346 m : decl(T_32PUINT4) \
347 m : decl(T_64PUINT4) \
348 m : decl(T_QUAD) \
349 m : decl(T_32PQUAD) \
350 m : decl(T_64PQUAD) \
351 m : decl(T_UQUAD) \
352 m : decl(T_32PUQUAD) \
353 m : decl(T_64PUQUAD) \
354 m : decl(T_INT8) \
355 m : decl(T_32PINT8) \
356 m : decl(T_64PINT8) \
357 m : decl(T_UINT8) \
358 m : decl(T_32PUINT8) \
359 m : decl(T_64PUINT8) \
360 m : decl(T_OCT) \
361 m : decl(T_32POCT) \
362 m : decl(T_64POCT) \
363 m : decl(T_UOCT) \
364 m : decl(T_32PUOCT) \
365 m : decl(T_64PUOCT) \
366 m : decl(T_INT16) \
367 m : decl(T_32PINT16) \
368 m : decl(T_64PINT16) \
369 m : decl(T_UINT16) \
370 m : decl(T_32PUINT16) \
371 m : decl(T_64PUINT16) \
372 m : decl(T_REAL32) \
373 m : decl(T_32PREAL32) \
374 m : decl(T_64PREAL32) \
375 m : decl(T_REAL64) \
376 m : decl(T_32PREAL64) \
377 m : decl(T_64PREAL64) \
378 m : decl(T_REAL80) \
379 m : decl(T_32PREAL80) \
380 m : decl(T_64PREAL80) \
381 m : decl(T_REAL128) \
382 m : decl(T_32PREAL128) \
383 m : decl(T_64PREAL128) \
384 m : decl(T_CPLX32) \
385 m : decl(T_32PCPLX32) \
386 m : decl(T_64PCPLX32) \
387 m : decl(T_CPLX64) \
388 m : decl(T_32PCPLX64) \
389 m : decl(T_64PCPLX64) \
390 m : decl(T_CPLX80) \
391 m : decl(T_32PCPLX80) \
392 m : decl(T_64PCPLX80) \
393 m : decl(T_CPLX128) \
394 m : decl(T_32PCPLX128) \
395 m : decl(T_64PCPLX128) \
396 m : decl(T_BOOL08) \
397 m : decl(T_32PBOOL08) \
398 m : decl(T_64PBOOL08) \
399 m : decl(T_BOOL16) \
400 m : decl(T_32PBOOL16) \
401 m : decl(T_64PBOOL16) \
402 m : decl(T_BOOL32) \
403 m : decl(T_32PBOOL32) \
404 m : decl(T_64PBOOL32) \
405 m : decl(T_BOOL64) \
406 m : decl(T_32PBOOL64) \
407 m : decl(T_64PBOOL64)
408 :
409 : // This macro allow the easy construction of switch statements over the special
410 : // types enum when constructing their names and sizes.
411 : #define SPECIAL_TYPE_NAME_CASE_TABLE(decl) \
412 m : decl(T_NOTYPE, NoType, 0) \
413 m : decl(T_ABS, Abs, 0) \
414 m : decl(T_SEGMENT, Segment, 0) \
415 m : decl(T_VOID, void, 0) \
416 m : decl(T_PVOID, nullptr_t, 0) \
417 m : decl(T_HRESULT, HRESULT, 4) \
418 m : decl(T_CURRENCY, Currency, 8) \
419 m : decl(T_NOTTRANS, NotTransposed, 0) \
420 m : decl(T_BIT, Bit, 0) \
421 m : decl(T_PASCHAR, char, 1) \
422 m : decl(T_CHAR, int8_t, 1) \
423 m : decl(T_UCHAR, uint8_t, 1) \
424 m : decl(T_RCHAR, char, 1) \
425 m : decl(T_WCHAR, wchar_t, 2) \
426 m : decl(T_INT1, int8_t, 1) \
427 m : decl(T_UINT1, uint8_t, 1) \
428 m : decl(T_SHORT, int16_t, 2) \
429 m : decl(T_USHORT, uint16_t, 2) \
430 m : decl(T_INT2, int16_t, 2) \
431 m : decl(T_UINT2, uint16_t, 2) \
432 m : decl(T_LONG, int32_t, 4) \
433 m : decl(T_ULONG, uint32_t, 4) \
434 m : decl(T_INT4, int32_t, 4) \
435 m : decl(T_UINT4, uint32_t, 4) \
436 m : decl(T_QUAD, int64_t, 8) \
437 m : decl(T_UQUAD, uint64_t, 8) \
438 m : decl(T_INT8, int64_t, 8) \
439 m : decl(T_UINT8, uint64_t, 8) \
440 m : decl(T_OCT, int128_t, 16) \
441 m : decl(T_UOCT, uint128_t, 16) \
442 m : decl(T_INT16, int128_t, 16) \
443 m : decl(T_UINT16, uint128_t, 16) \
444 m : decl(T_REAL32, float, 4) \
445 m : decl(T_REAL64, double, 8) \
446 m : decl(T_REAL80, double80, 10) \
447 m : decl(T_REAL128, double128, 16) \
448 m : decl(T_CPLX32, Complex32, 8) \
449 m : decl(T_CPLX64, Complex64, 16) \
450 m : decl(T_CPLX80, Complex80, 20) \
451 m : decl(T_CPLX128, Complex128, 32) \
452 m : decl(T_BOOL08, bool, 1) \
453 m : decl(T_BOOL16, Bool16, 2) \
454 m : decl(T_BOOL32, Bool32, 4) \
455 m : decl(T_BOOL64, Bool64, 8)
456 :
457 : // All of the data structures below need to have tight alignment so that they
458 : // can be overlaid directly onto byte streams.
459 : #pragma pack(push, 1)
460 :
461 : // This structure represent a bitfields for a leaf member attribute field as
462 : // it is describet in the document "Microsoft Symbol and Type Information". Here
463 : // is the bit format:
464 : // mprop :3 Specifies the properties for methods
465 : // 0 Vanilla method
466 : // 1 Virtual method
467 : // 2 Static method
468 : // 3 Friend method
469 : // 4 Introducing virtual method
470 : // 5 Pure virtual method
471 : // 6 Pure introducing virtual method
472 : // 7 Reserved
473 : // pseudo :1 True if the method is never instantiated by the compiler
474 : // noinherit :1 True if the class cannot be inherited
475 : // noconstruct :1 True if the class cannot be constructed
476 : // reserved :8
477 m : union LeafMemberAttributeField {
478 : // This is effectively the same as CV_access_e in cvconst.h, but with a value
479 : // defined for 0.
480 m : enum AccessProtection {
481 m : no_access_protection = 0,
482 m : private_access = 1,
483 m : protected_access = 2,
484 m : public_access = 3,
485 m : };
486 m : uint16 raw;
487 m : struct {
488 m : uint16 access : 2; // Of type AccessProtection.
489 m : uint16 mprop : 3; // Of type CV_methodprop.
490 m : uint16 pseudo : 1;
491 m : uint16 noinherit : 1;
492 m : uint16 noconstruct : 1;
493 m : uint16 compgenx : 1;
494 m : uint16 reserved : 7;
495 m : };
496 m : };
497 : // We coerce a stream of bytes to this structure, so we require it to be
498 : // exactly 2 bytes in size.
499 m : COMPILE_ASSERT_IS_POD_OF_SIZE(LeafMemberAttributeField, 2);
500 :
501 : // This structure represent a bitfield for a leaf property field.
502 m : union LeafPropertyField {
503 m : uint16 raw;
504 m : struct {
505 m : uint16 packed : 1;
506 m : uint16 ctor : 1;
507 m : uint16 ovlops : 1;
508 m : uint16 isnested : 1;
509 m : uint16 cnested : 1;
510 m : uint16 opassign : 1;
511 m : uint16 opcast : 1;
512 m : uint16 fwdref : 1;
513 m : uint16 scoped : 1;
514 m : uint16 decorated_name_present : 1;
515 m : uint16 reserved : 6;
516 m : };
517 m : };
518 : // We coerce a stream of bytes to this structure, so we require it to be
519 : // exactly 2 bytes in size.
520 m : COMPILE_ASSERT_IS_POD_OF_SIZE(LeafPropertyField, 2);
521 :
522 : // This structure represent a bitfield for a leaf pointer attribute.
523 m : union LeafPointerAttribute {
524 m : uint32 raw;
525 m : struct {
526 m : uint32 ptrtype : 5; // Of type CV_ptrtype.
527 m : uint32 ptrmode : 3; // Of type CV_ptrmode.
528 m : uint32 isflat32 : 1;
529 m : uint32 isvolatile : 1;
530 m : uint32 isconst : 1;
531 m : uint32 isunaligned : 1;
532 m : uint32 isrestrict : 1;
533 m : uint32 reserved : 19;
534 m : };
535 m : };
536 : // We coerce a stream of bytes to this structure, so we require it to be
537 : // exactly 4 bytes in size.
538 m : COMPILE_ASSERT_IS_POD_OF_SIZE(LeafPointerAttribute, 4);
539 :
540 : // This structure represent a bitfield for a leaf modifier attribute.
541 m : union LeafModifierAttribute {
542 m : uint16 raw;
543 m : struct {
544 m : uint16 mod_const : 1;
545 m : uint16 mod_volatile : 1;
546 m : uint16 mod_unaligned : 1;
547 m : uint16 reserved : 13;
548 m : };
549 m : };
550 : // We coerce a stream of bytes to this structure, so we require it to be
551 : // exactly 2 bytes in size.
552 m : COMPILE_ASSERT_IS_POD_OF_SIZE(LeafModifierAttribute, 2);
553 :
554 : // This defines flags used in compiland details. See COMPILANDSYM_FLAGS for
555 : // detail.
556 m : union CompileSymFlags {
557 m : uint32 raw;
558 m : struct {
559 : // Language index. See CV_CFL_LANG.
560 m : uint16 iLanguage : 8;
561 : // Compiled with edit and continue support.
562 m : uint16 fEC : 1;
563 : // Not compiled with debug info.
564 m : uint16 fNoDbgInfo : 1;
565 : // Compiled with LTCG.
566 m : uint16 fLTCG : 1;
567 : // Compiled with -Bzalign.
568 m : uint16 fNoDataAlign : 1;
569 : // Managed code/data present.
570 m : uint16 fManagedPresent : 1;
571 : // Compiled with /GS.
572 m : uint16 fSecurityChecks : 1;
573 : // Compiled with /hotpatch.
574 m : uint16 fHotPatch : 1;
575 : // Converted with CVTCIL.
576 m : uint16 fCVTCIL : 1;
577 : // MSIL netmodule
578 m : uint16 fMSILModule : 1;
579 m : uint16 reserved : 15;
580 m : };
581 m : };
582 : // We coerce a stream of bytes to this structure, so we require it to be
583 : // exactly 4 bytes in size.
584 m : COMPILE_ASSERT_IS_POD_OF_SIZE(CompileSymFlags, 4);
585 :
586 : // This is a new compiland details symbol type seen in MSVS 2010 and later.
587 m : struct CompileSym2 {
588 : // uint16 reclen; // Record length.
589 : // uint16 rectyp; // S_COMPILE3.
590 m : CompileSymFlags flags;
591 : // Target processor. See CV_CPU_TYPE_e enum.
592 m : uint16 machine;
593 : // Front-end major version number.
594 m : uint16 verFEMajor;
595 : // Front-end minor version number.
596 m : uint16 verFEMinor;
597 : // Front-end build version number.
598 m : uint16 verFEBuild;
599 : // Front-end revision number.
600 m : uint16 verFERevision;
601 : // Back-end major version number.
602 m : uint16 verMajor;
603 : // Back-end minor version number.
604 m : uint16 verMinor;
605 : // Back-end build version number.
606 m : uint16 verBuild;
607 : // Back-end revision number.
608 m : uint16 verRevision;
609 : // Zero-terminated compiler version string. This is followed by zero or more
610 : // zero-terminated strings 'verArgs'. The whole list is terminated by an
611 : // empty verArg string (a double-zero).
612 m : char verSt[1];
613 m : };
614 m : COMPILE_ASSERT_IS_POD_OF_SIZE(CompileSym2, 23);
615 :
616 : // This is a new compiland details symbol type seen in MSVS 2010 and later.
617 m : struct MSToolEnvV3 {
618 : // uint16 reclen; // Record length.
619 : // uint16 rectyp; // S_MSTOOLENV_V3.
620 m : char leading_zero;
621 : // An array of key-value pairs, encoded as null terminated strings.
622 m : char key_values[1];
623 m : };
624 m : COMPILE_ASSERT_IS_POD_OF_SIZE(MSToolEnvV3, 2);
625 :
626 : // Length prefixed string.
627 m : struct LPString {
628 m : uint8 length;
629 m : uint8 string[1];
630 m : };
631 m : COMPILE_ASSERT_IS_POD_OF_SIZE(LPString, 2);
632 :
633 : // Symbols seen in CodeView2 symbol streams.
634 m : struct CompileSymCV2 {
635 : // Machine type. See CV_CPU_TYPE_e enum.
636 m : uint8 machine;
637 m : union {
638 : // Raw flags.
639 m : uint8 flags[3];
640 : // Parsed flags.
641 m : struct {
642 : // Language index. See CV_CFL_LANG.
643 m : uint8 language : 8;
644 m : uint8 pcode_present : 1;
645 : // 0: ???
646 : // 1: ANSI C floating point rules.
647 : // 2-3: Reserved.
648 m : uint8 float_precision : 2;
649 : // 0: Hardware processor.
650 : // 1: Emulator.
651 : // 2: Altmath.
652 : // 3: Reserved.
653 m : uint8 float_package : 2;
654 : // 0: Near.
655 : // 1: Far.
656 : // 2: Huge.
657 : // 3-7: Reserved.
658 m : uint8 ambient_data : 3;
659 m : uint8 ambient_code : 3;
660 : // Compiled for 32-bit addresses.
661 m : uint8 mode32 : 1;
662 m : uint8 reserved : 4;
663 m : };
664 m : };
665 : // Length-prefixed version string.
666 m : LPString version;
667 m : };
668 m : COMPILE_ASSERT_IS_POD_OF_SIZE(CompileSymCV2, 6);
669 :
670 : // This defines flags used for local variables. See CV_LVARFLAGS for detail.
671 m : union LocalVarFlags {
672 m : uint16 raw;
673 m : struct {
674 m : uint16 fIsParam : 1;
675 m : uint16 fAddrTaken : 1;
676 m : uint16 fCompGenx : 1;
677 m : uint16 fIsAggregate : 1;
678 m : uint16 fIsAggregated : 1;
679 m : uint16 fIsAliased : 1;
680 m : uint16 fIsAlias : 1;
681 m : uint16 reserved : 9;
682 m : };
683 m : };
684 : // We coerce a stream of bytes to this structure, so we require it to be
685 : // exactly 2 bytes in size.
686 m : COMPILE_ASSERT_IS_POD_OF_SIZE(LocalVarFlags, 2);
687 :
688 : // New symbol used for local symbols.
689 m : struct LocalSym2013 {
690 m : uint32 typind; // (type index) type index
691 m : LocalVarFlags flags; // local var flags
692 m : uint8 name[1]; // Name of this symbol.
693 m : };
694 m : COMPILE_ASSERT_IS_POD_OF_SIZE(LocalSym2013, 7);
695 :
696 : // Frame pointer offset for LocalSym2013 variable.
697 m : struct FPOffs2013 {
698 m : int offs;
699 m : };
700 m : COMPILE_ASSERT_IS_POD_OF_SIZE(FPOffs2013, 4);
701 :
702 : // Defines flags used for export symbols, see EXPORTSYM_FLAGS.
703 m : union ExportVarFlags {
704 m : uint16 raw;
705 m : struct {
706 m : uint16 fConstant : 1;
707 m : uint16 fData : 1;
708 m : uint16 fPrivate : 1;
709 m : uint16 fNoName : 1;
710 m : uint16 fOrdinal : 1;
711 m : uint16 fForwarder : 1;
712 m : uint16 reserved : 10;
713 m : };
714 m : };
715 : // We coerce a stream of bytes to this structure, so we require it to be
716 : // exactly 2 bytes in size.
717 m : COMPILE_ASSERT_IS_POD_OF_SIZE(ExportVarFlags, 2);
718 :
719 : // Defines flags used for fram proc symbols, see FRAMEPROCSYM_FLAGS.
720 m : union FrameProcSymFlags {
721 m : uint16 raw;
722 m : struct {
723 m : uint16 fHasAlloca : 1;
724 m : uint16 fHasSetJmp : 1;
725 m : uint16 fHasLongJmp : 1;
726 m : uint16 fHasInlAsm : 1;
727 m : uint16 fHasEH : 1;
728 m : uint16 fInlSpec : 1;
729 m : uint16 fHasSEH : 1;
730 m : uint16 fNaked : 1;
731 m : uint16 fSecurityChecks : 1;
732 m : uint16 fAsyncEH : 1;
733 m : uint16 fGSNoStackOrdering : 1;
734 m : uint16 fWasInlined : 1;
735 m : uint16 reserved : 4;
736 m : };
737 m : };
738 : // We coerce a stream of bytes to this structure, so we require it to be
739 : // exactly 2 bytes in size.
740 m : COMPILE_ASSERT_IS_POD_OF_SIZE(FrameProcSymFlags, 2);
741 :
742 : #pragma pack(pop)
743 :
744 : #endif // SYZYGY_PE_CVINFO_EXT_H_
|