LLVM  8.0.1
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 
17 #include <cctype>
18 #include <cstddef>
19 #include <cstdint>
20 #include <cstring>
21 #include <functional>
22 
23 namespace llvm {
24 namespace pdb {
25 
27 
28 class IPDBDataStream;
29 class IPDBInjectedSource;
30 class IPDBLineNumber;
31 class IPDBSectionContrib;
32 class IPDBSourceFile;
33 class IPDBTable;
34 class PDBSymDumper;
35 class PDBSymbol;
36 class PDBSymbolExe;
37 class PDBSymbolCompiland;
40 class PDBSymbolFunc;
41 class PDBSymbolBlock;
42 class PDBSymbolData;
44 class PDBSymbolLabel;
46 class PDBSymbolTypeUDT;
47 class PDBSymbolTypeEnum;
50 class PDBSymbolTypeArray;
61 class PDBSymbolCustom;
62 class PDBSymbolThunk;
66 class PDBSymbolUnknown;
67 
76 
77 /// Specifies which PDB reader implementation is to be used. Only a value
78 /// of PDB_ReaderType::DIA is currently supported, but Native is in the works.
79 enum class PDB_ReaderType {
80  DIA = 0,
81  Native = 1,
82 };
83 
84 /// An enumeration indicating the type of data contained in this table.
85 enum class PDB_TableType {
86  TableInvalid = 0,
87  Symbols,
91  Segments,
93  FrameData,
95  Dbg
96 };
97 
98 /// Defines flags used for enumerating child symbols. This corresponds to the
99 /// NameSearchOptions enumeration which is documented here:
100 /// https://msdn.microsoft.com/en-us/library/yat28ads.aspx
102  NS_Default = 0x0,
106  NS_Regex = 0x8,
108 
109  // For backward compatibility.
113 };
114 
115 /// Specifies the hash algorithm that a source file from a PDB was hashed with.
116 /// This corresponds to the CV_SourceChksum_t enumeration and are documented
117 /// here: https://msdn.microsoft.com/en-us/library/e96az21x.aspx
118 enum class PDB_Checksum { None = 0, MD5 = 1, SHA1 = 2, SHA256 = 3 };
119 
120 /// These values correspond to the CV_CPU_TYPE_e enumeration, and are documented
121 /// here: https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
123 
124 enum class PDB_Machine {
125  Invalid = 0xffff,
126  Unknown = 0x0,
127  Am33 = 0x13,
128  Amd64 = 0x8664,
129  Arm = 0x1C0,
130  ArmNT = 0x1C4,
131  Ebc = 0xEBC,
132  x86 = 0x14C,
133  Ia64 = 0x200,
134  M32R = 0x9041,
135  Mips16 = 0x266,
136  MipsFpu = 0x366,
137  MipsFpu16 = 0x466,
138  PowerPC = 0x1F0,
139  PowerPCFP = 0x1F1,
140  R4000 = 0x166,
141  SH3 = 0x1A2,
142  SH3DSP = 0x1A3,
143  SH4 = 0x1A6,
144  SH5 = 0x1A8,
145  Thumb = 0x1C2,
146  WceMipsV2 = 0x169
147 };
148 
150  None,
152  Huffman,
153  LZ,
154 };
155 
156 /// These values correspond to the CV_call_e enumeration, and are documented
157 /// at the following locations:
158 /// https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
159 /// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680207(v=vs.85).aspx
161 
162 /// These values correspond to the CV_CFL_LANG enumeration, and are documented
163 /// here: https://msdn.microsoft.com/en-us/library/bw3aekw6.aspx
165 
166 /// These values correspond to the DataKind enumeration, and are documented
167 /// here: https://msdn.microsoft.com/en-us/library/b2x2t313.aspx
168 enum class PDB_DataKind {
169  Unknown,
170  Local,
171  StaticLocal,
172  Param,
173  ObjectPtr,
174  FileStatic,
175  Global,
176  Member,
177  StaticMember,
178  Constant
179 };
180 
181 /// These values correspond to the SymTagEnum enumeration, and are documented
182 /// here: https://msdn.microsoft.com/en-us/library/bkedss5f.aspx
183 enum class PDB_SymType {
184  None,
185  Exe,
186  Compiland,
188  CompilandEnv,
189  Function,
190  Block,
191  Data,
192  Annotation,
193  Label,
194  PublicSymbol,
195  UDT,
196  Enum,
197  FunctionSig,
198  PointerType,
199  ArrayType,
200  BuiltinType,
201  Typedef,
202  BaseClass,
203  Friend,
204  FunctionArg,
206  FuncDebugEnd,
208  VTableShape,
209  VTable,
210  Custom,
211  Thunk,
212  CustomType,
213  ManagedType,
214  Dimension,
215  CallSite,
216  InlineSite,
218  VectorType,
219  MatrixType,
220  HLSLType,
221  Caller,
222  Callee,
223  Export,
225  CoffGroup,
226  Inlinee,
227  Max
228 };
229 
230 /// These values correspond to the LocationType enumeration, and are documented
231 /// here: https://msdn.microsoft.com/en-us/library/f57kaez3.aspx
232 enum class PDB_LocType {
233  Null,
234  Static,
235  TLS,
236  RegRel,
237  ThisRel,
238  Enregistered,
239  BitField,
240  Slot,
241  IlRel,
242  MetaData,
243  Constant,
245  Max
246 };
247 
248 /// These values correspond to the UdtKind enumeration, and are documented
249 /// here: https://msdn.microsoft.com/en-us/library/wcstk66t.aspx
251 
252 /// These values correspond to the StackFrameTypeEnum enumeration, and are
253 /// documented here: https://msdn.microsoft.com/en-us/library/bc5207xw.aspx.
254 enum class PDB_StackFrameType : uint16_t {
255  FPO,
256  KernelTrap,
257  KernelTSS,
258  EBP,
259  FrameData,
260  Unknown = 0xffff
261 };
262 
263 /// These values correspond to the MemoryTypeEnum enumeration, and are
264 /// documented here: https://msdn.microsoft.com/en-us/library/ms165609.aspx.
265 enum class PDB_MemoryType : uint16_t {
266  Code,
267  Data,
268  Stack,
269  HeapCode,
270  Any = 0xffff
271 };
272 
273 /// These values correspond to the Basictype enumeration, and are documented
274 /// here: https://msdn.microsoft.com/en-us/library/4szdtzc3.aspx
275 enum class PDB_BuiltinType {
276  None = 0,
277  Void = 1,
278  Char = 2,
279  WCharT = 3,
280  Int = 6,
281  UInt = 7,
282  Float = 8,
283  BCD = 9,
284  Bool = 10,
285  Long = 13,
286  ULong = 14,
287  Currency = 25,
288  Date = 26,
289  Variant = 27,
290  Complex = 28,
291  Bitfield = 29,
292  BSTR = 30,
293  HResult = 31,
294  Char16 = 32,
295  Char32 = 33
296 };
297 
298 /// These values correspond to the flags that can be combined to control the
299 /// return of an undecorated name for a C++ decorated name, and are documented
300 /// here: https://msdn.microsoft.com/en-us/library/kszfk0fs.aspx
319  Undname_NoECSU = 0x8000,
321  Undname_NoPTR64 = 0x20000
322 };
323 
324 enum class PDB_MemberAccess { Private = 1, Protected = 2, Public = 3 };
325 
326 struct VersionInfo {
331 };
332 
348 };
349 
350 struct Variant {
351  Variant() = default;
352 
353  explicit Variant(bool V) : Type(PDB_VariantType::Bool) { Value.Bool = V; }
354  explicit Variant(int8_t V) : Type(PDB_VariantType::Int8) { Value.Int8 = V; }
355  explicit Variant(int16_t V) : Type(PDB_VariantType::Int16) {
356  Value.Int16 = V;
357  }
358  explicit Variant(int32_t V) : Type(PDB_VariantType::Int32) {
359  Value.Int32 = V;
360  }
361  explicit Variant(int64_t V) : Type(PDB_VariantType::Int64) {
362  Value.Int64 = V;
363  }
364  explicit Variant(float V) : Type(PDB_VariantType::Single) {
365  Value.Single = V;
366  }
367  explicit Variant(double V) : Type(PDB_VariantType::Double) {
368  Value.Double = V;
369  }
370  explicit Variant(uint8_t V) : Type(PDB_VariantType::UInt8) {
371  Value.UInt8 = V;
372  }
373  explicit Variant(uint16_t V) : Type(PDB_VariantType::UInt16) {
374  Value.UInt16 = V;
375  }
377  Value.UInt32 = V;
378  }
379  explicit Variant(uint64_t V) : Type(PDB_VariantType::UInt64) {
380  Value.UInt64 = V;
381  }
382 
383  Variant(const Variant &Other) {
384  *this = Other;
385  }
386 
389  delete[] Value.String;
390  }
391 
393  union {
394  bool Bool;
395  int8_t Int8;
396  int16_t Int16;
397  int32_t Int32;
398  int64_t Int64;
399  float Single;
400  double Double;
401  uint8_t UInt8;
402  uint16_t UInt16;
404  uint64_t UInt64;
405  char *String;
406  } Value;
407 
408 #define VARIANT_EQUAL_CASE(Enum) \
409  case PDB_VariantType::Enum: \
410  return Value.Enum == Other.Value.Enum;
411 
412  bool operator==(const Variant &Other) const {
413  if (Type != Other.Type)
414  return false;
415  switch (Type) {
428  default:
429  return true;
430  }
431  }
432 
433 #undef VARIANT_EQUAL_CASE
434 
435  bool operator!=(const Variant &Other) const { return !(*this == Other); }
436  Variant &operator=(const Variant &Other) {
437  if (this == &Other)
438  return *this;
439  if (Type == PDB_VariantType::String)
440  delete[] Value.String;
441  Type = Other.Type;
442  Value = Other.Value;
443  if (Other.Type == PDB_VariantType::String &&
444  Other.Value.String != nullptr) {
445  Value.String = new char[strlen(Other.Value.String) + 1];
446  ::strcpy(Value.String, Other.Value.String);
447  }
448  return *this;
449  }
450 };
451 
452 } // end namespace pdb
453 } // end namespace llvm
454 
455 namespace std {
456 
457 template <> struct hash<llvm::pdb::PDB_SymType> {
459  using result_type = std::size_t;
460 
462  return std::hash<int>()(static_cast<int>(Arg));
463  }
464 };
465 
466 } // end namespace std
467 
468 #endif // LLVM_DEBUGINFO_PDB_PDBTYPES_H
Variant(double V)
Definition: PDBTypes.h:367
Definition: Any.h:27
Variant(uint16_t V)
Definition: PDBTypes.h:373
This class represents lattice values for constants.
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:250
PDBSymbolCustom represents symbols that are compiler-specific and do not fit anywhere else in the lex...
result_type operator()(const argument_type &Arg) const
Definition: PDBTypes.h:461
Variant(int8_t V)
Definition: PDBTypes.h:354
PDB_NameSearchFlags
Defines flags used for enumerating child symbols.
Definition: PDBTypes.h:101
PDB_ReaderType
Specifies which PDB reader implementation is to be used.
Definition: PDBTypes.h:79
A class that wrap the SHA1 algorithm.
Definition: SHA1.h:29
bool operator!=(const Variant &Other) const
Definition: PDBTypes.h:435
PDB_Checksum
Specifies the hash algorithm that a source file from a PDB was hashed with.
Definition: PDBTypes.h:118
IPDBSourceFile defines an interface used to represent source files whose information are stored in th...
Variant(uint64_t V)
Definition: PDBTypes.h:379
Definition: BitVector.h:938
IPDBInjectedSource defines an interface used to represent source files which were injected directly i...
IPDBSectionContrib defines an interface used to represent section contributions whose information are...
PDB_UndnameFlags
These values correspond to the flags that can be combined to control the return of an undecorated nam...
Definition: PDBTypes.h:301
Variant(uint8_t V)
Definition: PDBTypes.h:370
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:183
uint32_t UInt32
Definition: PDBTypes.h:403
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
Variant(int32_t V)
Definition: PDBTypes.h:358
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:168
#define VARIANT_EQUAL_CASE(Enum)
Definition: PDBTypes.h:408
Variant(uint32_t V)
Definition: PDBTypes.h:376
PDB_SourceCompression
Definition: PDBTypes.h:149
PDB_LocType
These values correspond to the LocationType enumeration, and are documented here: https://msdn...
Definition: PDBTypes.h:232
uint64_t UInt64
Definition: PDBTypes.h:404
IPDBDataStream defines an interface used to represent a stream consisting of a name and a series of r...
Variant(int64_t V)
Definition: PDBTypes.h:361
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:383
union llvm::pdb::Variant::@215 Value
CPUType
These values correspond to the CV_CPU_TYPE_e enumeration, and are documented here: https://msdn...
Definition: CodeView.h:79
PDBSymbol defines the base of the inheritance hierarchy for concrete symbol types (e...
Definition: PDBSymbol.h:74
PDB_TableType
An enumeration indicating the type of data contained in this table.
Definition: PDBTypes.h:85
PDB_MemoryType
These values correspond to the MemoryTypeEnum enumeration, and are documented here: https://msdn...
Definition: PDBTypes.h:265
PDB_VariantType
Definition: PDBTypes.h:333
amdgpu Simplify well known AMD library false Value Value * Arg
uint32_t SymIndexId
Definition: PDBTypes.h:26
uint16_t UInt16
Definition: PDBTypes.h:402
Definition: MD5.h:41
PDB_StackFrameType
These values correspond to the StackFrameTypeEnum enumeration, and are documented here: https://msdn...
Definition: PDBTypes.h:254
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:275
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:436
bool operator==(const Variant &Other) const
Definition: PDBTypes.h:412
Variant(int16_t V)
Definition: PDBTypes.h:355
PDB_VariantType Type
Definition: PDBTypes.h:392
Variant(float V)
Definition: PDBTypes.h:364
PDB_MemberAccess
Definition: PDBTypes.h:324