30 Variant VariantFromVARIANT(
const VARIANT &V) {
47 Result.
Type = PDB_VariantType::Int64;
66 Result.
Value.
Bool = (V.boolVal == VARIANT_TRUE) ?
true :
false;
67 Result.
Type = PDB_VariantType::Bool;
75 Result.
Type = PDB_VariantType::Double;
78 const char *SrcBytes =
reinterpret_cast<const char *
>(V.bstrVal);
83 Result.
Value.
String =
new char[Result8.length() + 1];
95 template <
typename ArgType>
97 HRESULT (__stdcall IDiaSymbol::*Method)(ArgType *)) {
99 if (S_OK == (Symbol->*Method)(&Value))
100 return static_cast<ArgType
>(Value);
105 template <
typename ArgType,
typename RetType>
107 HRESULT (__stdcall IDiaSymbol::*Method)(ArgType *)) {
109 if (S_OK == (Symbol->*Method)(&Value))
110 return static_cast<RetType
>(Value);
117 HRESULT (__stdcall IDiaSymbol::*Method)(BSTR *)) {
119 if (S_OK != (Symbol->*Method)(&Result16))
120 return std::string();
122 const char *SrcBytes =
reinterpret_cast<const char *
>(Result16.m_str);
126 return std::string();
132 HRESULT (__stdcall IDiaSymbol::*Method)(GUID *)) {
134 if (S_OK != (Symbol->*Method)(&Result))
138 "GUID is the wrong size!");
140 ::memcpy(&IdResult, &Result,
sizeof(GUID));
144 template <
typename ArgType>
147 HRESULT (__stdcall IDiaSymbol::*Method)(ArgType *)) {
149 if (S_OK == (Symbol->*Method)(&Value)) {
152 OS << Name <<
": " << Value;
158 HRESULT (__stdcall IDiaSymbol::*Method)(BSTR *)) {
159 BSTR Value =
nullptr;
160 if (S_OK != (Symbol->*Method)(&Value))
162 const char *Bytes =
reinterpret_cast<const char *
>(Value);
168 OS << Name <<
": " << Result;
170 ::SysFreeString(Value);
175 HRESULT (__stdcall IDiaSymbol::*Method)(VARIANT *)) {
178 if (S_OK != (Symbol->*Method)(&Value))
182 Variant V = VariantFromVARIANT(Value);
183 OS << Name <<
": " << V;
189 StringRef GuidBytes(reinterpret_cast<const char *>(&G),
sizeof(G));
197 CComPtr<IDiaSymbol> DiaSymbol)
198 : Session(PDBSession), Symbol(DiaSymbol) {}
200 #define RAW_METHOD_DUMP(Stream, Method) \ 201 DumpDIAValue(Stream, Indent, StringRef(#Method), Symbol, &IDiaSymbol::Method); 372 std::unique_ptr<IPDBEnumSymbols>
374 enum SymTagEnum EnumVal =
static_cast<enum SymTagEnum
>(
Type);
376 CComPtr<IDiaEnumSymbols> DiaEnumerator;
378 Symbol->findChildrenEx(EnumVal,
nullptr, nsNone, &DiaEnumerator)) {
379 if (S_OK != Symbol->findChildren(EnumVal,
nullptr, nsNone, &DiaEnumerator))
383 return llvm::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
386 std::unique_ptr<IPDBEnumSymbols>
392 enum SymTagEnum EnumVal =
static_cast<enum SymTagEnum
>(
Type);
393 DWORD CompareFlags =
static_cast<DWORD>(Flags);
394 wchar_t *Name16Str =
reinterpret_cast<wchar_t *
>(Name16.
data());
396 CComPtr<IDiaEnumSymbols> DiaEnumerator;
398 Symbol->findChildrenEx(EnumVal, Name16Str, CompareFlags, &DiaEnumerator))
401 return llvm::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
404 std::unique_ptr<IPDBEnumSymbols>
411 enum SymTagEnum EnumVal =
static_cast<enum SymTagEnum
>(
Type);
413 DWORD CompareFlags =
static_cast<DWORD>(Flags);
414 wchar_t *Name16Str =
reinterpret_cast<wchar_t *
>(Name16.
data());
416 CComPtr<IDiaEnumSymbols> DiaEnumerator;
418 Symbol->findChildrenExByAddr(EnumVal, Name16Str, CompareFlags, Section,
419 Offset, &DiaEnumerator))
422 return llvm::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
425 std::unique_ptr<IPDBEnumSymbols>
431 enum SymTagEnum EnumVal =
static_cast<enum SymTagEnum
>(
Type);
433 DWORD CompareFlags =
static_cast<DWORD>(Flags);
434 wchar_t *Name16Str =
reinterpret_cast<wchar_t *
>(Name16.
data());
436 CComPtr<IDiaEnumSymbols> DiaEnumerator;
438 Symbol->findChildrenExByVA(EnumVal, Name16Str, CompareFlags, VA,
442 return llvm::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
445 std::unique_ptr<IPDBEnumSymbols>
451 enum SymTagEnum EnumVal =
static_cast<enum SymTagEnum
>(
Type);
452 DWORD CompareFlags =
static_cast<DWORD>(Flags);
453 wchar_t *Name16Str =
reinterpret_cast<wchar_t *
>(Name16.
data());
455 CComPtr<IDiaEnumSymbols> DiaEnumerator;
457 Symbol->findChildrenExByRVA(EnumVal, Name16Str, CompareFlags, RVA,
461 return llvm::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
464 std::unique_ptr<IPDBEnumSymbols>
466 CComPtr<IDiaEnumSymbols> DiaEnumerator;
467 if (S_OK != Symbol->findInlineFramesByAddr(Section, Offset, &DiaEnumerator))
470 return llvm::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
473 std::unique_ptr<IPDBEnumSymbols>
475 CComPtr<IDiaEnumSymbols> DiaEnumerator;
476 if (S_OK != Symbol->findInlineFramesByRVA(RVA, &DiaEnumerator))
479 return llvm::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
482 std::unique_ptr<IPDBEnumSymbols>
484 CComPtr<IDiaEnumSymbols> DiaEnumerator;
485 if (S_OK != Symbol->findInlineFramesByVA(VA, &DiaEnumerator))
488 return llvm::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
492 CComPtr<IDiaEnumLineNumbers> DiaEnumerator;
493 if (S_OK != Symbol->findInlineeLines(&DiaEnumerator))
496 return llvm::make_unique<DIAEnumLineNumbers>(DiaEnumerator);
499 std::unique_ptr<IPDBEnumLineNumbers>
502 CComPtr<IDiaEnumLineNumbers> DiaEnumerator;
503 if (S_OK != Symbol->findInlineeLinesByAddr(Section, Offset, Length, &DiaEnumerator))
506 return llvm::make_unique<DIAEnumLineNumbers>(DiaEnumerator);
509 std::unique_ptr<IPDBEnumLineNumbers>
511 CComPtr<IDiaEnumLineNumbers> DiaEnumerator;
512 if (S_OK != Symbol->findInlineeLinesByRVA(RVA, Length, &DiaEnumerator))
515 return llvm::make_unique<DIAEnumLineNumbers>(DiaEnumerator);
518 std::unique_ptr<IPDBEnumLineNumbers>
520 CComPtr<IDiaEnumLineNumbers> DiaEnumerator;
521 if (S_OK != Symbol->findInlineeLinesByVA(VA, Length, &DiaEnumerator))
524 return llvm::make_unique<DIAEnumLineNumbers>(DiaEnumerator);
531 Symbol->get_dataBytes(0, &DataSize,
nullptr);
536 Symbol->get_dataBytes(DataSize, &DataSize, bytes.
data());
542 if (S_OK != Symbol->get_undecoratedNameEx((
DWORD)Flags, &Result16))
543 return std::string();
545 const char *SrcBytes =
reinterpret_cast<const char *
>(Result16.m_str);
549 return std::string();
554 return PrivateGetDIAValue<DWORD, PDB_MemberAccess>(Symbol,
555 &IDiaSymbol::get_access);
594 return PrivateGetDIAValue<DWORD, PDB_BuiltinType>(Symbol,
595 &IDiaSymbol::get_baseType);
603 return PrivateGetDIAValue<DWORD, PDB_CallingConv>(
604 Symbol, &IDiaSymbol::get_callingConvention);
631 return PrivateGetDIAValue<DWORD, PDB_Lang>(Symbol, &IDiaSymbol::get_language);
644 &IDiaSymbol::get_liveRangeStartAddressOffset);
649 &IDiaSymbol::get_liveRangeStartAddressSection);
654 Symbol, &IDiaSymbol::get_liveRangeStartRelativeVirtualAddress);
658 return PrivateGetDIAValue<DWORD, codeview::RegisterId>(
659 Symbol, &IDiaSymbol::get_localBasePointerRegisterId);
676 &IDiaSymbol::get_numberOfAcceleratorPointerTags);
712 return PrivateGetDIAValue<DWORD, PDB_Cpu>(Symbol, &IDiaSymbol::get_platform);
720 return PrivateGetDIAValue<DWORD, codeview::RegisterId>(
721 Symbol, &IDiaSymbol::get_registerId);
752 std::unique_ptr<IPDBLineNumber>
754 CComPtr<IDiaLineNumber> LineNumber;
755 if (FAILED(Symbol->getSrcLineOnTypeDefn(&LineNumber)) || !LineNumber)
758 return llvm::make_unique<DIALineNumber>(LineNumber);
783 &IDiaSymbol::get_targetRelativeVirtualAddress);
829 if (S_OK != Symbol->get_value(&Value))
832 return VariantFromVARIANT(Value);
847 std::unique_ptr<PDBSymbolTypeBuiltin>
849 CComPtr<IDiaSymbol> TableType;
850 if (FAILED(Symbol->get_virtualBaseTableType(&TableType)) || !TableType)
853 auto RawVT = llvm::make_unique<DIARawSymbol>(Session, TableType);
855 llvm::make_unique<PDBSymbolTypePointer>(Session, std::move(RawVT));
860 return PrivateGetDIAValue<DWORD, PDB_DataKind>(Symbol,
861 &IDiaSymbol::get_dataKind);
865 return PrivateGetDIAValue<DWORD, PDB_SymType>(Symbol,
866 &IDiaSymbol::get_symTag);
886 return PrivateGetDIAValue<DWORD, PDB_LocType>(Symbol,
887 &IDiaSymbol::get_locationType);
891 return PrivateGetDIAValue<DWORD, PDB_Machine>(Symbol,
892 &IDiaSymbol::get_machineType);
896 return PrivateGetDIAValue<DWORD, codeview::ThunkOrdinal>(
897 Symbol, &IDiaSymbol::get_thunkOrdinal);
913 return PrivateGetDIAValue<DWORD, PDB_UdtType>(Symbol,
914 &IDiaSymbol::get_udtKind);
1047 &IDiaSymbol::get_isAcceleratorGroupSharedLocal);
1052 &IDiaSymbol::get_isAcceleratorPointerTagLiveRange);
1109 &IDiaSymbol::get_isLocationControlFlowDependent);
1150 &IDiaSymbol::get_isPointerBasedOnSymbolValue);
bool hasAlloca() const override
bool hasInlineAttribute() const override
bool hasNoReturnAttribute() const override
uint32_t getOemSymbolId() const override
uint32_t getToken() const override
uint32_t getLiveRangeStartRelativeVirtualAddress() const override
bool hasInterruptReturn() const override
bool isRValueReference() const override
std::unique_ptr< IPDBEnumSymbols > findInlineFramesByVA(uint64_t VA) const override
std::unique_ptr< IPDBEnumSymbols > findInlineFramesByAddr(uint32_t Section, uint32_t Offset) const override
PDB_UdtType getUdtKind() const override
Compute iterated dominance frontiers using a linear time algorithm.
int32_t getOffset() const override
bool isStatic() const override
codeview::RegisterId getLocalBasePointerRegisterId() const override
uint32_t getNumberOfColumns() const override
uint32_t getTargetOffset() const override
LLVM_NODISCARD auto unique_dyn_cast(std::unique_ptr< Y > &Val) -> decltype(cast< X >(Val))
bool hasOptimizedCodeDebugInfo() const override
PDB_UdtType
These values correspond to the UdtKind enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/wcstk66t.aspx.
uint32_t getTextureSlot() const override
uint32_t getSubTypeId() const override
bool isNaked() const override
uint32_t getVirtualBaseDispIndex() const override
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
PDB_NameSearchFlags
Defines flags used for enumerating child symbols.
bool isValueUdt() const override
std::unique_ptr< IPDBEnumLineNumbers > findInlineeLinesByAddr(uint32_t Section, uint32_t Offset, uint32_t Length) const override
uint32_t getVirtualTableShapeId() const override
union llvm::pdb::Variant::@193 Value
std::string getUnused() const override
bool isConstructorVirtualBase() const override
bool getNoStackOrdering() const override
bool isPureVirtual() const override
bool isSdl() const override
std::string getSymbolsFileName() const override
std::unique_ptr< IPDBEnumLineNumbers > findInlineeLinesByVA(uint64_t VA, uint32_t Length) const override
bool isFunction() const override
bool isReturnValue() const override
PDB_Machine getMachineType() const override
bool isRefUdt() const override
bool hasManagedCode() const override
bool isVirtual() const override
bool hasOverloadedOperator() const override
raw_ostream & operator<<(raw_ostream &OS, const PDB_VariantType &Value)
bool hasCastOperator() const override
uint32_t getUnmodifiedTypeId() const override
uint32_t getStride() const override
uint32_t getUpperBoundId() const override
bool hasEHa() const override
bool isIntroVirtualFunction() const override
uint32_t getNumberOfRegisterIndices() const override
std::string getName() const override
codeview::ThunkOrdinal getThunkOrdinal() const override
void format(raw_ostream &Stream, StringRef Style) override
This represents the 'GUID' type from windows.h.
bool isScoped() const override
std::unique_ptr< IPDBLineNumber > getSrcLineOnTypeDefn() const override
std::string getUndecoratedNameEx(PDB_UndnameFlags Flags) const override
bool isCxxReturnUdt() const override
bool isVolatileType() const override
uint32_t getNumberOfAcceleratorPointerTags() const override
PDB_SymType getSymTag() const override
uint32_t getArrayIndexTypeId() const override
bool isNested() const override
bool isMSILNetmodule() const override
ArgType PrivateGetDIAValue(IDiaSectionContrib *Section, HRESULT(__stdcall IDiaSectionContrib::*Method)(ArgType *))
bool isPointerToMemberFunction() const override
uint64_t getLength() const override
bool isOptimizedAway() const override
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
bool isIndirectVirtualBaseClass() const override
std::unique_ptr< IPDBEnumSymbols > findChildrenByVA(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags, uint64_t VA) const override
uint32_t getTimeStamp() const override
bool isIntrinsic() const override
PDB_UndnameFlags
These values correspond to the flags that can be combined to control the return of an undecorated nam...
bool convertUTF8ToUTF16String(StringRef SrcUTF8, SmallVectorImpl< UTF16 > &DstUTF16)
Converts a UTF-8 string into a UTF-16 string with native endianness.
void getFrontEndVersion(VersionInfo &Version) const override
PDB_BuiltinType getBuiltinType() const override
bool hasCustomCallingConvention() const override
uint32_t getLiveRangeStartAddressOffset() const override
bool isLocationControlFlowDependent() const override
bool isAcceleratorPointerTagLiveRange() const override
bool isRestrictedType() const override
bool hasCTypes() const override
PDB_SymType
These values correspond to the SymTagEnum enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/bkedss5f.aspx.
uint32_t getRank() const override
PDB_MemberAccess getAccess() const override
bool getAddressTaken() const override
uint32_t getTargetSection() const override
uint32_t getRegisterType() const override
bool isAcceleratorGroupSharedLocal() const override
bool isEditAndContinueEnabled() const override
The instances of the Type class are immutable: once they are created, they are never changed...
PDB_DataKind
These values correspond to the DataKind enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/b2x2t313.aspx.
void getDataBytes(llvm::SmallVector< uint8_t, 32 > &bytes) const override
bool isPointerBasedOnSymbolValue() const override
uint32_t getSymIndexId() const override
uint32_t getOffsetInUdt() const override
bool isAcceleratorStubFunction() const override
std::unique_ptr< IPDBEnumSymbols > findChildrenByAddr(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags, uint32_t Section, uint32_t Offset) const override
bool isDataAligned() const override
uint64_t getTargetVirtualAddress() const override
bool hasNestedTypes() const override
codeview::GUID getGuid() const override
bool isVirtualBaseClass() const override
bool hasEH() const override
uint32_t getLexicalParentId() const override
bool wasInlined() const override
bool isAggregated() const override
bool isMSILCode() const override
uint32_t getSizeInUdt() const override
PDB_LocType
These values correspond to the LocationType enumeration, and are documented here: https://msdn...
uint32_t getTargetRelativeVirtualAddress() const override
bool isPacked() const override
PDB_CallingConv getCallingConvention() const override
std::string getCompilerName() const override
uint64_t getLiveRangeLength() const override
bool isConstType() const override
bool isCode() const override
uint32_t getSignature() const override
SourceLanguage
These values correspond to the CV_CFL_LANG enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/bw3aekw6.aspx.
bool hasSEH() const override
std::unique_ptr< IPDBEnumSymbols > findInlineFramesByRVA(uint32_t RVA) const override
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
bool isCVTCIL() const override
int32_t getVirtualBasePointerOffset() const override
bool isManagedCode() const override
bool hasPrivateSymbols() const override
bool isSafeBuffers() const override
CPUType
These values correspond to the CV_CPU_TYPE_e enumeration, and are documented here: https://msdn...
int32_t getThisAdjust() const override
std::string getLibraryName() const override
codeview::RegisterId getRegisterId() const override
bool isMatrixRowMajor() const override
bool isHLSLData() const override
uint32_t getSlot() const override
std::unique_ptr< IPDBEnumLineNumbers > findInlineeLinesByRVA(uint32_t RVA, uint32_t Length) const override
uint32_t getLowerBoundId() const override
bool hasLongJump() const override
bool hasAssignmentOperator() const override
uint32_t getVirtualBaseOffset() const override
DIARawSymbol(const DIASession &PDBSession, CComPtr< IDiaSymbol > DiaSymbol)
std::string getSourceFileName() const override
uint32_t getBaseDataOffset() const override
bool convertUTF16ToUTF8String(ArrayRef< char > SrcBytes, std::string &Out)
Converts a stream of raw bytes assumed to be UTF16 into a UTF8 std::string.
bool hasSetJump() const override
bool isVirtualInheritance() const override
bool isUnreached() const override
bool isPointerToDataMember() const override
uint32_t getNumberOfModifiers() const override
PDB_LocType getLocationType() const override
bool hasStrictGSCheck() const override
pointer data()
Return a pointer to the vector's buffer, even if empty().
bool hasSecurityChecks() const override
void getBackEndVersion(VersionInfo &Version) const override
std::unique_ptr< IPDBEnumLineNumbers > findInlineeLines() const override
bool hasFramePointer() const override
#define RAW_METHOD_DUMP(Stream, Method)
uint32_t getNumberOfRows() const override
std::string getUndecoratedName() const override
uint32_t getAddressSection() const override
uint32_t getAge() const override
PDB_Cpu getPlatform() const override
uint32_t getOemId() const override
bool isHotpatchable() const override
bool isMultipleInheritance() const override
ThunkOrdinal
These values correspond to the THUNK_ORDINAL enumeration.
PDB_BuiltinType
These values correspond to the Basictype enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/4szdtzc3.aspx.
std::unique_ptr< IPDBEnumSymbols > findChildren(PDB_SymType Type) const override
bool hasNoInlineAttribute() const override
bool isLTCG() const override
uint32_t getCount() const override
LLVM Value Representation.
bool isSplitted() const override
uint64_t getVirtualAddress() const override
std::unique_ptr< IPDBEnumSymbols > findChildrenByRVA(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags, uint32_t RVA) const override
CallingConvention
These values correspond to the CV_call_e enumeration, and are documented at the following locations: ...
uint32_t getMemorySpaceKind() const override
This class implements an extremely fast bulk output stream that can only output to a stream...
bool isCompilerGenerated() const override
StringRef - Represent a constant reference to a string, i.e.
Variant getValue() const override
bool isSingleInheritance() const override
uint32_t getLiveRangeStartAddressSection() const override
PDB_Lang getLanguage() const override
void dump(raw_ostream &OS, int Indent) const override
std::string getObjectFileName() const override
bool isInterfaceUdt() const override
bool isReference() const override
PDB_DataKind getDataKind() const override
bool hasInlAsm() const override
uint32_t getClassParentId() const override
uint32_t getAddressOffset() const override
uint32_t getUavSlot() const override
uint32_t getBitPosition() const override
uint32_t getBaseDataSlot() const override
bool hasConstructor() const override
bool isUnalignedType() const override
uint32_t getCountLiveRanges() const override
uint32_t getSamplerSlot() const override
std::unique_ptr< PDBSymbolTypeBuiltin > getVirtualBaseTableType() const override
bool hasDebugInfo() const override
bool hasFarReturn() const override
uint32_t getTypeId() const override
uint32_t getRelativeVirtualAddress() const override
uint32_t getBaseSymbolId() const override