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