LLVM  4.0.0
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 
13 #include "llvm/Config/llvm-config.h"
16 #include <cstdint>
17 #include <cstring>
18 #include <functional>
19 
20 namespace llvm {
21 namespace pdb {
22 
23 class PDBSymDumper;
24 class PDBSymbol;
25 
26 class IPDBDataStream;
27 template <class T> class IPDBEnumChildren;
28 class IPDBLineNumber;
29 class IPDBRawSymbol;
30 class IPDBSession;
32 
37 
38 class PDBSymbolExe;
39 class PDBSymbolCompiland;
42 class PDBSymbolFunc;
43 class PDBSymbolBlock;
44 class PDBSymbolData;
46 class PDBSymbolLabel;
48 class PDBSymbolTypeUDT;
49 class PDBSymbolTypeEnum;
52 class PDBSymbolTypeArray;
63 class PDBSymbolCustom;
64 class PDBSymbolThunk;
68 class PDBSymbolUnknown;
69 
70 /// Specifies which PDB reader implementation is to be used. Only a value
71 /// of PDB_ReaderType::DIA is supported.
72 enum class PDB_ReaderType {
73  DIA = 0,
74  Raw = 1,
75 };
76 
77 /// An enumeration indicating the type of data contained in this table.
78 enum class PDB_TableType {
79  Symbols,
83  Segments,
85  FrameData
86 };
87 
88 /// Defines flags used for enumerating child symbols. This corresponds to the
89 /// NameSearchOptions enumeration which is documented here:
90 /// https://msdn.microsoft.com/en-us/library/yat28ads.aspx
92  NS_Default = 0x0,
96  NS_Regex = 0x8,
98 };
99 
100 /// Specifies the hash algorithm that a source file from a PDB was hashed with.
101 /// This corresponds to the CV_SourceChksum_t enumeration and are documented
102 /// here: https://msdn.microsoft.com/en-us/library/e96az21x.aspx
103 enum class PDB_Checksum { None = 0, MD5 = 1, SHA1 = 2 };
104 
105 /// These values correspond to the CV_CPU_TYPE_e enumeration, and are documented
106 /// here: https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
108 
109 enum class PDB_Machine {
110  Invalid = 0xffff,
111  Unknown = 0x0,
112  Am33 = 0x13,
113  Amd64 = 0x8664,
114  Arm = 0x1C0,
115  ArmNT = 0x1C4,
116  Ebc = 0xEBC,
117  x86 = 0x14C,
118  Ia64 = 0x200,
119  M32R = 0x9041,
120  Mips16 = 0x266,
121  MipsFpu = 0x366,
122  MipsFpu16 = 0x466,
123  PowerPC = 0x1F0,
124  PowerPCFP = 0x1F1,
125  R4000 = 0x166,
126  SH3 = 0x1A2,
127  SH3DSP = 0x1A3,
128  SH4 = 0x1A6,
129  SH5 = 0x1A8,
130  Thumb = 0x1C2,
131  WceMipsV2 = 0x169
132 };
133 
134 /// These values correspond to the CV_call_e enumeration, and are documented
135 /// at the following locations:
136 /// https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
137 /// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680207(v=vs.85).aspx
138 ///
140 
141 /// These values correspond to the CV_CFL_LANG enumeration, and are documented
142 /// here: https://msdn.microsoft.com/en-us/library/bw3aekw6.aspx
144 
145 /// These values correspond to the DataKind enumeration, and are documented
146 /// here: https://msdn.microsoft.com/en-us/library/b2x2t313.aspx
147 enum class PDB_DataKind {
148  Unknown,
149  Local,
150  StaticLocal,
151  Param,
152  ObjectPtr,
153  FileStatic,
154  Global,
155  Member,
156  StaticMember,
157  Constant
158 };
159 
160 /// These values correspond to the SymTagEnum enumeration, and are documented
161 /// here: https://msdn.microsoft.com/en-us/library/bkedss5f.aspx
162 enum class PDB_SymType {
163  None,
164  Exe,
165  Compiland,
167  CompilandEnv,
168  Function,
169  Block,
170  Data,
171  Annotation,
172  Label,
173  PublicSymbol,
174  UDT,
175  Enum,
176  FunctionSig,
177  PointerType,
178  ArrayType,
179  BuiltinType,
180  Typedef,
181  BaseClass,
182  Friend,
183  FunctionArg,
185  FuncDebugEnd,
187  VTableShape,
188  VTable,
189  Custom,
190  Thunk,
191  CustomType,
192  ManagedType,
193  Dimension,
194  Max
195 };
196 
197 /// These values correspond to the LocationType enumeration, and are documented
198 /// here: https://msdn.microsoft.com/en-us/library/f57kaez3.aspx
199 enum class PDB_LocType {
200  Null,
201  Static,
202  TLS,
203  RegRel,
204  ThisRel,
205  Enregistered,
206  BitField,
207  Slot,
208  IlRel,
209  MetaData,
210  Constant,
211  Max
212 };
213 
214 /// These values correspond to the UdtKind enumeration, and are documented
215 /// here: https://msdn.microsoft.com/en-us/library/wcstk66t.aspx
217 
218 /// These values correspond to the StackFrameTypeEnum enumeration, and are
219 /// documented here: https://msdn.microsoft.com/en-us/library/bc5207xw.aspx.
221 
222 /// These values correspond to the StackFrameTypeEnum enumeration, and are
223 /// documented here: https://msdn.microsoft.com/en-us/library/bc5207xw.aspx.
225 
226 /// These values correspond to the Basictype enumeration, and are documented
227 /// here: https://msdn.microsoft.com/en-us/library/4szdtzc3.aspx
228 enum class PDB_BuiltinType {
229  None = 0,
230  Void = 1,
231  Char = 2,
232  WCharT = 3,
233  Int = 6,
234  UInt = 7,
235  Float = 8,
236  BCD = 9,
237  Bool = 10,
238  Long = 13,
239  ULong = 14,
240  Currency = 25,
241  Date = 26,
242  Variant = 27,
243  Complex = 28,
244  Bitfield = 29,
245  BSTR = 30,
246  HResult = 31
247 };
248 
249 enum class PDB_MemberAccess { Private = 1, Protected = 2, Public = 3 };
250 
251 struct VersionInfo {
256 };
257 
273 };
274 
275 struct Variant {
277 
279  *this = Other;
280  }
281 
284  delete[] Value.String;
285  }
286 
288  union {
289  bool Bool;
290  int8_t Int8;
291  int16_t Int16;
292  int32_t Int32;
293  int64_t Int64;
294  float Single;
295  double Double;
296  uint8_t UInt8;
297  uint16_t UInt16;
299  uint64_t UInt64;
300  char *String;
301  } Value;
302 
303 #define VARIANT_EQUAL_CASE(Enum) \
304  case PDB_VariantType::Enum: \
305  return Value.Enum == Other.Value.Enum;
306 
307  bool operator==(const Variant &Other) const {
308  if (Type != Other.Type)
309  return false;
310  switch (Type) {
323  default:
324  return true;
325  }
326  }
327 
328 #undef VARIANT_EQUAL_CASE
329 
330  bool operator!=(const Variant &Other) const { return !(*this == Other); }
331  Variant &operator=(const Variant &Other) {
332  if (this == &Other)
333  return *this;
335  delete[] Value.String;
336  Type = Other.Type;
337  Value = Other.Value;
338  if (Other.Type == PDB_VariantType::String &&
339  Other.Value.String != nullptr) {
340  Value.String = new char[strlen(Other.Value.String) + 1];
341  ::strcpy(Value.String, Other.Value.String);
342  }
343  return *this;
344  }
345 };
346 
347 } // end namespace llvm
348 }
349 
350 namespace std {
351 template <> struct hash<llvm::pdb::PDB_SymType> {
353  typedef std::size_t result_type;
354 
356  return std::hash<int>()(static_cast<int>(Arg));
357  }
358 };
359 } // end namespace std
360 
361 #endif // LLVM_DEBUGINFO_PDB_PDBTYPES_H
llvm::pdb::PDB_SymType argument_type
Definition: PDBTypes.h:352
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:216
PDBSymbolCustom represents symbols that are compiler-specific and do not fit anywhere else in the lex...
PDB_NameSearchFlags
Defines flags used for enumerating child symbols.
Definition: PDBTypes.h:91
PDB_ReaderType
Specifies which PDB reader implementation is to be used.
Definition: PDBTypes.h:72
A class that wrap the SHA1 algorithm.
Definition: SHA1.h:29
PDB_Checksum
Specifies the hash algorithm that a source file from a PDB was hashed with.
Definition: PDBTypes.h:103
PDB_MemoryType
These values correspond to the StackFrameTypeEnum enumeration, and are documented here: https://msdn...
Definition: PDBTypes.h:224
IPDBSourceFile defines an interface used to represent source files whose information are stored in th...
bool operator!=(const Variant &Other) const
Definition: PDBTypes.h:330
codeview::CPUType PDB_Cpu
These values correspond to the CV_CPU_TYPE_e enumeration, and are documented here: https://msdn...
Definition: PDBTypes.h:107
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:162
codeview::SourceLanguage PDB_Lang
These values correspond to the CV_CFL_LANG enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/bw3aekw6.aspx.
Definition: PDBTypes.h:143
uint32_t UInt32
Definition: PDBTypes.h:298
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: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:147
IPDBEnumChildren< IPDBDataStream > IPDBEnumDataStreams
Definition: PDBTypes.h:35
#define VARIANT_EQUAL_CASE(Enum)
Definition: PDBTypes.h:303
IPDBEnumChildren< IPDBLineNumber > IPDBEnumLineNumbers
Definition: PDBTypes.h:36
PDB_LocType
These values correspond to the LocationType enumeration, and are documented here: https://msdn...
Definition: PDBTypes.h:199
uint64_t UInt64
Definition: PDBTypes.h:299
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:137
Variant(const Variant &Other)
Definition: PDBTypes.h:278
CPUType
These values correspond to the CV_CPU_TYPE_e enumeration, and are documented here: https://msdn...
Definition: CodeView.h:73
PDB_TableType
An enumeration indicating the type of data contained in this table.
Definition: PDBTypes.h:78
PDB_VariantType
Definition: PDBTypes.h:258
PDB_StackFrameType
These values correspond to the StackFrameTypeEnum enumeration, and are documented here: https://msdn...
Definition: PDBTypes.h:220
codeview::CallingConvention PDB_CallingConv
These values correspond to the CV_call_e enumeration, and are documented at the following locations: ...
Definition: PDBTypes.h:139
bool operator==(const Variant &Other) const
Definition: PDBTypes.h:307
IPDBEnumChildren< PDBSymbol > IPDBEnumSymbols
Definition: PDBTypes.h:31
uint16_t UInt16
Definition: PDBTypes.h:297
Definition: MD5.h:39
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:228
LLVM Value Representation.
Definition: Value.h:71
IPDBEnumChildren< IPDBSourceFile > IPDBEnumSourceFiles
Definition: PDBTypes.h:34
CallingConvention
These values correspond to the CV_call_e enumeration, and are documented at the following locations: ...
Definition: CodeView.h:162
Variant & operator=(const Variant &Other)
Definition: PDBTypes.h:331
PDB_VariantType Type
Definition: PDBTypes.h:287
result_type operator()(const argument_type &Arg) const
Definition: PDBTypes.h:355
union llvm::pdb::Variant::@75 Value
PDB_MemberAccess
Definition: PDBTypes.h:249