summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
diff options
context:
space:
mode:
authorAaron Smith <aaron.smith@microsoft.com>2018-03-15 06:04:51 +0000
committerAaron Smith <aaron.smith@microsoft.com>2018-03-15 06:04:51 +0000
commit40198f59053d7131ef0f7b4deb8725ab5fc19e29 (patch)
tree955e63933212692ff4d737d4f42789f5b1be1a20 /llvm/lib/DebugInfo
parent9cc222c80de913d62b8a8d16c1c1dcc9665febb0 (diff)
downloadbcm5719-llvm-40198f59053d7131ef0f7b4deb8725ab5fc19e29.tar.gz
bcm5719-llvm-40198f59053d7131ef0f7b4deb8725ab5fc19e29.zip
[DebugInfo] Add a new method IPDBSession::findLineNumbersBySectOffset
Summary: Some PDB symbols do not have a valid VA or RVA but have Addr by Section and Offset. For example, a variable in thread-local storage has the following properties: get_addressOffset: 0 get_addressSection: 5 get_lexicalParentId: 2 get_name: g_tls get_symIndexId: 12 get_typeId: 4 get_dataKind: 6 get_symTag: 7 get_locationType: 2 This change provides a new method to locate line numbers by Section and Offset from those symbols. Reviewers: zturner, rnk, llvm-commits Subscribers: asmith, JDevlieghere Differential Revision: https://reviews.llvm.org/D44407 llvm-svn: 327601
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r--llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp17
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp6
2 files changed, 22 insertions, 1 deletions
diff --git a/llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp b/llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp
index a6bbf6f9e4f..3a4ecdba6b1 100644
--- a/llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp
+++ b/llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp
@@ -210,7 +210,22 @@ DIASession::findLineNumbers(const PDBSymbolCompiland &Compiland,
std::unique_ptr<IPDBEnumLineNumbers>
DIASession::findLineNumbersByAddress(uint64_t Address, uint32_t Length) const {
CComPtr<IDiaEnumLineNumbers> 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<DWORD>(Address - LoadAddr);
+ if (S_OK != Session->findLinesByRVA(RVA, Length, &LineNumbers))
+ return nullptr;
+ }
+ return llvm::make_unique<DIAEnumLineNumbers>(LineNumbers);
+}
+
+std::unique_ptr<IPDBEnumLineNumbers>
+DIASession::findLineNumbersBySectOffset(uint32_t Section, uint32_t Offset,
+ uint32_t Length) const {
+ CComPtr<IDiaEnumLineNumbers> LineNumbers;
+ if (S_OK != Session->findLinesByAddr(Section, Offset, Length, &LineNumbers))
return nullptr;
return llvm::make_unique<DIAEnumLineNumbers>(LineNumbers);
diff --git a/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp b/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp
index 481eb7766f5..c4d188ee337 100644
--- a/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp
@@ -202,6 +202,12 @@ NativeSession::findLineNumbersByAddress(uint64_t Address,
return nullptr;
}
+std::unique_ptr<IPDBEnumLineNumbers>
+NativeSession::findLineNumbersBySectOffset(uint32_t Section, uint32_t Offset,
+ uint32_t Length) const {
+ return nullptr;
+}
+
std::unique_ptr<IPDBEnumSourceFiles>
NativeSession::findSourceFiles(const PDBSymbolCompiland *Compiland,
StringRef Pattern,
OpenPOWER on IntegriCloud