30 Variant VariantFromVARIANT(
const VARIANT &V) {
66 Result.
Value.
Bool = (V.boolVal == VARIANT_TRUE) ?
true :
false;
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 *)) {
123 HRESULT (__stdcall IDiaSymbol::*Method)(GUID *)) {
125 if (S_OK != (Symbol->*Method)(&Result))
129 "GUID is the wrong size!");
131 ::memcpy(&IdResult, &Result,
sizeof(GUID));
135 template <
typename Pr
intType,
typename ArgType>
138 HRESULT (__stdcall IDiaSymbol::*Method)(ArgType *)) {
140 if (S_OK == (Symbol->*Method)(&Value))
146 HRESULT (__stdcall IDiaSymbol::*Method)(
DWORD *),
150 if (S_OK == (Symbol->*Method)(&Value))
155 template <
typename ArgType>
158 HRESULT (__stdcall IDiaSymbol::*Method)(ArgType *)) {
160 if (S_OK == (Symbol->*Method)(&Value))
166 HRESULT (__stdcall IDiaSymbol::*Method)(BSTR *)) {
167 BSTR Value =
nullptr;
168 if (S_OK != (Symbol->*Method)(&Value))
170 const char *Bytes =
reinterpret_cast<const char *
>(
Value);
175 ::SysFreeString(Value);
180 HRESULT (__stdcall IDiaSymbol::*Method)(VARIANT *)) {
183 if (S_OK != (Symbol->*Method)(&Value))
185 Variant V = VariantFromVARIANT(Value);
193 StringRef GuidBytes(reinterpret_cast<const char *>(&G),
sizeof(G));
201 CComPtr<IDiaSymbol> DiaSymbol)
202 : Session(PDBSession), Symbol(DiaSymbol) {}
204 #define RAW_ID_METHOD_DUMP(Stream, Method, Session, FieldId, ShowFlags, \ 206 DumpDIAIdValue(Stream, Indent, StringRef{#Method}, Symbol, \ 207 &IDiaSymbol::get_##Method, Session, FieldId, ShowFlags, \ 210 #define RAW_METHOD_DUMP(Stream, Method) \ 211 DumpDIAValue(Stream, Indent, StringRef{#Method}, Symbol, \ 212 &IDiaSymbol::get_##Method); 214 #define RAW_METHOD_DUMP_AS(Stream, Method, Type) \ 215 DumpDIAValueAs<Type>(Stream, Indent, StringRef{#Method}, Symbol, \ 216 &IDiaSymbol::get_##Method); 222 ShowIdFields, RecurseIdFields);
241 ShowIdFields, RecurseIdFields);
397 std::unique_ptr<IPDBEnumSymbols>
399 enum SymTagEnum EnumVal =
static_cast<enum SymTagEnum
>(
Type);
401 CComPtr<IDiaEnumSymbols> DiaEnumerator;
403 Symbol->findChildrenEx(EnumVal,
nullptr, nsNone, &DiaEnumerator)) {
404 if (S_OK != Symbol->findChildren(EnumVal,
nullptr, nsNone, &DiaEnumerator))
408 return std::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
411 std::unique_ptr<IPDBEnumSymbols>
417 enum SymTagEnum EnumVal =
static_cast<enum SymTagEnum
>(
Type);
418 DWORD CompareFlags =
static_cast<DWORD>(Flags);
419 wchar_t *Name16Str =
reinterpret_cast<wchar_t *
>(Name16.
data());
421 CComPtr<IDiaEnumSymbols> DiaEnumerator;
423 Symbol->findChildrenEx(EnumVal, Name16Str, CompareFlags, &DiaEnumerator))
426 return std::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
429 std::unique_ptr<IPDBEnumSymbols>
436 enum SymTagEnum EnumVal =
static_cast<enum SymTagEnum
>(
Type);
438 DWORD CompareFlags =
static_cast<DWORD>(Flags);
439 wchar_t *Name16Str =
reinterpret_cast<wchar_t *
>(Name16.
data());
441 CComPtr<IDiaEnumSymbols> DiaEnumerator;
442 if (S_OK != Symbol->findChildrenExByAddr(EnumVal, Name16Str, CompareFlags,
443 Section, Offset, &DiaEnumerator))
446 return std::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
449 std::unique_ptr<IPDBEnumSymbols>
455 enum SymTagEnum EnumVal =
static_cast<enum SymTagEnum
>(
Type);
457 DWORD CompareFlags =
static_cast<DWORD>(Flags);
458 wchar_t *Name16Str =
reinterpret_cast<wchar_t *
>(Name16.
data());
460 CComPtr<IDiaEnumSymbols> DiaEnumerator;
461 if (S_OK != Symbol->findChildrenExByVA(EnumVal, Name16Str, CompareFlags, VA,
465 return std::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
468 std::unique_ptr<IPDBEnumSymbols>
474 enum SymTagEnum EnumVal =
static_cast<enum SymTagEnum
>(
Type);
475 DWORD CompareFlags =
static_cast<DWORD>(Flags);
476 wchar_t *Name16Str =
reinterpret_cast<wchar_t *
>(Name16.
data());
478 CComPtr<IDiaEnumSymbols> DiaEnumerator;
479 if (S_OK != Symbol->findChildrenExByRVA(EnumVal, Name16Str, CompareFlags, RVA,
483 return std::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
486 std::unique_ptr<IPDBEnumSymbols>
488 CComPtr<IDiaEnumSymbols> DiaEnumerator;
489 if (S_OK != Symbol->findInlineFramesByAddr(Section, Offset, &DiaEnumerator))
492 return std::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
495 std::unique_ptr<IPDBEnumSymbols>
497 CComPtr<IDiaEnumSymbols> DiaEnumerator;
498 if (S_OK != Symbol->findInlineFramesByRVA(RVA, &DiaEnumerator))
501 return std::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
504 std::unique_ptr<IPDBEnumSymbols>
506 CComPtr<IDiaEnumSymbols> DiaEnumerator;
507 if (S_OK != Symbol->findInlineFramesByVA(VA, &DiaEnumerator))
510 return std::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
514 CComPtr<IDiaEnumLineNumbers> DiaEnumerator;
515 if (S_OK != Symbol->findInlineeLines(&DiaEnumerator))
518 return std::make_unique<DIAEnumLineNumbers>(DiaEnumerator);
521 std::unique_ptr<IPDBEnumLineNumbers>
524 CComPtr<IDiaEnumLineNumbers> DiaEnumerator;
526 Symbol->findInlineeLinesByAddr(Section, Offset, Length, &DiaEnumerator))
529 return std::make_unique<DIAEnumLineNumbers>(DiaEnumerator);
532 std::unique_ptr<IPDBEnumLineNumbers>
534 CComPtr<IDiaEnumLineNumbers> DiaEnumerator;
535 if (S_OK != Symbol->findInlineeLinesByRVA(RVA, Length, &DiaEnumerator))
538 return std::make_unique<DIAEnumLineNumbers>(DiaEnumerator);
541 std::unique_ptr<IPDBEnumLineNumbers>
543 CComPtr<IDiaEnumLineNumbers> DiaEnumerator;
544 if (S_OK != Symbol->findInlineeLinesByVA(VA, Length, &DiaEnumerator))
547 return std::make_unique<DIAEnumLineNumbers>(DiaEnumerator);
554 Symbol->get_dataBytes(0, &DataSize,
nullptr);
559 Symbol->get_dataBytes(DataSize, &DataSize, bytes.
data());
564 if (S_OK != Symbol->get_undecoratedNameEx((
DWORD)Flags, &Result16))
565 return std::string();
567 const char *SrcBytes =
reinterpret_cast<const char *
>(Result16.m_str);
571 return std::string();
576 return PrivateGetDIAValue<DWORD, PDB_MemberAccess>(Symbol,
577 &IDiaSymbol::get_access);
616 return PrivateGetDIAValue<DWORD, PDB_BuiltinType>(Symbol,
617 &IDiaSymbol::get_baseType);
625 return PrivateGetDIAValue<DWORD, PDB_CallingConv>(
626 Symbol, &IDiaSymbol::get_callingConvention);
653 return PrivateGetDIAValue<DWORD, PDB_Lang>(Symbol, &IDiaSymbol::get_language);
666 &IDiaSymbol::get_liveRangeStartAddressOffset);
671 &IDiaSymbol::get_liveRangeStartAddressSection);
676 Symbol, &IDiaSymbol::get_liveRangeStartRelativeVirtualAddress);
680 return PrivateGetDIAValue<DWORD, codeview::RegisterId>(
681 Symbol, &IDiaSymbol::get_localBasePointerRegisterId);
698 &IDiaSymbol::get_numberOfAcceleratorPointerTags);
734 return PrivateGetDIAValue<DWORD, PDB_Cpu>(Symbol, &IDiaSymbol::get_platform);
742 return PrivateGetDIAValue<DWORD, codeview::RegisterId>(
743 Symbol, &IDiaSymbol::get_registerId);
775 CComPtr<IDiaLineNumber> LineNumber;
776 if (FAILED(Symbol->getSrcLineOnTypeDefn(&LineNumber)) || !LineNumber)
779 return std::make_unique<DIALineNumber>(LineNumber);
804 &IDiaSymbol::get_targetRelativeVirtualAddress);
850 if (S_OK != Symbol->get_value(&Value))
853 return VariantFromVARIANT(Value);
868 std::unique_ptr<PDBSymbolTypeBuiltin>
870 CComPtr<IDiaSymbol> TableType;
871 if (FAILED(Symbol->get_virtualBaseTableType(&TableType)) || !TableType)
874 auto RawVT = std::make_unique<DIARawSymbol>(Session, TableType);
876 PDBSymbol::createAs<PDBSymbolTypePointer>(Session, std::move(RawVT));
881 return PrivateGetDIAValue<DWORD, PDB_DataKind>(Symbol,
882 &IDiaSymbol::get_dataKind);
886 return PrivateGetDIAValue<DWORD, PDB_SymType>(Symbol,
887 &IDiaSymbol::get_symTag);
907 return PrivateGetDIAValue<DWORD, PDB_LocType>(Symbol,
908 &IDiaSymbol::get_locationType);
912 return PrivateGetDIAValue<DWORD, PDB_Machine>(Symbol,
913 &IDiaSymbol::get_machineType);
917 return PrivateGetDIAValue<DWORD, codeview::ThunkOrdinal>(
918 Symbol, &IDiaSymbol::get_thunkOrdinal);
934 return PrivateGetDIAValue<DWORD, PDB_UdtType>(Symbol,
935 &IDiaSymbol::get_udtKind);
1068 &IDiaSymbol::get_isAcceleratorGroupSharedLocal);
1073 &IDiaSymbol::get_isAcceleratorPointerTagLiveRange);
1130 &IDiaSymbol::get_isLocationControlFlowDependent);
1171 &IDiaSymbol::get_isPointerBasedOnSymbolValue);
bool hasAlloca() const override
bool hasInlineAttribute() const override
bool hasNoReturnAttribute() const override
uint32_t getToken() const override
IPDBSession defines an interface used to provide a context for querying debug information from a debu...
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
This class represents lattice values for constants.
int32_t getOffset() const override
void dump(raw_ostream &OS, int Indent, PdbSymbolIdField ShowIdFields, PdbSymbolIdField RecurseIdFields) const override
bool isStatic() const override
codeview::RegisterId getLocalBasePointerRegisterId() const override
uint32_t getNumberOfColumns() const override
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
uint32_t getTargetOffset() const override
LLVM_NODISCARD auto unique_dyn_cast(std::unique_ptr< Y > &Val) -> decltype(cast< X >(Val))
bool hasOptimizedCodeDebugInfo() const override
SymIndexId getClassParentId() const override
#define RAW_ID_METHOD_DUMP(Stream, Method, Session, FieldId, ShowFlags, RecurseFlags)
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
#define RAW_METHOD_DUMP_AS(Stream, Method, Type)
bool isNaked() const override
uint32_t getVirtualBaseDispIndex() const override
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
SymIndexId getBaseSymbolId() const override
SymIndexId getOemSymbolId() const override
std::string getUnused() const override
bool isConstructorVirtualBase() const override
bool getNoStackOrdering() const override
bool isPureVirtual() const override
bool isSdl() const override
SymIndexId getVirtualTableShapeId() 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 getStride() 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
SymIndexId getUnmodifiedTypeId() const override
This represents the 'GUID' type from windows.h.
bool isScoped() const override
SymIndexId getLowerBoundId() 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
SymIndexId getUpperBoundId() const override
PDB_SymType getSymTag() const override
bool isNested() const override
bool isMSILNetmodule() const override
bool isPointerToMemberFunction() const override
uint64_t getLength() const override
SymIndexId getSymIndexId() 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
auto count(R &&Range, const E &Element) -> typename std::iterator_traits< decltype(adl_begin(Range))>::difference_type
Wrapper function around std::count to count the number of times an element Element occurs in the give...
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
ArgType PrivateGetDIAValue(IDiaFrameData *FrameData, HRESULT(__stdcall IDiaFrameData::*Method)(ArgType *))
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 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
void dumpSymbolField(raw_ostream &OS, StringRef Name, T Value, int Indent)
bool isDataAligned() const override
uint64_t getTargetVirtualAddress() const override
bool hasNestedTypes() const override
codeview::GUID getGuid() const override
SymIndexId getLexicalParentId() const override
void dumpSymbolIdField(raw_ostream &OS, StringRef Name, SymIndexId Value, int Indent, const IPDBSession &Session, PdbSymbolIdField FieldId, PdbSymbolIdField ShowFlags, PdbSymbolIdField RecurseFlags)
bool isVirtualBaseClass() const override
bool hasEH() 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::string invokeBstrMethod(Obj &Object, HRESULT(__stdcall Obj::*Func)(BSTR *))
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
SymIndexId getArrayIndexTypeId() 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
SymIndexId getTypeId() 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
SymIndexId getSubTypeId() const override
bool isPointerToDataMember() const override
union llvm::pdb::Variant::@228 Value
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
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
std::error_code access(const Twine &Path, AccessMode Mode)
Can the file be accessed?
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
std::string getObjectFileName() const override
bool isInterfaceUdt() const override
Utility type to build an inheritance chain that makes it easy to rank overload candidates.
bool isReference() const override
PDB_DataKind getDataKind() const override
bool hasInlAsm() 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 getRelativeVirtualAddress() const override