30Variant VariantFromVARIANT(
const VARIANT &V) {
35 Result.Type = PDB_VariantType::Int8;
39 Result.Type = PDB_VariantType::Int16;
43 Result.Type = PDB_VariantType::Int32;
47 Result.Type = PDB_VariantType::Int64;
51 Result.Type = PDB_VariantType::UInt8;
55 Result.Type = PDB_VariantType::UInt16;
58 Result.Value.UInt32 =
V.uintVal;
59 Result.Type = PDB_VariantType::UInt32;
63 Result.Type = PDB_VariantType::UInt64;
66 Result.Value.Bool = (
V.boolVal == VARIANT_TRUE) ?
true :
false;
67 Result.Type = PDB_VariantType::Bool;
71 Result.Type = PDB_VariantType::Single;
75 Result.Type = PDB_VariantType::Double;
78 const char *SrcBytes =
reinterpret_cast<const char *
>(
V.bstrVal);
82 Result.Value.String =
nullptr;
83 Result.Value.String =
new char[Result8.length() + 1];
84 ::strcpy(
Result.Value.String, Result8.c_str());
85 Result.Type = PDB_VariantType::String;
89 Result.Type = PDB_VariantType::Unknown;
95template <
typename ArgType>
97 HRESULT (__stdcall IDiaSymbol::*Method)(ArgType *)) {
100 return static_cast<ArgType
>(
Value);
105template <
typename ArgType,
typename RetType>
107 HRESULT (__stdcall IDiaSymbol::*Method)(ArgType *)) {
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));
135template <
typename Pr
intType,
typename ArgType>
138 HRESULT (__stdcall IDiaSymbol::*Method)(ArgType *)) {
146 HRESULT (__stdcall IDiaSymbol::*Method)(DWORD *),
155template <
typename ArgType>
158 HRESULT (__stdcall IDiaSymbol::*Method)(ArgType *)) {
166 HRESULT (__stdcall IDiaSymbol::*Method)(
BSTR *)) {
170 const char *Bytes =
reinterpret_cast<const char *
>(
Value);
175 ::SysFreeString(
Value);
180 HRESULT (__stdcall IDiaSymbol::*Method)(VARIANT *)) {
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);
397std::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);
411std::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);
429std::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);
449std::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);
468std::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);
486std::unique_ptr<IPDBEnumSymbols>
488 CComPtr<IDiaEnumSymbols> DiaEnumerator;
489 if (S_OK != Symbol->findInlineFramesByAddr(Section,
Offset, &DiaEnumerator))
492 return std::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
495std::unique_ptr<IPDBEnumSymbols>
497 CComPtr<IDiaEnumSymbols> DiaEnumerator;
498 if (S_OK != Symbol->findInlineFramesByRVA(RVA, &DiaEnumerator))
501 return std::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
504std::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);
521std::unique_ptr<IPDBEnumLineNumbers>
524 CComPtr<IDiaEnumLineNumbers> DiaEnumerator;
526 Symbol->findInlineeLinesByAddr(Section,
Offset,
Length, &DiaEnumerator))
529 return std::make_unique<DIAEnumLineNumbers>(DiaEnumerator);
532std::unique_ptr<IPDBEnumLineNumbers>
534 CComPtr<IDiaEnumLineNumbers> DiaEnumerator;
535 if (S_OK != Symbol->findInlineeLinesByRVA(RVA,
Length, &DiaEnumerator))
538 return std::make_unique<DIAEnumLineNumbers>(DiaEnumerator);
541std::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);
868std::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));
877 return unique_dyn_cast<PDBSymbolTypeBuiltin>(Pointer->getPointeeType());
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);
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
ArgType PrivateGetDIAValue(IDiaFrameData *FrameData, HRESULT(__stdcall IDiaFrameData::*Method)(ArgType *))
#define RAW_METHOD_DUMP_AS(Stream, Method, Type)
#define RAW_METHOD_DUMP(Stream, Method)
#define RAW_ID_METHOD_DUMP(Stream, Method, Session, FieldId, ShowFlags, RecurseFlags)
std::string invokeBstrMethod(Obj &Object, HRESULT(__stdcall Obj::*Func)(BSTR *))
Performs the initial survey of the specified function
Given that RA is a live value
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
pointer data()
Return a pointer to the vector's buffer, even if empty().
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
uint32_t getNumberOfModifiers() const override
bool isDataAligned() const override
bool isCxxReturnUdt() const override
bool hasOptimizedCodeDebugInfo() const override
bool isScoped() const override
std::unique_ptr< IPDBEnumSymbols > findChildrenByVA(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags, uint64_t VA) const override
SymIndexId getUpperBoundId() const override
bool hasInterruptReturn() const override
bool isStatic() const override
uint32_t getTextureSlot() const override
uint32_t getVirtualBaseDispIndex() const override
uint32_t getAddressOffset() const override
std::unique_ptr< IPDBEnumLineNumbers > findInlineeLines() const override
void getFrontEndVersion(VersionInfo &Version) const override
SymIndexId getTypeId() const override
bool hasEHa() const override
std::string getUndecoratedNameEx(PDB_UndnameFlags Flags) const override
bool isCVTCIL() const override
std::unique_ptr< IPDBEnumLineNumbers > findInlineeLinesByRVA(uint32_t RVA, uint32_t Length) const override
bool isOptimizedAway() const override
bool isVolatileType() const override
bool isInterfaceUdt() const override
bool isEditAndContinueEnabled() const override
Variant getValue() const override
uint32_t getSignature() const override
bool isUnalignedType() const override
std::string getName() const override
bool hasLongJump() const override
bool hasCustomCallingConvention() const override
PDB_DataKind getDataKind() const override
PDB_Cpu getPlatform() const override
uint32_t getCountLiveRanges() const override
bool isHotpatchable() const override
bool isReturnValue() const override
uint32_t getBaseDataOffset() const override
PDB_MemberAccess getAccess() const override
std::unique_ptr< IPDBEnumSymbols > findChildrenByAddr(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags, uint32_t Section, uint32_t Offset) const override
int32_t getThisAdjust() const override
bool isIntroVirtualFunction() const override
bool isAcceleratorGroupSharedLocal() const override
bool hasNoReturnAttribute() const override
SymIndexId getLowerBoundId() const override
bool hasNestedTypes() const override
bool hasCTypes() const override
std::string getSymbolsFileName() const override
uint32_t getNumberOfRows() const override
std::unique_ptr< IPDBEnumSymbols > findInlineFramesByAddr(uint32_t Section, uint32_t Offset) const override
PDB_Lang getLanguage() const override
bool wasInlined() const override
uint32_t getLiveRangeStartAddressSection() const override
bool isPacked() const override
bool getNoStackOrdering() const override
uint32_t getAge() const override
void getBackEndVersion(VersionInfo &Version) const override
uint32_t getSizeInUdt() const override
bool isLocationControlFlowDependent() const override
PDB_CallingConv getCallingConvention() const override
std::string getUndecoratedName() const override
uint32_t getTargetRelativeVirtualAddress() const override
SymIndexId getArrayIndexTypeId() const override
DIARawSymbol(const DIASession &PDBSession, CComPtr< IDiaSymbol > DiaSymbol)
bool isReference() const override
bool isMultipleInheritance() const override
bool isAggregated() const override
bool isConstructorVirtualBase() const override
bool isSplitted() const override
uint32_t getRegisterType() const override
uint32_t getOffsetInUdt() const override
uint32_t getRelativeVirtualAddress() const override
std::unique_ptr< IPDBEnumLineNumbers > findInlineeLinesByAddr(uint32_t Section, uint32_t Offset, uint32_t Length) const override
PDB_UdtType getUdtKind() const override
bool isCompilerGenerated() const override
bool isIntrinsic() const override
bool isManagedCode() const override
bool isMSILNetmodule() const override
bool hasEH() const override
bool hasConstructor() const override
bool isVirtualInheritance() const override
uint32_t getNumberOfColumns() const override
uint64_t getTargetVirtualAddress() const override
PDB_SymType getSymTag() const override
std::unique_ptr< IPDBEnumSymbols > findInlineFramesByVA(uint64_t VA) const override
bool isNested() const override
bool isVirtual() const override
SymIndexId getVirtualTableShapeId() const override
bool isCode() const override
std::string getUnused() const override
bool isFunction() const override
int32_t getOffset() const override
bool hasAlloca() const override
std::string getCompilerName() const override
bool isAcceleratorStubFunction() const override
SymIndexId getBaseSymbolId() const override
bool hasNoInlineAttribute() const override
bool isSdl() const override
SymIndexId getUnmodifiedTypeId() const override
bool hasStrictGSCheck() const override
codeview::GUID getGuid() const override
uint32_t getNumberOfRegisterIndices() const override
bool hasSEH() const override
uint32_t getVirtualBaseOffset() const override
std::string getSourceFileName() const override
bool isUnreached() const override
SymIndexId getSubTypeId() const override
bool hasOverloadedOperator() const override
std::unique_ptr< IPDBLineNumber > getSrcLineOnTypeDefn() const override
uint32_t getBitPosition() const override
bool isPointerBasedOnSymbolValue() const override
uint32_t getSlot() const override
uint32_t getMemorySpaceKind() const override
uint32_t getUavSlot() const override
std::unique_ptr< IPDBEnumSymbols > findInlineFramesByRVA(uint32_t RVA) const override
bool hasInlAsm() const override
uint32_t getOemId() const override
bool isRefUdt() const override
uint32_t getTimeStamp() const override
bool isSafeBuffers() const override
bool isPointerToDataMember() const override
SymIndexId getOemSymbolId() const override
bool isPureVirtual() const override
bool isValueUdt() const override
uint32_t getSamplerSlot() const override
bool isLTCG() const override
bool isNaked() const override
codeview::RegisterId getRegisterId() const override
bool isSingleInheritance() const override
bool isHLSLData() const override
bool hasSetJump() const override
uint32_t getLiveRangeStartAddressOffset() const override
uint32_t getStride() const override
uint32_t getRank() const override
bool isIndirectVirtualBaseClass() const override
bool hasFarReturn() const override
uint32_t getNumberOfAcceleratorPointerTags() const override
uint32_t getAddressSection() const override
bool isConstType() const override
uint64_t getLength() const override
std::unique_ptr< IPDBEnumSymbols > findChildrenByRVA(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags, uint32_t RVA) const override
bool isPointerToMemberFunction() const override
PDB_BuiltinType getBuiltinType() const override
std::unique_ptr< IPDBEnumSymbols > findChildren(PDB_SymType Type) const override
SymIndexId getClassParentId() const override
bool isAcceleratorPointerTagLiveRange() const override
bool isVirtualBaseClass() const override
bool isRestrictedType() const override
bool hasDebugInfo() const override
codeview::RegisterId getLocalBasePointerRegisterId() const override
SymIndexId getSymIndexId() const override
std::string getObjectFileName() const override
uint64_t getLiveRangeLength() const override
bool hasFramePointer() const override
bool hasManagedCode() const override
PDB_LocType getLocationType() const override
bool hasCastOperator() const override
bool isMatrixRowMajor() const override
uint32_t getToken() const override
bool hasPrivateSymbols() const override
uint32_t getBaseDataSlot() const override
SymIndexId getLexicalParentId() const override
int32_t getVirtualBasePointerOffset() const override
bool getAddressTaken() const override
uint32_t getLiveRangeStartRelativeVirtualAddress() const override
void getDataBytes(llvm::SmallVector< uint8_t, 32 > &bytes) const override
bool isMSILCode() const override
std::string getLibraryName() const override
bool hasInlineAttribute() const override
bool hasAssignmentOperator() const override
uint64_t getVirtualAddress() const override
uint32_t getCount() const override
codeview::ThunkOrdinal getThunkOrdinal() const override
uint32_t getTargetSection() const override
PDB_Machine getMachineType() const override
std::unique_ptr< PDBSymbolTypeBuiltin > getVirtualBaseTableType() const override
bool hasSecurityChecks() const override
uint32_t getTargetOffset() const override
bool isRValueReference() const override
void dump(raw_ostream &OS, int Indent, PdbSymbolIdField ShowIdFields, PdbSymbolIdField RecurseIdFields) const override
std::unique_ptr< IPDBEnumLineNumbers > findInlineeLinesByVA(uint64_t VA, uint32_t Length) const override
IPDBSession defines an interface used to provide a context for querying debug information from a debu...
This class implements an extremely fast bulk output stream that can only output to a stream.
CPUType
These values correspond to the CV_CPU_TYPE_e enumeration, and are documented here: https://msdn....
CallingConvention
These values correspond to the CV_call_e enumeration, and are documented at the following locations: ...
ThunkOrdinal
These values correspond to the THUNK_ORDINAL enumeration.
SourceLanguage
These values correspond to the CV_CFL_LANG enumeration in the Microsoft Debug Interface Access SDK,...
PDB_NameSearchFlags
Defines flags used for enumerating child symbols.
void dumpSymbolField(raw_ostream &OS, StringRef Name, T Value, int Indent)
PDB_BuiltinType
These values correspond to the Basictype enumeration, and are documented here: https://msdn....
PDB_UdtType
These values correspond to the UdtKind enumeration, and are documented here: https://msdn....
PDB_SymType
These values correspond to the SymTagEnum enumeration, and are documented here: https://msdn....
PDB_LocType
These values correspond to the LocationType enumeration, and are documented here: https://msdn....
PDB_DataKind
These values correspond to the DataKind enumeration, and are documented here: https://msdn....
PDB_UndnameFlags
These values correspond to the flags that can be combined to control the return of an undecorated nam...
void dumpSymbolIdField(raw_ostream &OS, StringRef Name, SymIndexId Value, int Indent, const IPDBSession &Session, PdbSymbolIdField FieldId, PdbSymbolIdField ShowFlags, PdbSymbolIdField RecurseFlags)
This is an optimization pass for GlobalISel generic memory operations.
bool convertUTF16ToUTF8String(ArrayRef< char > SrcBytes, std::string &Out)
Converts a stream of raw bytes assumed to be UTF16 into a UTF8 std::string.
auto count(R &&Range, const E &Element)
Wrapper function around std::count to count the number of times an element Element occurs in the give...
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
bool convertUTF8ToUTF16String(StringRef SrcUTF8, SmallVectorImpl< UTF16 > &DstUTF16)
Converts a UTF-8 string into a UTF-16 string with native endianness.
This represents the 'GUID' type from windows.h.
Utility type to build an inheritance chain that makes it easy to rank overload candidates.