summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/DebugInfo/PDB/DIA/DIASession.h9
-rw-r--r--llvm/include/llvm/DebugInfo/PDB/IPDBSession.h9
-rw-r--r--llvm/include/llvm/DebugInfo/PDB/Native/NativeSession.h9
-rw-r--r--llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp22
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp10
-rw-r--r--llvm/unittests/DebugInfo/PDB/PDBApiTest.cpp10
6 files changed, 61 insertions, 8 deletions
diff --git a/llvm/include/llvm/DebugInfo/PDB/DIA/DIASession.h b/llvm/include/llvm/DebugInfo/PDB/DIA/DIASession.h
index a6c0a2b1956..517acf93c21 100644
--- a/llvm/include/llvm/DebugInfo/PDB/DIA/DIASession.h
+++ b/llvm/include/llvm/DebugInfo/PDB/DIA/DIASession.h
@@ -34,6 +34,11 @@ public:
std::unique_ptr<PDBSymbolExe> getGlobalScope() override;
std::unique_ptr<PDBSymbol> getSymbolById(uint32_t SymbolId) const override;
+ bool addressForVA(uint64_t VA, uint32_t &Section,
+ uint32_t &Offset) const override;
+ bool addressForRVA(uint32_t RVA, uint32_t &Section,
+ uint32_t &Offset) const override;
+
std::unique_ptr<PDBSymbol>
findSymbolByAddress(uint64_t Address, PDB_SymType Type) const override;
@@ -76,6 +81,6 @@ public:
private:
CComPtr<IDiaSession> Session;
};
-}
-}
+} // namespace pdb
+} // namespace llvm
#endif
diff --git a/llvm/include/llvm/DebugInfo/PDB/IPDBSession.h b/llvm/include/llvm/DebugInfo/PDB/IPDBSession.h
index 01a017ebe98..55fa67e3c58 100644
--- a/llvm/include/llvm/DebugInfo/PDB/IPDBSession.h
+++ b/llvm/include/llvm/DebugInfo/PDB/IPDBSession.h
@@ -32,6 +32,11 @@ public:
virtual std::unique_ptr<PDBSymbolExe> getGlobalScope() = 0;
virtual std::unique_ptr<PDBSymbol> getSymbolById(uint32_t SymbolId) const = 0;
+ virtual bool addressForVA(uint64_t VA, uint32_t &Section,
+ uint32_t &Offset) const = 0;
+ virtual bool addressForRVA(uint32_t RVA, uint32_t &Section,
+ uint32_t &Offset) const = 0;
+
template <typename T>
std::unique_ptr<T> getConcreteSymbolById(uint32_t SymbolId) const {
return unique_dyn_cast_or_null<T>(getSymbolById(SymbolId));
@@ -79,7 +84,7 @@ public:
virtual std::unique_ptr<IPDBEnumSectionContribs>
getSectionContribs() const = 0;
};
-}
-}
+} // namespace pdb
+} // namespace llvm
#endif
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/NativeSession.h b/llvm/include/llvm/DebugInfo/PDB/Native/NativeSession.h
index 91ca05a1644..39d5da40723 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/NativeSession.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/NativeSession.h
@@ -53,6 +53,11 @@ public:
std::unique_ptr<PDBSymbolExe> getGlobalScope() override;
std::unique_ptr<PDBSymbol> getSymbolById(uint32_t SymbolId) const override;
+ bool addressForVA(uint64_t VA, uint32_t &Section,
+ uint32_t &Offset) const override;
+ bool addressForRVA(uint32_t RVA, uint32_t &Section,
+ uint32_t &Offset) const override;
+
std::unique_ptr<PDBSymbol>
findSymbolByAddress(uint64_t Address, PDB_SymType Type) const override;
@@ -101,7 +106,7 @@ private:
std::vector<std::unique_ptr<NativeRawSymbol>> SymbolCache;
DenseMap<codeview::TypeIndex, SymIndexId> TypeIndexToSymbolId;
};
-}
-}
+} // namespace pdb
+} // namespace llvm
#endif
diff --git a/llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp b/llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp
index a75ee0ef512..16d28b6a434 100644
--- a/llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp
+++ b/llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp
@@ -166,6 +166,28 @@ std::unique_ptr<PDBSymbolExe> DIASession::getGlobalScope() {
return ExeSymbol;
}
+bool DIASession::addressForVA(uint64_t VA, uint32_t &Section,
+ uint32_t &Offset) const {
+ DWORD ArgSection, ArgOffset = 0;
+ if (S_OK == Session->addressForVA(VA, &ArgSection, &ArgOffset)) {
+ Section = static_cast<uint32_t>(ArgSection);
+ Offset = static_cast<uint32_t>(ArgOffset);
+ return true;
+ }
+ return false;
+}
+
+bool DIASession::addressForRVA(uint32_t RVA, uint32_t &Section,
+ uint32_t &Offset) const {
+ DWORD ArgSection, ArgOffset = 0;
+ if (S_OK == Session->addressForRVA(RVA, &ArgSection, &ArgOffset)) {
+ Section = static_cast<uint32_t>(ArgSection);
+ Offset = static_cast<uint32_t>(ArgOffset);
+ return true;
+ }
+ return false;
+}
+
std::unique_ptr<PDBSymbol> DIASession::getSymbolById(uint32_t SymbolId) const {
CComPtr<IDiaSymbol> LocatedSymbol;
if (S_OK != Session->symbolById(SymbolId, &LocatedSymbol))
diff --git a/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp b/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp
index d9f9552b7b9..1eaecc49761 100644
--- a/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp
@@ -185,6 +185,16 @@ NativeSession::getSymbolById(uint32_t SymbolId) const {
: nullptr;
}
+bool NativeSession::addressForVA(uint64_t VA, uint32_t &Section,
+ uint32_t &Offset) const {
+ return false;
+}
+
+bool NativeSession::addressForRVA(uint32_t VA, uint32_t &Section,
+ uint32_t &Offset) const {
+ return false;
+}
+
std::unique_ptr<PDBSymbol>
NativeSession::findSymbolByAddress(uint64_t Address, PDB_SymType Type) const {
return nullptr;
diff --git a/llvm/unittests/DebugInfo/PDB/PDBApiTest.cpp b/llvm/unittests/DebugInfo/PDB/PDBApiTest.cpp
index 9f7fae55f77..314a0138542 100644
--- a/llvm/unittests/DebugInfo/PDB/PDBApiTest.cpp
+++ b/llvm/unittests/DebugInfo/PDB/PDBApiTest.cpp
@@ -75,7 +75,14 @@ class MockSession : public IPDBSession {
getSourceFileById(uint32_t SymbolId) const override {
return nullptr;
}
-
+ bool addressForVA(uint64_t VA, uint32_t &Section,
+ uint32_t &Offset) const override {
+ return false;
+ }
+ bool addressForRVA(uint32_t RVA, uint32_t &Section,
+ uint32_t &Offset) const override {
+ return false;
+ }
std::unique_ptr<PDBSymbol>
findSymbolByAddress(uint64_t Address, PDB_SymType Type) const override {
return nullptr;
@@ -482,5 +489,4 @@ TEST_F(PDBApiTest, Dyncast) {
VerifyUnknownDyncasts();
}
-
} // end anonymous namespace
OpenPOWER on IntegriCloud