forked from OSchip/llvm-project
[DebugInfoPDB] Add DIA implementation of addressForVA and addressForRVA
These are used in finding line numbers for PDBSymbolData llvm-svn: 328585
This commit is contained in:
parent
44357eef97
commit
53708a5e9e
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue