diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp | 39 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp | 11 |
2 files changed, 41 insertions, 9 deletions
diff --git a/llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp b/llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp index afbfdeab31b..d81f59400eb 100644 --- a/llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp +++ b/llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp @@ -106,7 +106,7 @@ Error DIASession::createFromPdb(StringRef Path, if (!llvm::convertUTF8ToUTF16String(Path, Path16)) return make_error<GenericError>(generic_error_code::invalid_path); - const wchar_t *Path16Str = reinterpret_cast<const wchar_t*>(Path16.data()); + const wchar_t *Path16Str = reinterpret_cast<const wchar_t *>(Path16.data()); HRESULT HR; if (FAILED(HR = DiaDataSource->loadDataFromPdb(Path16Str))) { return ErrorFromHResult(HR, "Calling loadDataFromPdb {0}", Path); @@ -214,6 +214,31 @@ DIASession::findSymbolByAddress(uint64_t Address, PDB_SymType Type) const { return PDBSymbol::create(*this, std::move(RawSymbol)); } +std::unique_ptr<PDBSymbol> DIASession::findSymbolByRVA(uint32_t RVA, + PDB_SymType Type) const { + enum SymTagEnum EnumVal = static_cast<enum SymTagEnum>(Type); + + CComPtr<IDiaSymbol> Symbol; + if (S_OK != Session->findSymbolByRVA(RVA, EnumVal, &Symbol)) + return nullptr; + + auto RawSymbol = llvm::make_unique<DIARawSymbol>(*this, Symbol); + return PDBSymbol::create(*this, std::move(RawSymbol)); +} + +std::unique_ptr<PDBSymbol> +DIASession::findSymbolBySectOffset(uint32_t Sect, uint32_t Offset, + PDB_SymType Type) const { + enum SymTagEnum EnumVal = static_cast<enum SymTagEnum>(Type); + + CComPtr<IDiaSymbol> Symbol; + if (S_OK != Session->findSymbolByAddr(Sect, Offset, EnumVal, &Symbol)) + return nullptr; + + auto RawSymbol = llvm::make_unique<DIARawSymbol>(*this, Symbol); + return PDBSymbol::create(*this, std::move(RawSymbol)); +} + std::unique_ptr<IPDBEnumLineNumbers> DIASession::findLineNumbers(const PDBSymbolCompiland &Compiland, const IPDBSourceFile &File) const { @@ -222,9 +247,8 @@ DIASession::findLineNumbers(const PDBSymbolCompiland &Compiland, const DIASourceFile &RawFile = static_cast<const DIASourceFile &>(File); CComPtr<IDiaEnumLineNumbers> LineNumbers; - if (S_OK != - Session->findLines(RawCompiland.getDiaSymbol(), RawFile.getDiaFile(), - &LineNumbers)) + if (S_OK != Session->findLines(RawCompiland.getDiaSymbol(), + RawFile.getDiaFile(), &LineNumbers)) return nullptr; return llvm::make_unique<DIAEnumLineNumbers>(LineNumbers); @@ -359,9 +383,7 @@ std::unique_ptr<IPDBEnumTables> DIASession::getEnumTables() const { return llvm::make_unique<DIAEnumTables>(DiaEnumerator); } -template <class T> -static CComPtr<T> -getTableEnumerator(IDiaSession &Session) { +template <class T> static CComPtr<T> getTableEnumerator(IDiaSession &Session) { CComPtr<T> Enumerator; CComPtr<IDiaEnumTables> ET; CComPtr<IDiaTable> Table; @@ -372,8 +394,7 @@ getTableEnumerator(IDiaSession &Session) { while (ET->Next(1, &Table, &Count) == S_OK && Count == 1) { // There is only one table that matches the given iid - if (S_OK == - Table->QueryInterface(__uuidof(T), (void **)&Enumerator)) + if (S_OK == Table->QueryInterface(__uuidof(T), (void **)&Enumerator)) break; Table.Release(); } diff --git a/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp b/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp index 37b1a9167a5..086da13135c 100644 --- a/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp @@ -200,6 +200,17 @@ NativeSession::findSymbolByAddress(uint64_t Address, PDB_SymType Type) const { return nullptr; } +std::unique_ptr<PDBSymbol> +NativeSession::findSymbolByRVA(uint32_t RVA, PDB_SymType Type) const { + return nullptr; +} + +std::unique_ptr<PDBSymbol> +NativeSession::findSymbolBySectOffset(uint32_t Sect, uint32_t Offset, + PDB_SymType Type) const { + return nullptr; +} + std::unique_ptr<IPDBEnumLineNumbers> NativeSession::findLineNumbers(const PDBSymbolCompiland &Compiland, const IPDBSourceFile &File) const { |