Index: llvm/trunk/include/llvm/DebugInfo/PDB/DIA/DIASession.h =================================================================== --- llvm/trunk/include/llvm/DebugInfo/PDB/DIA/DIASession.h +++ llvm/trunk/include/llvm/DebugInfo/PDB/DIA/DIASession.h @@ -42,6 +42,9 @@ const IPDBSourceFile &File) const override; std::unique_ptr findLineNumbersByAddress(uint64_t Address, uint32_t Length) const override; + std::unique_ptr + findLineNumbersBySectOffset(uint32_t Section, uint32_t Offset, + uint32_t Length) const override; std::unique_ptr findSourceFiles(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern, Index: llvm/trunk/include/llvm/DebugInfo/PDB/IPDBSession.h =================================================================== --- llvm/trunk/include/llvm/DebugInfo/PDB/IPDBSession.h +++ llvm/trunk/include/llvm/DebugInfo/PDB/IPDBSession.h @@ -45,6 +45,9 @@ const IPDBSourceFile &File) const = 0; virtual std::unique_ptr findLineNumbersByAddress(uint64_t Address, uint32_t Length) const = 0; + virtual std::unique_ptr + findLineNumbersBySectOffset(uint32_t Section, uint32_t Offset, + uint32_t Length) const = 0; virtual std::unique_ptr findSourceFiles(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern, Index: llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeSession.h =================================================================== --- llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeSession.h +++ llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeSession.h @@ -61,6 +61,9 @@ const IPDBSourceFile &File) const override; std::unique_ptr findLineNumbersByAddress(uint64_t Address, uint32_t Length) const override; + std::unique_ptr + findLineNumbersBySectOffset(uint32_t Section, uint32_t Offset, + uint32_t Length) const override; std::unique_ptr findSourceFiles(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern, Index: llvm/trunk/lib/DebugInfo/PDB/DIA/DIASession.cpp =================================================================== --- llvm/trunk/lib/DebugInfo/PDB/DIA/DIASession.cpp +++ llvm/trunk/lib/DebugInfo/PDB/DIA/DIASession.cpp @@ -210,7 +210,22 @@ std::unique_ptr DIASession::findLineNumbersByAddress(uint64_t Address, uint32_t Length) const { CComPtr LineNumbers; - if (S_OK != Session->findLinesByVA(Address, Length, &LineNumbers)) + if (S_OK != Session->findLinesByVA(Address, Length, &LineNumbers)) { + ULONGLONG LoadAddr = 0; + if (S_OK != Session->get_loadAddress(&LoadAddr)) + return nullptr; + DWORD RVA = static_cast(Address - LoadAddr); + if (S_OK != Session->findLinesByRVA(RVA, Length, &LineNumbers)) + return nullptr; + } + return llvm::make_unique(LineNumbers); +} + +std::unique_ptr +DIASession::findLineNumbersBySectOffset(uint32_t Section, uint32_t Offset, + uint32_t Length) const { + CComPtr LineNumbers; + if (S_OK != Session->findLinesByAddr(Section, Offset, Length, &LineNumbers)) return nullptr; return llvm::make_unique(LineNumbers); Index: llvm/trunk/lib/DebugInfo/PDB/Native/NativeSession.cpp =================================================================== --- llvm/trunk/lib/DebugInfo/PDB/Native/NativeSession.cpp +++ llvm/trunk/lib/DebugInfo/PDB/Native/NativeSession.cpp @@ -202,6 +202,12 @@ return nullptr; } +std::unique_ptr +NativeSession::findLineNumbersBySectOffset(uint32_t Section, uint32_t Offset, + uint32_t Length) const { + return nullptr; +} + std::unique_ptr NativeSession::findSourceFiles(const PDBSymbolCompiland *Compiland, StringRef Pattern, Index: llvm/trunk/unittests/DebugInfo/PDB/PDBApiTest.cpp =================================================================== --- llvm/trunk/unittests/DebugInfo/PDB/PDBApiTest.cpp +++ llvm/trunk/unittests/DebugInfo/PDB/PDBApiTest.cpp @@ -88,6 +88,11 @@ findLineNumbersByAddress(uint64_t Address, uint32_t Length) const override { return nullptr; } + std::unique_ptr + findLineNumbersBySectOffset(uint32_t Section, uint32_t Offset, + uint32_t Length) const override { + return nullptr; + } std::unique_ptr findSourceFiles(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const override {