LLVM  7.0.0svn
PDBTypes.h
Go to the documentation of this file.
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 
16 #include <cctype>
17 #include <cstddef>
18 #include <cstdint>
19 #include <cstring>
20 #include <functional>
21 
22 namespace llvm {
23 namespace pdb {
24 
25 class IPDBDataStream;
26 class IPDBInjectedSource;
27 class IPDBLineNumber;
28 class IPDBSectionContrib;
29 class IPDBSourceFile;
30 class IPDBTable;
31 class PDBSymDumper;
32 class PDBSymbol;
33 class PDBSymbolExe;
34 class PDBSymbolCompiland;
35 class PDBSymbolCompilandDetails;
36 class PDBSymbolCompilandEnv;
37 class PDBSymbolFunc;
38 class PDBSymbolBlock;
39 class PDBSymbolData;
40 class PDBSymbolAnnotation;
41 class PDBSymbolLabel;
42 class PDBSymbolPublicSymbol;
43 class PDBSymbolTypeUDT;
44 class PDBSymbolTypeEnum;
45 class PDBSymbolTypeFunctionSig;
46 class PDBSymbolTypePointer;
47 class PDBSymbolTypeArray;
48 class PDBSymbolTypeBuiltin;
49 class PDBSymbolTypeTypedef;
50 class PDBSymbolTypeBaseClass;
51 class PDBSymbolTypeFriend;
52 class PDBSymbolTypeFunctionArg;
53 class PDBSymbolFuncDebugStart;
54 class PDBSymbolFuncDebugEnd;
55 class PDBSymbolUsingNamespace;
56 class PDBSymbolTypeVTableShape;
57 class PDBSymbolTypeVTable;
58 class PDBSymbolCustom;
59 class PDBSymbolThunk;
60 class PDBSymbolTypeCustom;
61 class PDBSymbolTypeManaged;
62 class PDBSymbolTypeDimension;
63 class PDBSymbolUnknown;
64 
72 
73 /// Specifies which PDB reader implementation is to be used. Only a value
74 /// of PDB_ReaderType::DIA is currently supported, but Native is in the works.
75 enum class PDB_ReaderType {
76  DIA = 0,
77  Native = 1,
78 };
79 
80 /// An enumeration indicating the type of data contained in this table.
81 enum class PDB_TableType {
82  TableInvalid = 0,
83  Symbols,
87  Segments,
89  FrameData,
91  Dbg
92 };
93 
94 /// Defines flags used for enumerating child symbols. This corresponds to the
95 /// NameSearchOptions enumeration which is documented here:
96 /// https://msdn.microsoft.com/en-us/library/yat28ads.aspx
98  NS_Default = 0x0,
102  NS_Regex = 0x8,
104 
105  // For backward compatibility.
109 };
110 
111 /// Specifies the hash algorithm that a source file from a PDB was hashed with.
112 /// This corresponds to the CV_SourceChksum_t enumeration and are documented
113 /// here: https://msdn.microsoft.com/en-us/library/e96az21x.aspx
114 enum class PDB_Checksum { None = 0, MD5 = 1, SHA1 = 2, SHA256 = 3 };
115 
116 /// These values correspond to the CV_CPU_TYPE_e enumeration, and are documented
117 /// here: https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
119 
120 enum class PDB_Machine {
121  Invalid = 0xffff,
122  Unknown = 0x0,
123  Am33 = 0x13,
124  Amd64 = 0x8664,
125  Arm = 0x1C0,
126  ArmNT = 0x1C4,
127  Ebc = 0xEBC,
128  x86 = 0x14C,
129  Ia64 = 0x200,
130  M32R = 0x9041,
131  Mips16 = 0x266,
132  MipsFpu = 0x366,
133  MipsFpu16 = 0x466,
134  PowerPC = 0x1F0,
135  PowerPCFP = 0x1F1,
136  R4000 = 0x166,
137  SH3 = 0x1A2,
138  SH3DSP = 0x1A3,
139  SH4 = 0x1A6,
140  SH5 = 0x1A8,
141  Thumb = 0x1C2,
142  WceMipsV2 = 0x169
143 };
144 
146  None,
148  Huffman,
149  LZ,
150 };
151 
152 /// These values correspond to the CV_call_e enumeration, and are documented
153 /// at the following locations:
154 /// https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
155 /// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680207(v=vs.85).aspx
157 
158 /// These values correspond to the CV_CFL_LANG enumeration, and are documented
159 /// here: https://msdn.microsoft.com/en-us/library/bw3aekw6.aspx
161 
162 /// These values correspond to the DataKind enumeration, and are documented
163 /// here: https://msdn.microsoft.com/en-us/library/b2x2t313.aspx
164 enum class PDB_DataKind {
165  Unknown,
166  Local,
167  StaticLocal,
168  Param,
169  ObjectPtr,
170  FileStatic,
171  Global,
172  Member,
173  StaticMember,
174  Constant
175 };
176 
177 /// These values correspond to the SymTagEnum enumeration, and are documented
178 /// here: https://msdn.microsoft.com/en-us/library/bkedss5f.aspx
179 enum class PDB_SymType {
180  None,
181  Exe,
182  Compiland,
184  CompilandEnv,
185  Function,
186  Block,
187  Data,
188  Annotation,
189  Label,
190  PublicSymbol,
191  UDT,
192  Enum,
193  FunctionSig,
194  PointerType,
195  ArrayType,
196  BuiltinType,
197  Typedef,
198  BaseClass,
199  Friend,
200  FunctionArg,
202  FuncDebugEnd,
204  VTableShape,
205  VTable,
206  Custom,
207  Thunk,
208  CustomType,
209  ManagedType,
210  Dimension,
211  Max
212 };
213 
214 /// These values correspond to the LocationType enumeration, and are documented
215 /// here: https://msdn.microsoft.com/en-us/library/f57kaez3.aspx
216 enum class PDB_LocType {
217  Null,
218  Static,
219  TLS,
220  RegRel,
221  ThisRel,
222  Enregistered,
223  BitField,
224  Slot,
225  IlRel,
226  MetaData,
227  Constant,
229  Max
230 };
231 
232 /// These values correspond to the UdtKind enumeration, and are documented
233 /// here: https://msdn.microsoft.com/en-us/library/wcstk66t.aspx
235 
236 /// These values correspond to the StackFrameTypeEnum enumeration, and are
237 /// documented here: https://msdn.microsoft.com/en-us/library/bc5207xw.aspx.
238 enum class PDB_StackFrameType : uint16_t {
239  FPO,
240  KernelTrap,
241  KernelTSS,
242  EBP,
243  FrameData,
244  Unknown = 0xffff
245 };
246 
247 /// These values correspond to the MemoryTypeEnum enumeration, and are
248 /// documented here: https://msdn.microsoft.com/en-us/library/ms165609.aspx.
249 enum class PDB_MemoryType : uint16_t {
250  Code,
251  Data,
252  Stack,
253  HeapCode,
254  Any = 0xffff
255 };
256 
257 /// These values correspond to the Basictype enumeration, and are documented
258 /// here: https://msdn.microsoft.com/en-us/library/4szdtzc3.aspx
259 enum class PDB_BuiltinType {
260  None = 0,
261  Void = 1,
262  Char = 2,
263  WCharT = 3,
264  Int = 6,
265  UInt = 7,
266  Float = 8,
267  BCD = 9,
268  Bool = 10,
269  Long = 13,
270  ULong = 14,
271  Currency = 25,
272  Date = 26,
273  Variant = 27,
274  Complex = 28,
275  Bitfield = 29,
276  BSTR = 30,
277  HResult = 31,
278  Char16 = 32,
279  Char32 = 33
280 };
281 
282 /// These values correspond to the flags that can be combined to control the
283 /// return of an undecorated name for a C++ decorated name, and are documented
284 /// here: https://msdn.microsoft.com/en-us/library/kszfk0fs.aspx
303  Undname_NoECSU = 0x8000,
305  Undname_NoPTR64 = 0x20000
306 };
307 
308 enum class PDB_MemberAccess { Private = 1, Protected = 2, Public = 3 };
309 
310 struct VersionInfo {
315 };
316 
332 };
333 
334 struct Variant {
335  Variant() = default;
336 
337  Variant(const Variant &Other) {
338  *this = Other;
339  }
340 
343  delete[] Value.String;
344  }
345 
347  union {
348  bool Bool;
349  int8_t Int8;
350  int16_t Int16;
351  int32_t Int32;
352  int64_t Int64;
353  float Single;
354  double Double;
355  uint8_t UInt8;
356  uint16_t UInt16;
358  uint64_t UInt64;
359  char *String;
360  } Value;
361 
362 #define VARIANT_EQUAL_CASE(Enum) \
363  case PDB_VariantType::Enum: \
364  return Value.Enum == Other.Value.Enum;
365 
366  bool operator==(const Variant &Other) const {
367  if (Type != Other.Type)
368  return false;
369  switch (Type) {
382  default:
383  return true;
384  }
385  }
386 
387 #undef VARIANT_EQUAL_CASE
388 
389  bool operator!=(const Variant &Other) const { return !(*this == Other); }
390  Variant &operator=(const Variant &Other) {
391  if (this == &Other)
392  return *this;
393  if (Type == PDB_VariantType::String)
394  delete[] Value.String;
395  Type = Other.Type;
396  Value = Other.Value;
397  if (Other.Type == PDB_VariantType::String &&
398  Other.Value.String != nullptr) {
399  Value.String = new char[strlen(Other.Value.String) + 1];
400  ::strcpy(Value.String, Other.Value.String);
401  }
402  return *this;
403  }
404 };
405 
406 } // end namespace pdb
407 } // end namespace llvm
408 
409 namespace std {
410 
411 template <> struct hash<llvm::pdb::PDB_SymType> {
413  using result_type = std::size_t;
414 
416  return std::hash<int>()(static_cast<int>(Arg));
417  }
418 };
419 
420 } // end namespace std
421 
422 #endif // LLVM_DEBUGINFO_PDB_PDBTYPES_H
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
PDB_UdtType
These values correspond to the UdtKind enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/wcstk66t.aspx.
Definition: PDBTypes.h:234
result_type operator()(const argument_type &Arg) const
Definition: PDBTypes.h:415
PDB_NameSearchFlags
Defines flags used for enumerating child symbols.
Definition: PDBTypes.h:97
PDB_ReaderType
Specifies which PDB reader implementation is to be used.
Definition: PDBTypes.h:75
A class that wrap the SHA1 algorithm.
Definition: SHA1.h:29
bool operator!=(const Variant &Other) const
Definition: PDBTypes.h:389
PDB_Checksum
Specifies the hash algorithm that a source file from a PDB was hashed with.
Definition: PDBTypes.h:114
union llvm::pdb::Variant::@192 Value
Definition: BitVector.h:921
PDB_UndnameFlags
These values correspond to the flags that can be combined to control the return of an undecorated nam...
Definition: PDBTypes.h:285
PDB_SymType
These values correspond to the SymTagEnum enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/bkedss5f.aspx.
Definition: PDBTypes.h:179
uint32_t UInt32
Definition: PDBTypes.h:357
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
This is an important base class in LLVM.
Definition: Constant.h:42
PDB_DataKind
These values correspond to the DataKind enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/b2x2t313.aspx.
Definition: PDBTypes.h:164
#define VARIANT_EQUAL_CASE(Enum)
Definition: PDBTypes.h:362
PDB_SourceCompression
Definition: PDBTypes.h:145
PDB_LocType
These values correspond to the LocationType enumeration, and are documented here: https://msdn...
Definition: PDBTypes.h:216
uint64_t UInt64
Definition: PDBTypes.h:358
SourceLanguage
These values correspond to the CV_CFL_LANG enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/bw3aekw6.aspx.
Definition: CodeView.h:144
Variant(const Variant &Other)
Definition: PDBTypes.h:337
CPUType
These values correspond to the CV_CPU_TYPE_e enumeration, and are documented here: https://msdn...
Definition: CodeView.h:79
PDB_TableType
An enumeration indicating the type of data contained in this table.
Definition: PDBTypes.h:81
PDB_MemoryType
These values correspond to the MemoryTypeEnum enumeration, and are documented here: https://msdn...
Definition: PDBTypes.h:249
PDB_VariantType
Definition: PDBTypes.h:317
amdgpu Simplify well known AMD library false Value Value * Arg
uint16_t UInt16
Definition: PDBTypes.h:356
Definition: MD5.h:41
PDB_StackFrameType
These values correspond to the StackFrameTypeEnum enumeration, and are documented here: https://msdn...
Definition: PDBTypes.h:238
PDB_BuiltinType
These values correspond to the Basictype enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/4szdtzc3.aspx.
Definition: PDBTypes.h:259
LLVM Value Representation.
Definition: Value.h:73
CallingConvention
These values correspond to the CV_call_e enumeration, and are documented at the following locations: ...
Definition: CodeView.h:173
Variant & operator=(const Variant &Other)
Definition: PDBTypes.h:390
bool operator==(const Variant &Other) const
Definition: PDBTypes.h:366
PDB_VariantType Type
Definition: PDBTypes.h:346
PDB_MemberAccess
Definition: PDBTypes.h:308