Improve llvm-pdbdump output display.
[oota-llvm.git] / include / llvm / DebugInfo / PDB / PDBTypes.h
1 //===- PDBTypes.h - Defines enums for various fields contained in PDB ---*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_DEBUGINFO_PDB_PDBTYPES_H
11 #define LLVM_DEBUGINFO_PDB_PDBTYPES_H
12
13 #include <stdint.h>
14 #include <functional>
15 #include "llvm/Config/llvm-config.h"
16
17 namespace llvm {
18
19 class PDBSymbol;
20 class PDBSymbolCompiland;
21 class PDBSymbolFunc;
22 class PDBSymbolExe;
23
24 class IPDBDataStream;
25 template <class T> class IPDBEnumChildren;
26 class IPDBRawSymbol;
27 class IPDBSession;
28 class IPDBSourceFile;
29
30 typedef IPDBEnumChildren<PDBSymbol> IPDBEnumSymbols;
31 typedef IPDBEnumChildren<IPDBSourceFile> IPDBEnumSourceFiles;
32 typedef IPDBEnumChildren<IPDBDataStream> IPDBEnumDataStreams;
33
34 class PDBSymbolExe;
35 class PDBSymbolCompiland;
36 class PDBSymbolCompilandDetails;
37 class PDBSymbolCompilandEnv;
38 class PDBSymbolFunc;
39 class PDBSymbolBlock;
40 class PDBSymbolData;
41 class PDBSymbolAnnotation;
42 class PDBSymbolLabel;
43 class PDBSymbolPublicSymbol;
44 class PDBSymbolTypeUDT;
45 class PDBSymbolTypeEnum;
46 class PDBSymbolTypeFunctionSig;
47 class PDBSymbolTypePointer;
48 class PDBSymbolTypeArray;
49 class PDBSymbolTypeBuiltin;
50 class PDBSymbolTypeTypedef;
51 class PDBSymbolTypeBaseClass;
52 class PDBSymbolTypeFriend;
53 class PDBSymbolTypeFunctionArg;
54 class PDBSymbolFuncDebugStart;
55 class PDBSymbolFuncDebugEnd;
56 class PDBSymbolUsingNamespace;
57 class PDBSymbolTypeVTableShape;
58 class PDBSymbolTypeVTable;
59 class PDBSymbolCustom;
60 class PDBSymbolThunk;
61 class PDBSymbolTypeCustom;
62 class PDBSymbolTypeManaged;
63 class PDBSymbolTypeDimension;
64 class PDBSymbolUnknown;
65
66 /// Specifies which PDB reader implementation is to be used.  Only a value
67 /// of PDB_ReaderType::DIA is supported.
68 enum class PDB_ReaderType {
69   DIA = 0,
70 };
71
72 enum class PDB_DumpLevel {
73   Compact,
74   Normal,
75   Detailed,
76 };
77
78 /// Defines a 128-bit unique identifier.  This maps to a GUID on Windows, but
79 /// is abstracted here for the purposes of non-Windows platforms that don't have
80 /// the GUID structure defined.
81 struct PDB_UniqueId {
82   uint64_t HighPart;
83   uint64_t LowPart;
84 };
85
86 /// An enumeration indicating the type of data contained in this table.
87 enum class PDB_TableType {
88   Symbols,
89   SourceFiles,
90   LineNumbers,
91   SectionContribs,
92   Segments,
93   InjectedSources,
94   FrameData
95 };
96
97 /// Defines flags used for enumerating child symbols.  This corresponds to the
98 /// NameSearchOptions enumeration which is documented here:
99 /// https://msdn.microsoft.com/en-us/library/yat28ads.aspx
100 enum PDB_NameSearchFlags {
101   NS_Default = 0x0,
102   NS_CaseSensitive = 0x1,
103   NS_CaseInsensitive = 0x2,
104   NS_FileNameExtMatch = 0x4,
105   NS_Regex = 0x8,
106   NS_UndecoratedName = 0x10
107 };
108
109 /// Specifies the hash algorithm that a source file from a PDB was hashed with.
110 /// This corresponds to the CV_SourceChksum_t enumeration and are documented
111 /// here: https://msdn.microsoft.com/en-us/library/e96az21x.aspx
112 enum class PDB_Checksum { None = 0, MD5 = 1, SHA1 = 2 };
113
114 /// These values correspond to the CV_CPU_TYPE_e enumeration, and are documented
115 /// here: https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
116 enum class PDB_Cpu {
117   Intel8080 = 0x0,
118   Intel8086 = 0x1,
119   Intel80286 = 0x2,
120   Intel80386 = 0x3,
121   Intel80486 = 0x4,
122   Pentium = 0x5,
123   PentiumPro = 0x6,
124   Pentium3 = 0x7,
125   MIPS = 0x10,
126   MIPS16 = 0x11,
127   MIPS32 = 0x12,
128   MIPS64 = 0x13,
129   MIPSI = 0x14,
130   MIPSII = 0x15,
131   MIPSIII = 0x16,
132   MIPSIV = 0x17,
133   MIPSV = 0x18,
134   M68000 = 0x20,
135   M68010 = 0x21,
136   M68020 = 0x22,
137   M68030 = 0x23,
138   M68040 = 0x24,
139   Alpha = 0x30,
140   Alpha21164 = 0x31,
141   Alpha21164A = 0x32,
142   Alpha21264 = 0x33,
143   Alpha21364 = 0x34,
144   PPC601 = 0x40,
145   PPC603 = 0x41,
146   PPC604 = 0x42,
147   PPC620 = 0x43,
148   PPCFP = 0x44,
149   PPCBE = 0x45,
150   SH3 = 0x50,
151   SH3E = 0x51,
152   SH3DSP = 0x52,
153   SH4 = 0x53,
154   SHMedia = 0x54,
155   ARM3 = 0x60,
156   ARM4 = 0x61,
157   ARM4T = 0x62,
158   ARM5 = 0x63,
159   ARM5T = 0x64,
160   ARM6 = 0x65,
161   ARM_XMAC = 0x66,
162   ARM_WMMX = 0x67,
163   ARM7 = 0x68,
164   Omni = 0x70,
165   Ia64 = 0x80,
166   Ia64_2 = 0x81,
167   CEE = 0x90,
168   AM33 = 0xa0,
169   M32R = 0xb0,
170   TriCore = 0xc0,
171   X64 = 0xd0,
172   EBC = 0xe0,
173   Thumb = 0xf0,
174   ARMNT = 0xf4,
175   D3D11_Shader = 0x100,
176 };
177
178 enum class PDB_Machine {
179   Invalid = 0xffff,
180   Unknown = 0x0,
181   Am33 = 0x13,
182   Amd64 = 0x8664,
183   Arm = 0x1C0,
184   ArmNT = 0x1C4,
185   Ebc = 0xEBC,
186   x86 = 0x14C,
187   Ia64 = 0x200,
188   M32R = 0x9041,
189   Mips16 = 0x266,
190   MipsFpu = 0x366,
191   MipsFpu16 = 0x466,
192   PowerPC = 0x1F0,
193   PowerPCFP = 0x1F1,
194   R4000 = 0x166,
195   SH3 = 0x1A2,
196   SH3DSP = 0x1A3,
197   SH4 = 0x1A6,
198   SH5 = 0x1A8,
199   Thumb = 0x1C2,
200   WceMipsV2 = 0x169
201 };
202
203 /// These values correspond to the CV_call_e enumeration, and are documented
204 /// at the following locations:
205 ///   https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
206 ///   https://msdn.microsoft.com/en-us/library/windows/desktop/ms680207(v=vs.85).aspx
207 ///
208 enum class PDB_CallingConv {
209   NearCdecl = 0x00,
210   FarCdecl = 0x01,
211   NearPascal = 0x02,
212   FarPascal = 0x03,
213   NearFastcall = 0x04,
214   FarFastcall = 0x05,
215   Skipped = 0x06,
216   NearStdcall = 0x07,
217   FarStdcall = 0x08,
218   NearSyscall = 0x09,
219   FarSyscall = 0x0a,
220   Thiscall = 0x0b,
221   MipsCall = 0x0c,
222   Generic = 0x0d,
223   Alphacall = 0x0e,
224   Ppccall = 0x0f,
225   SuperHCall = 0x10,
226   Armcall = 0x11,
227   AM33call = 0x12,
228   Tricall = 0x13,
229   Sh5call = 0x14,
230   M32R = 0x15,
231   Clrcall = 0x16,
232   Inline = 0x17,
233   NearVectorcall = 0x18,
234   Reserved = 0x19,
235 };
236
237 /// These values correspond to the CV_CFL_LANG enumeration, and are documented
238 /// here: https://msdn.microsoft.com/en-us/library/bw3aekw6.aspx
239 enum class PDB_Lang {
240   C = 0x00,
241   Cpp = 0x01,
242   Fortran = 0x02,
243   Masm = 0x03,
244   Pascal = 0x04,
245   Basic = 0x05,
246   Cobol = 0x06,
247   Link = 0x07,
248   Cvtres = 0x08,
249   Cvtpgd = 0x09,
250   CSharp = 0x0a,
251   VB = 0x0b,
252   ILAsm = 0x0c,
253   Java = 0x0d,
254   JScript = 0x0e,
255   MSIL = 0x0f,
256   HLSL = 0x10
257 };
258
259 /// These values correspond to the DataKind enumeration, and are documented
260 /// here: https://msdn.microsoft.com/en-us/library/b2x2t313.aspx
261 enum class PDB_DataKind {
262   Unknown,
263   Local,
264   StaticLocal,
265   Param,
266   ObjectPtr,
267   FileStatic,
268   Global,
269   Member,
270   StaticMember,
271   Constant
272 };
273
274 /// These values correspond to the SymTagEnum enumeration, and are documented
275 /// here: https://msdn.microsoft.com/en-us/library/bkedss5f.aspx
276 enum class PDB_SymType {
277   None,
278   Exe,
279   Compiland,
280   CompilandDetails,
281   CompilandEnv,
282   Function,
283   Block,
284   Data,
285   Annotation,
286   Label,
287   PublicSymbol,
288   UDT,
289   Enum,
290   FunctionSig,
291   PointerType,
292   ArrayType,
293   BuiltinType,
294   Typedef,
295   BaseClass,
296   Friend,
297   FunctionArg,
298   FuncDebugStart,
299   FuncDebugEnd,
300   UsingNamespace,
301   VTableShape,
302   VTable,
303   Custom,
304   Thunk,
305   CustomType,
306   ManagedType,
307   Dimension,
308   Max
309 };
310
311 /// These values correspond to the LocationType enumeration, and are documented
312 /// here: https://msdn.microsoft.com/en-us/library/f57kaez3.aspx
313 enum class PDB_LocType {
314   Null,
315   Static,
316   TLS,
317   RegRel,
318   ThisRel,
319   Enregistered,
320   BitField,
321   Slot,
322   IlRel,
323   MetaData,
324   Constant,
325   Max
326 };
327
328 /// These values correspond to the THUNK_ORDINAL enumeration, and are documented
329 /// here: https://msdn.microsoft.com/en-us/library/dh0k8hft.aspx
330 enum class PDB_ThunkOrdinal {
331   Standard,
332   ThisAdjustor,
333   Vcall,
334   Pcode,
335   UnknownLoad,
336   TrampIncremental,
337   BranchIsland
338 };
339
340 /// These values correspond to the UdtKind enumeration, and are documented
341 /// here: https://msdn.microsoft.com/en-us/library/wcstk66t.aspx
342 enum class PDB_UdtType { Struct, Class, Union, Interface };
343
344 /// These values correspond to the StackFrameTypeEnum enumeration, and are
345 /// documented here: https://msdn.microsoft.com/en-us/library/bc5207xw.aspx.
346 enum class PDB_StackFrameType { FPO, KernelTrap, KernelTSS, EBP, FrameData };
347
348 /// These values correspond to the StackFrameTypeEnum enumeration, and are
349 /// documented here: https://msdn.microsoft.com/en-us/library/bc5207xw.aspx.
350 enum class PDB_MemoryType { Code, Data, Stack, HeapCode };
351
352 /// These values correspond to the Basictype enumeration, and are documented
353 /// here: https://msdn.microsoft.com/en-us/library/4szdtzc3.aspx
354 enum class PDB_BuiltinType {
355   None = 0,
356   Void = 1,
357   Char = 2,
358   WCharT = 3,
359   Int = 6,
360   UInt = 7,
361   Float = 8,
362   BCD = 9,
363   Bool = 10,
364   Long = 13,
365   ULong = 14,
366   Currency = 25,
367   Date = 26,
368   Variant = 27,
369   Complex = 28,
370   Bitfield = 29,
371   BSTR = 30,
372   HResult = 31
373 };
374
375 enum class PDB_RegisterId {
376   Unknown = 0,
377   VFrame = 30006,
378   AL = 1,
379   CL = 2,
380   DL = 3,
381   BL = 4,
382   AH = 5,
383   CH = 6,
384   DH = 7,
385   BH = 8,
386   AX = 9,
387   CX = 10,
388   DX = 11,
389   BX = 12,
390   SP = 13,
391   BP = 14,
392   SI = 15,
393   DI = 16,
394   EAX = 17,
395   ECX = 18,
396   EDX = 19,
397   EBX = 20,
398   ESP = 21,
399   EBP = 22,
400   ESI = 23,
401   EDI = 24,
402   ES = 25,
403   CS = 26,
404   SS = 27,
405   DS = 28,
406   FS = 29,
407   GS = 30,
408   IP = 31,
409   RAX = 328,
410   RBX = 329,
411   RCX = 330,
412   RDX = 331,
413   RSI = 332,
414   RDI = 333,
415   RBP = 334,
416   RSP = 335,
417   R8 = 336,
418   R9 = 337,
419   R10 = 338,
420   R11 = 339,
421   R12 = 340,
422   R13 = 341,
423   R14 = 342,
424   R15 = 343,
425 };
426
427 enum class PDB_MemberAccess { Private = 1, Protected = 2, Public = 3 };
428
429 struct VersionInfo {
430   uint32_t Major;
431   uint32_t Minor;
432   uint32_t Build;
433   uint32_t QFE;
434 };
435
436 enum PDB_VariantType {
437   Empty,
438   Unknown,
439   Int8,
440   Int16,
441   Int32,
442   Int64,
443   Single,
444   Double,
445   UInt8,
446   UInt16,
447   UInt32,
448   UInt64,
449   Bool,
450 };
451
452 struct Variant {
453   Variant()
454     : Type(PDB_VariantType::Empty) {
455   }
456
457   PDB_VariantType Type;
458   union {
459     bool Bool;
460     int8_t Int8;
461     int16_t Int16;
462     int32_t Int32;
463     int64_t Int64;
464     float Single;
465     double Double;
466     uint8_t UInt8;
467     uint16_t UInt16;
468     uint32_t UInt32;
469     uint64_t UInt64;
470     void* Pointer;
471   };
472 };
473
474 } // namespace llvm
475
476 namespace std {
477 template <> struct hash<llvm::PDB_SymType> {
478   typedef llvm::PDB_SymType argument_type;
479   typedef std::size_t result_type;
480
481   result_type operator()(const argument_type &Arg) const {
482     return std::hash<int>()(static_cast<int>(Arg));
483   }
484 };
485 }
486
487 #endif