1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422
|
//===- PDBTypes.h - Defines enums for various fields contained in PDB ----====//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_DEBUGINFO_PDB_PDBTYPES_H
#define LLVM_DEBUGINFO_PDB_PDBTYPES_H
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
#include "llvm/DebugInfo/PDB/Native/RawTypes.h"
#include <cctype>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <functional>
namespace llvm {
namespace pdb {
class IPDBDataStream;
class IPDBInjectedSource;
class IPDBLineNumber;
class IPDBSectionContrib;
class IPDBSourceFile;
class IPDBTable;
class PDBSymDumper;
class PDBSymbol;
class PDBSymbolExe;
class PDBSymbolCompiland;
class PDBSymbolCompilandDetails;
class PDBSymbolCompilandEnv;
class PDBSymbolFunc;
class PDBSymbolBlock;
class PDBSymbolData;
class PDBSymbolAnnotation;
class PDBSymbolLabel;
class PDBSymbolPublicSymbol;
class PDBSymbolTypeUDT;
class PDBSymbolTypeEnum;
class PDBSymbolTypeFunctionSig;
class PDBSymbolTypePointer;
class PDBSymbolTypeArray;
class PDBSymbolTypeBuiltin;
class PDBSymbolTypeTypedef;
class PDBSymbolTypeBaseClass;
class PDBSymbolTypeFriend;
class PDBSymbolTypeFunctionArg;
class PDBSymbolFuncDebugStart;
class PDBSymbolFuncDebugEnd;
class PDBSymbolUsingNamespace;
class PDBSymbolTypeVTableShape;
class PDBSymbolTypeVTable;
class PDBSymbolCustom;
class PDBSymbolThunk;
class PDBSymbolTypeCustom;
class PDBSymbolTypeManaged;
class PDBSymbolTypeDimension;
class PDBSymbolUnknown;
using IPDBEnumSymbols = IPDBEnumChildren<PDBSymbol>;
using IPDBEnumSourceFiles = IPDBEnumChildren<IPDBSourceFile>;
using IPDBEnumDataStreams = IPDBEnumChildren<IPDBDataStream>;
using IPDBEnumLineNumbers = IPDBEnumChildren<IPDBLineNumber>;
using IPDBEnumTables = IPDBEnumChildren<IPDBTable>;
using IPDBEnumInjectedSources = IPDBEnumChildren<IPDBInjectedSource>;
using IPDBEnumSectionContribs = IPDBEnumChildren<IPDBSectionContrib>;
/// Specifies which PDB reader implementation is to be used. Only a value
/// of PDB_ReaderType::DIA is currently supported, but Native is in the works.
enum class PDB_ReaderType {
DIA = 0,
Native = 1,
};
/// An enumeration indicating the type of data contained in this table.
enum class PDB_TableType {
TableInvalid = 0,
Symbols,
SourceFiles,
LineNumbers,
SectionContribs,
Segments,
InjectedSources,
FrameData,
InputAssemblyFiles,
Dbg
};
/// Defines flags used for enumerating child symbols. This corresponds to the
/// NameSearchOptions enumeration which is documented here:
/// https://msdn.microsoft.com/en-us/library/yat28ads.aspx
enum PDB_NameSearchFlags {
NS_Default = 0x0,
NS_CaseSensitive = 0x1,
NS_CaseInsensitive = 0x2,
NS_FileNameExtMatch = 0x4,
NS_Regex = 0x8,
NS_UndecoratedName = 0x10,
// For backward compatibility.
NS_CaseInFileNameExt = NS_CaseInsensitive | NS_FileNameExtMatch,
NS_CaseRegex = NS_Regex | NS_CaseSensitive,
NS_CaseInRex = NS_Regex | NS_CaseInsensitive
};
/// Specifies the hash algorithm that a source file from a PDB was hashed with.
/// This corresponds to the CV_SourceChksum_t enumeration and are documented
/// here: https://msdn.microsoft.com/en-us/library/e96az21x.aspx
enum class PDB_Checksum { None = 0, MD5 = 1, SHA1 = 2, SHA256 = 3 };
/// These values correspond to the CV_CPU_TYPE_e enumeration, and are documented
/// here: https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
using PDB_Cpu = codeview::CPUType;
enum class PDB_Machine {
Invalid = 0xffff,
Unknown = 0x0,
Am33 = 0x13,
Amd64 = 0x8664,
Arm = 0x1C0,
ArmNT = 0x1C4,
Ebc = 0xEBC,
x86 = 0x14C,
Ia64 = 0x200,
M32R = 0x9041,
Mips16 = 0x266,
MipsFpu = 0x366,
MipsFpu16 = 0x466,
PowerPC = 0x1F0,
PowerPCFP = 0x1F1,
R4000 = 0x166,
SH3 = 0x1A2,
SH3DSP = 0x1A3,
SH4 = 0x1A6,
SH5 = 0x1A8,
Thumb = 0x1C2,
WceMipsV2 = 0x169
};
enum class PDB_SourceCompression {
None,
RunLengthEncoded,
Huffman,
LZ,
};
/// These values correspond to the CV_call_e enumeration, and are documented
/// at the following locations:
/// https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
/// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680207(v=vs.85).aspx
using PDB_CallingConv = codeview::CallingConvention;
/// These values correspond to the CV_CFL_LANG enumeration, and are documented
/// here: https://msdn.microsoft.com/en-us/library/bw3aekw6.aspx
using PDB_Lang = codeview::SourceLanguage;
/// These values correspond to the DataKind enumeration, and are documented
/// here: https://msdn.microsoft.com/en-us/library/b2x2t313.aspx
enum class PDB_DataKind {
Unknown,
Local,
StaticLocal,
Param,
ObjectPtr,
FileStatic,
Global,
Member,
StaticMember,
Constant
};
/// These values correspond to the SymTagEnum enumeration, and are documented
/// here: https://msdn.microsoft.com/en-us/library/bkedss5f.aspx
enum class PDB_SymType {
None,
Exe,
Compiland,
CompilandDetails,
CompilandEnv,
Function,
Block,
Data,
Annotation,
Label,
PublicSymbol,
UDT,
Enum,
FunctionSig,
PointerType,
ArrayType,
BuiltinType,
Typedef,
BaseClass,
Friend,
FunctionArg,
FuncDebugStart,
FuncDebugEnd,
UsingNamespace,
VTableShape,
VTable,
Custom,
Thunk,
CustomType,
ManagedType,
Dimension,
Max
};
/// These values correspond to the LocationType enumeration, and are documented
/// here: https://msdn.microsoft.com/en-us/library/f57kaez3.aspx
enum class PDB_LocType {
Null,
Static,
TLS,
RegRel,
ThisRel,
Enregistered,
BitField,
Slot,
IlRel,
MetaData,
Constant,
RegRelAliasIndir,
Max
};
/// These values correspond to the UdtKind enumeration, and are documented
/// here: https://msdn.microsoft.com/en-us/library/wcstk66t.aspx
enum class PDB_UdtType { Struct, Class, Union, Interface };
/// These values correspond to the StackFrameTypeEnum enumeration, and are
/// documented here: https://msdn.microsoft.com/en-us/library/bc5207xw.aspx.
enum class PDB_StackFrameType : uint16_t {
FPO,
KernelTrap,
KernelTSS,
EBP,
FrameData,
Unknown = 0xffff
};
/// These values correspond to the MemoryTypeEnum enumeration, and are
/// documented here: https://msdn.microsoft.com/en-us/library/ms165609.aspx.
enum class PDB_MemoryType : uint16_t {
Code,
Data,
Stack,
HeapCode,
Any = 0xffff
};
/// These values correspond to the Basictype enumeration, and are documented
/// here: https://msdn.microsoft.com/en-us/library/4szdtzc3.aspx
enum class PDB_BuiltinType {
None = 0,
Void = 1,
Char = 2,
WCharT = 3,
Int = 6,
UInt = 7,
Float = 8,
BCD = 9,
Bool = 10,
Long = 13,
ULong = 14,
Currency = 25,
Date = 26,
Variant = 27,
Complex = 28,
Bitfield = 29,
BSTR = 30,
HResult = 31,
Char16 = 32,
Char32 = 33
};
/// These values correspond to the flags that can be combined to control the
/// return of an undecorated name for a C++ decorated name, and are documented
/// here: https://msdn.microsoft.com/en-us/library/kszfk0fs.aspx
enum PDB_UndnameFlags : uint32_t {
Undname_Complete = 0x0,
Undname_NoLeadingUnderscores = 0x1,
Undname_NoMsKeywords = 0x2,
Undname_NoFuncReturns = 0x4,
Undname_NoAllocModel = 0x8,
Undname_NoAllocLang = 0x10,
Undname_Reserved1 = 0x20,
Undname_Reserved2 = 0x40,
Undname_NoThisType = 0x60,
Undname_NoAccessSpec = 0x80,
Undname_NoThrowSig = 0x100,
Undname_NoMemberType = 0x200,
Undname_NoReturnUDTModel = 0x400,
Undname_32BitDecode = 0x800,
Undname_NameOnly = 0x1000,
Undname_TypeOnly = 0x2000,
Undname_HaveParams = 0x4000,
Undname_NoECSU = 0x8000,
Undname_NoIdentCharCheck = 0x10000,
Undname_NoPTR64 = 0x20000
};
enum class PDB_MemberAccess { Private = 1, Protected = 2, Public = 3 };
struct VersionInfo {
uint32_t Major;
uint32_t Minor;
uint32_t Build;
uint32_t QFE;
};
enum PDB_VariantType {
Empty,
Unknown,
Int8,
Int16,
Int32,
Int64,
Single,
Double,
UInt8,
UInt16,
UInt32,
UInt64,
Bool,
String
};
struct Variant {
Variant() = default;
Variant(const Variant &Other) {
*this = Other;
}
~Variant() {
if (Type == PDB_VariantType::String)
delete[] Value.String;
}
PDB_VariantType Type = PDB_VariantType::Empty;
union {
bool Bool;
int8_t Int8;
int16_t Int16;
int32_t Int32;
int64_t Int64;
float Single;
double Double;
uint8_t UInt8;
uint16_t UInt16;
uint32_t UInt32;
uint64_t UInt64;
char *String;
} Value;
#define VARIANT_EQUAL_CASE(Enum) \
case PDB_VariantType::Enum: \
return Value.Enum == Other.Value.Enum;
bool operator==(const Variant &Other) const {
if (Type != Other.Type)
return false;
switch (Type) {
VARIANT_EQUAL_CASE(Bool)
VARIANT_EQUAL_CASE(Int8)
VARIANT_EQUAL_CASE(Int16)
VARIANT_EQUAL_CASE(Int32)
VARIANT_EQUAL_CASE(Int64)
VARIANT_EQUAL_CASE(Single)
VARIANT_EQUAL_CASE(Double)
VARIANT_EQUAL_CASE(UInt8)
VARIANT_EQUAL_CASE(UInt16)
VARIANT_EQUAL_CASE(UInt32)
VARIANT_EQUAL_CASE(UInt64)
VARIANT_EQUAL_CASE(String)
default:
return true;
}
}
#undef VARIANT_EQUAL_CASE
bool operator!=(const Variant &Other) const { return !(*this == Other); }
Variant &operator=(const Variant &Other) {
if (this == &Other)
return *this;
if (Type == PDB_VariantType::String)
delete[] Value.String;
Type = Other.Type;
Value = Other.Value;
if (Other.Type == PDB_VariantType::String &&
Other.Value.String != nullptr) {
Value.String = new char[strlen(Other.Value.String) + 1];
::strcpy(Value.String, Other.Value.String);
}
return *this;
}
};
} // end namespace pdb
} // end namespace llvm
namespace std {
template <> struct hash<llvm::pdb::PDB_SymType> {
using argument_type = llvm::pdb::PDB_SymType;
using result_type = std::size_t;
result_type operator()(const argument_type &Arg) const {
return std::hash<int>()(static_cast<int>(Arg));
}
};
} // end namespace std
#endif // LLVM_DEBUGINFO_PDB_PDBTYPES_H
|