1 //===- PDBTypes.h - Defines enums for various fields contained in PDB ---*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_DEBUGINFO_PDB_PDBTYPES_H
11 #define LLVM_DEBUGINFO_PDB_PDBTYPES_H
13 #include "llvm/Config/llvm-config.h"
14 #include "llvm/Support/Endian.h"
24 template <class T> class IPDBEnumChildren;
30 typedef IPDBEnumChildren<PDBSymbol> IPDBEnumSymbols;
31 typedef IPDBEnumChildren<IPDBSourceFile> IPDBEnumSourceFiles;
32 typedef IPDBEnumChildren<IPDBDataStream> IPDBEnumDataStreams;
33 typedef IPDBEnumChildren<IPDBLineNumber> IPDBEnumLineNumbers;
36 class PDBSymbolCompiland;
37 class PDBSymbolCompilandDetails;
38 class PDBSymbolCompilandEnv;
42 class PDBSymbolAnnotation;
44 class PDBSymbolPublicSymbol;
45 class PDBSymbolTypeUDT;
46 class PDBSymbolTypeEnum;
47 class PDBSymbolTypeFunctionSig;
48 class PDBSymbolTypePointer;
49 class PDBSymbolTypeArray;
50 class PDBSymbolTypeBuiltin;
51 class PDBSymbolTypeTypedef;
52 class PDBSymbolTypeBaseClass;
53 class PDBSymbolTypeFriend;
54 class PDBSymbolTypeFunctionArg;
55 class PDBSymbolFuncDebugStart;
56 class PDBSymbolFuncDebugEnd;
57 class PDBSymbolUsingNamespace;
58 class PDBSymbolTypeVTableShape;
59 class PDBSymbolTypeVTable;
60 class PDBSymbolCustom;
62 class PDBSymbolTypeCustom;
63 class PDBSymbolTypeManaged;
64 class PDBSymbolTypeDimension;
65 class PDBSymbolUnknown;
67 /// Specifies which PDB reader implementation is to be used. Only a value
68 /// of PDB_ReaderType::DIA is supported.
69 enum class PDB_ReaderType {
73 /// Defines a 128-bit unique identifier. This maps to a GUID on Windows, but
74 /// is abstracted here for the purposes of non-Windows platforms that don't have
75 /// the GUID structure defined.
81 /// An enumeration indicating the type of data contained in this table.
82 enum class PDB_TableType {
92 /// Defines flags used for enumerating child symbols. This corresponds to the
93 /// NameSearchOptions enumeration which is documented here:
94 /// https://msdn.microsoft.com/en-us/library/yat28ads.aspx
95 enum PDB_NameSearchFlags {
97 NS_CaseSensitive = 0x1,
98 NS_CaseInsensitive = 0x2,
99 NS_FileNameExtMatch = 0x4,
101 NS_UndecoratedName = 0x10
104 /// Specifies the hash algorithm that a source file from a PDB was hashed with.
105 /// This corresponds to the CV_SourceChksum_t enumeration and are documented
106 /// here: https://msdn.microsoft.com/en-us/library/e96az21x.aspx
107 enum class PDB_Checksum { None = 0, MD5 = 1, SHA1 = 2 };
109 /// These values correspond to the CV_CPU_TYPE_e enumeration, and are documented
110 /// here: https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
170 D3D11_Shader = 0x100,
173 enum class PDB_Machine {
198 /// These values correspond to the CV_call_e enumeration, and are documented
199 /// at the following locations:
200 /// https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
201 /// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680207(v=vs.85).aspx
203 enum class PDB_CallingConv {
228 NearVectorcall = 0x18,
232 /// These values correspond to the CV_CFL_LANG enumeration, and are documented
233 /// here: https://msdn.microsoft.com/en-us/library/bw3aekw6.aspx
234 enum class PDB_Lang {
254 /// These values correspond to the DataKind enumeration, and are documented
255 /// here: https://msdn.microsoft.com/en-us/library/b2x2t313.aspx
256 enum class PDB_DataKind {
269 /// These values correspond to the SymTagEnum enumeration, and are documented
270 /// here: https://msdn.microsoft.com/en-us/library/bkedss5f.aspx
271 enum class PDB_SymType {
306 /// These values correspond to the LocationType enumeration, and are documented
307 /// here: https://msdn.microsoft.com/en-us/library/f57kaez3.aspx
308 enum class PDB_LocType {
323 /// These values correspond to the THUNK_ORDINAL enumeration, and are documented
324 /// here: https://msdn.microsoft.com/en-us/library/dh0k8hft.aspx
325 enum class PDB_ThunkOrdinal {
335 /// These values correspond to the UdtKind enumeration, and are documented
336 /// here: https://msdn.microsoft.com/en-us/library/wcstk66t.aspx
337 enum class PDB_UdtType { Struct, Class, Union, Interface };
339 /// These values correspond to the StackFrameTypeEnum enumeration, and are
340 /// documented here: https://msdn.microsoft.com/en-us/library/bc5207xw.aspx.
341 enum class PDB_StackFrameType { FPO, KernelTrap, KernelTSS, EBP, FrameData };
343 /// These values correspond to the StackFrameTypeEnum enumeration, and are
344 /// documented here: https://msdn.microsoft.com/en-us/library/bc5207xw.aspx.
345 enum class PDB_MemoryType { Code, Data, Stack, HeapCode };
347 /// These values correspond to the Basictype enumeration, and are documented
348 /// here: https://msdn.microsoft.com/en-us/library/4szdtzc3.aspx
349 enum class PDB_BuiltinType {
370 enum class PDB_RegisterId {
422 enum class PDB_MemberAccess { Private = 1, Protected = 2, Public = 3 };
424 enum class PDB_ErrorCode {
443 enum PDB_VariantType {
461 : Type(PDB_VariantType::Empty) {
464 PDB_VariantType Type;
478 #define VARIANT_EQUAL_CASE(Enum) \
479 case PDB_VariantType::Enum: \
480 return Enum == Other.Enum;
481 bool operator==(const Variant &Other) const {
482 if (Type != Other.Type)
485 VARIANT_EQUAL_CASE(Bool)
486 VARIANT_EQUAL_CASE(Int8)
487 VARIANT_EQUAL_CASE(Int16)
488 VARIANT_EQUAL_CASE(Int32)
489 VARIANT_EQUAL_CASE(Int64)
490 VARIANT_EQUAL_CASE(Single)
491 VARIANT_EQUAL_CASE(Double)
492 VARIANT_EQUAL_CASE(UInt8)
493 VARIANT_EQUAL_CASE(UInt16)
494 VARIANT_EQUAL_CASE(UInt32)
495 VARIANT_EQUAL_CASE(UInt64)
500 #undef VARIANT_EQUAL_CASE
501 bool operator!=(const Variant &Other) const { return !(*this == Other); }
505 static const char Magic[] = {'M', 'i', 'c', 'r', 'o', 's', 'o', 'f',
506 't', ' ', 'C', '/', 'C', '+', '+', ' ',
507 'M', 'S', 'F', ' ', '7', '.', '0', '0',
508 '\r', '\n', '\x1a', 'D', 'S', '\0', '\0', '\0'};
510 // The superblock is overlaid at the beginning of the file (offset 0).
511 // It starts with a magic header and is followed by information which describes
512 // the layout of the file system.
514 char MagicBytes[sizeof(Magic)];
515 // The file system is split into a variable number of fixed size elements.
516 // These elements are referred to as blocks. The size of a block may vary
517 // from system to system.
518 support::ulittle32_t BlockSize;
519 // This field's purpose is not yet known.
520 support::ulittle32_t Unknown0;
521 // This contains the number of blocks resident in the file system. In
522 // practice, NumBlocks * BlockSize is equivalent to the size of the PDB file.
523 support::ulittle32_t NumBlocks;
524 // This contains the number of bytes which make up the directory.
525 support::ulittle32_t NumDirectoryBytes;
526 // This field's purpose is not yet known.
527 support::ulittle32_t Unknown1;
528 // This contains the block # of the block map.
529 support::ulittle32_t BlockMapAddr;
536 template <> struct hash<llvm::PDB_SymType> {
537 typedef llvm::PDB_SymType argument_type;
538 typedef std::size_t result_type;
540 result_type operator()(const argument_type &Arg) const {
541 return std::hash<int>()(static_cast<int>(Arg));