Index: include/llvm/DebugInfo/PDB/DIA/DIARawSymbol.h =================================================================== --- include/llvm/DebugInfo/PDB/DIA/DIARawSymbol.h +++ include/llvm/DebugInfo/PDB/DIA/DIARawSymbol.h @@ -30,10 +30,31 @@ findChildren(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags) const override; std::unique_ptr + findChildrenByAddr(PDB_SymType Type, StringRef Name, + PDB_NameSearchFlags Flags, + uint32_t Section, uint32_t Offset) const override; + std::unique_ptr + findChildrenByVA(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags, + uint64_t VA) const override; + std::unique_ptr findChildrenByRVA(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags, uint32_t RVA) const override; + + std::unique_ptr + findInlineFramesByAddr(uint32_t Section, uint32_t Offset) const override; std::unique_ptr findInlineFramesByRVA(uint32_t RVA) const override; + std::unique_ptr + findInlineFramesByVA(uint64_t VA) const override; + + std::unique_ptr findInlineeLines() const override; + std::unique_ptr + findInlineeLinesByAddr(uint32_t Section, uint32_t Offset, + uint32_t Length) const override; + std::unique_ptr + findInlineeLinesByRVA(uint32_t RVA, uint32_t Length) const override; + std::unique_ptr + findInlineeLinesByVA(uint64_t VA, uint32_t Length) const override; void getDataBytes(llvm::SmallVector &bytes) const override; void getFrontEndVersion(VersionInfo &Version) const override; Index: include/llvm/DebugInfo/PDB/IPDBRawSymbol.h =================================================================== --- include/llvm/DebugInfo/PDB/IPDBRawSymbol.h +++ include/llvm/DebugInfo/PDB/IPDBRawSymbol.h @@ -42,10 +42,31 @@ findChildren(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags) const = 0; virtual std::unique_ptr + findChildrenByAddr(PDB_SymType Type, StringRef Name, + PDB_NameSearchFlags Flags, + uint32_t Section, uint32_t Offset) const = 0; + virtual std::unique_ptr + findChildrenByVA(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags, + uint64_t VA) const = 0; + virtual std::unique_ptr findChildrenByRVA(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags, uint32_t RVA) const = 0; + + virtual std::unique_ptr + findInlineFramesByAddr(uint32_t Section, uint32_t Offset) const = 0; virtual std::unique_ptr findInlineFramesByRVA(uint32_t RVA) const = 0; + virtual std::unique_ptr + findInlineFramesByVA(uint64_t VA) const = 0; + + virtual std::unique_ptr findInlineeLines() const = 0; + virtual std::unique_ptr + findInlineeLinesByAddr(uint32_t Section, uint32_t Offset, + uint32_t Length) const = 0; + virtual std::unique_ptr + findInlineeLinesByRVA(uint32_t RVA, uint32_t Length) const = 0; + virtual std::unique_ptr + findInlineeLinesByVA(uint64_t VA, uint32_t Length) const = 0; virtual void getDataBytes(llvm::SmallVector &bytes) const = 0; virtual void getBackEndVersion(VersionInfo &Version) const = 0; Index: include/llvm/DebugInfo/PDB/Native/NativeRawSymbol.h =================================================================== --- include/llvm/DebugInfo/PDB/Native/NativeRawSymbol.h +++ include/llvm/DebugInfo/PDB/Native/NativeRawSymbol.h @@ -35,10 +35,31 @@ findChildren(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags) const override; std::unique_ptr + findChildrenByAddr(PDB_SymType Type, StringRef Name, + PDB_NameSearchFlags Flags, + uint32_t Section, uint32_t Offset) const override; + std::unique_ptr + findChildrenByVA(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags, + uint64_t VA) const override; + std::unique_ptr findChildrenByRVA(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags, uint32_t RVA) const override; + + std::unique_ptr + findInlineFramesByAddr(uint32_t Section, uint32_t Offset) const override; std::unique_ptr findInlineFramesByRVA(uint32_t RVA) const override; + std::unique_ptr + findInlineFramesByVA(uint64_t VA) const override; + + std::unique_ptr findInlineeLines() const override; + std::unique_ptr + findInlineeLinesByAddr(uint32_t Section, uint32_t Offset, + uint32_t Length) const override; + std::unique_ptr + findInlineeLinesByRVA(uint32_t RVA, uint32_t Length) const override; + std::unique_ptr + findInlineeLinesByVA(uint64_t VA, uint32_t Length) const override; void getDataBytes(SmallVector &Bytes) const override; void getFrontEndVersion(VersionInfo &Version) const override; Index: lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp =================================================================== --- lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp +++ lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp @@ -400,6 +400,47 @@ } std::unique_ptr +DIARawSymbol::findChildrenByAddr(PDB_SymType Type, StringRef Name, + PDB_NameSearchFlags Flags, uint32_t Section, + uint32_t Offset) const { + llvm::SmallVector Name16; + llvm::convertUTF8ToUTF16String(Name, Name16); + + enum SymTagEnum EnumVal = static_cast(Type); + + DWORD CompareFlags = static_cast(Flags); + wchar_t *Name16Str = reinterpret_cast(Name16.data()); + + CComPtr DiaEnumerator; + if (S_OK != + Symbol->findChildrenExByAddr(EnumVal, Name16Str, CompareFlags, Section, + Offset, &DiaEnumerator)) + return nullptr; + + return llvm::make_unique(Session, DiaEnumerator); +} + +std::unique_ptr +DIARawSymbol::findChildrenByVA(PDB_SymType Type, StringRef Name, + PDB_NameSearchFlags Flags, uint64_t VA) const { + llvm::SmallVector Name16; + llvm::convertUTF8ToUTF16String(Name, Name16); + + enum SymTagEnum EnumVal = static_cast(Type); + + DWORD CompareFlags = static_cast(Flags); + wchar_t *Name16Str = reinterpret_cast(Name16.data()); + + CComPtr DiaEnumerator; + if (S_OK != + Symbol->findChildrenExByVA(EnumVal, Name16Str, CompareFlags, VA, + &DiaEnumerator)) + return nullptr; + + return llvm::make_unique(Session, DiaEnumerator); +} + +std::unique_ptr DIARawSymbol::findChildrenByRVA(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags, uint32_t RVA) const { llvm::SmallVector Name16; @@ -419,6 +460,15 @@ } std::unique_ptr +DIARawSymbol::findInlineFramesByAddr(uint32_t Section, uint32_t Offset) const { + CComPtr DiaEnumerator; + if (S_OK != Symbol->findInlineFramesByAddr(Section, Offset, &DiaEnumerator)) + return nullptr; + + return llvm::make_unique(Session, DiaEnumerator); +} + +std::unique_ptr DIARawSymbol::findInlineFramesByRVA(uint32_t RVA) const { CComPtr DiaEnumerator; if (S_OK != Symbol->findInlineFramesByRVA(RVA, &DiaEnumerator)) @@ -427,6 +477,51 @@ return llvm::make_unique(Session, DiaEnumerator); } +std::unique_ptr +DIARawSymbol::findInlineFramesByVA(uint64_t VA) const { + CComPtr DiaEnumerator; + if (S_OK != Symbol->findInlineFramesByVA(VA, &DiaEnumerator)) + return nullptr; + + return llvm::make_unique(Session, DiaEnumerator); +} + +std::unique_ptr DIARawSymbol::findInlineeLines() const { + CComPtr DiaEnumerator; + if (S_OK != Symbol->findInlineeLines(&DiaEnumerator)) + return nullptr; + + return llvm::make_unique(DiaEnumerator); +} + +std::unique_ptr +DIARawSymbol::findInlineeLinesByAddr(uint32_t Section, uint32_t Offset, + uint32_t Length) const { + CComPtr DiaEnumerator; + if (S_OK != Symbol->findInlineeLinesByAddr(Section, Offset, Length, &DiaEnumerator)) + return nullptr; + + return llvm::make_unique(DiaEnumerator); +} + +std::unique_ptr +DIARawSymbol::findInlineeLinesByRVA(uint32_t RVA, uint32_t Length) const { + CComPtr DiaEnumerator; + if (S_OK != Symbol->findInlineeLinesByRVA(RVA, Length, &DiaEnumerator)) + return nullptr; + + return llvm::make_unique(DiaEnumerator); +} + +std::unique_ptr +DIARawSymbol::findInlineeLinesByVA(uint64_t VA, uint32_t Length) const { + CComPtr DiaEnumerator; + if (S_OK != Symbol->findInlineeLinesByVA(VA, Length, &DiaEnumerator)) + return nullptr; + + return llvm::make_unique(DiaEnumerator); +} + void DIARawSymbol::getDataBytes(llvm::SmallVector &bytes) const { bytes.clear(); Index: lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp =================================================================== --- lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp +++ lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp @@ -30,16 +30,60 @@ } std::unique_ptr +NativeRawSymbol::findChildrenByAddr(PDB_SymType Type, StringRef Name, + PDB_NameSearchFlags Flags, uint32_t Section, uint32_t Offset) const { + return nullptr; +} + +std::unique_ptr +NativeRawSymbol::findChildrenByVA(PDB_SymType Type, StringRef Name, + PDB_NameSearchFlags Flags, uint64_t VA) const { + return nullptr; +} + +std::unique_ptr NativeRawSymbol::findChildrenByRVA(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags, uint32_t RVA) const { return nullptr; } std::unique_ptr +NativeRawSymbol::findInlineFramesByAddr(uint32_t Section, + uint32_t Offset) const { + return nullptr; +} + +std::unique_ptr NativeRawSymbol::findInlineFramesByRVA(uint32_t RVA) const { return nullptr; } +std::unique_ptr +NativeRawSymbol::findInlineFramesByVA(uint64_t VA) const { + return nullptr; +} + +std::unique_ptr +NativeRawSymbol::findInlineeLines() const { + return nullptr; +} + +std::unique_ptr +NativeRawSymbol::findInlineeLinesByAddr(uint32_t Section, uint32_t Offset, + uint32_t Length) const { + return nullptr; +} + +std::unique_ptr +NativeRawSymbol::findInlineeLinesByRVA(uint32_t RVA, uint32_t Length) const { + return nullptr; +} + +std::unique_ptr +NativeRawSymbol::findInlineeLinesByVA(uint64_t VA, uint32_t Length) const { + return nullptr; +} + void NativeRawSymbol::getDataBytes(SmallVector &bytes) const { bytes.clear(); } Index: unittests/DebugInfo/PDB/PDBApiTest.cpp =================================================================== --- unittests/DebugInfo/PDB/PDBApiTest.cpp +++ unittests/DebugInfo/PDB/PDBApiTest.cpp @@ -142,14 +142,48 @@ return nullptr; } std::unique_ptr + findChildrenByAddr(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags, + uint32_t Section, uint32_t Offset) const { + return nullptr; + } + std::unique_ptr + findChildrenByVA(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags, + uint64_t VA) const override { + return nullptr; + } + std::unique_ptr findChildrenByRVA(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags, uint32_t RVA) const override { return nullptr; } std::unique_ptr + findInlineFramesByAddr(uint32_t Section, uint32_t Offset) const override { + return nullptr; + } + std::unique_ptr findInlineFramesByRVA(uint32_t RVA) const override { return nullptr; } + std::unique_ptr + findInlineFramesByVA(uint64_t VA) const override { + return nullptr; + } + std::unique_ptr findInlineeLines() const override { + return nullptr; + } + std::unique_ptr + findInlineeLinesByAddr(uint32_t Section, uint32_t Offset, + uint32_t Length) const override { + return nullptr; + } + std::unique_ptr + findInlineeLinesByRVA(uint32_t RVA, uint32_t Length) const override { + return nullptr; + } + std::unique_ptr + findInlineeLinesByVA(uint64_t VA, uint32_t Length) const override { + return nullptr; + } void getDataBytes(llvm::SmallVector &bytes) const override {} void getFrontEndVersion(VersionInfo &Version) const override {}