diff options
author | Adrian McCarthy <amccarth@google.com> | 2017-02-24 00:10:47 +0000 |
---|---|---|
committer | Adrian McCarthy <amccarth@google.com> | 2017-02-24 00:10:47 +0000 |
commit | 649b8e0c45854f4c7938284b337c17ca968cafa9 (patch) | |
tree | 478f33f3bc499d7a89e417eef0634398c6c95c1f /llvm/lib | |
parent | 95cb2fbd892030ed087210ab74cc15c0c2f7b2da (diff) | |
download | bcm5719-llvm-649b8e0c45854f4c7938284b337c17ca968cafa9.tar.gz bcm5719-llvm-649b8e0c45854f4c7938284b337c17ca968cafa9.zip |
Implement some methods for NativeRawSymbol
This allows the ability to call IPDBSession::getGlobalScope with a NativeSession and
to then query it for some basic fields from the PDB's InfoStream.
Note that the symbols now have non-const references back to the Session so that
NativeRawSymbol can access the PDBFile through the Session.
Differential Revision: https://reviews.llvm.org/D30314
llvm-svn: 296049
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp | 19 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp | 9 |
3 files changed, 24 insertions, 6 deletions
diff --git a/llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp b/llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp index 6ecf335812b..7077bda4a53 100644 --- a/llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp +++ b/llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp @@ -140,7 +140,7 @@ void DIASession::setLoadAddress(uint64_t Address) { Session->put_loadAddress(Address); } -std::unique_ptr<PDBSymbolExe> DIASession::getGlobalScope() const { +std::unique_ptr<PDBSymbolExe> DIASession::getGlobalScope() { CComPtr<IDiaSymbol> GlobalScope; if (S_OK != Session->get_globalScope(&GlobalScope)) return nullptr; diff --git a/llvm/lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp b/llvm/lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp index 4e27e13a379..527ca8d717f 100644 --- a/llvm/lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp @@ -10,7 +10,9 @@ #include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/STLExtras.h" +#include "llvm/DebugInfo/PDB/Native/InfoStream.h" #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h" +#include "llvm/DebugInfo/PDB/Native/PDBFile.h" #include "llvm/DebugInfo/PDB/PDBExtras.h" #include "llvm/DebugInfo/PDB/Native/NativeSession.h" #include "llvm/Support/ConvertUTF.h" @@ -19,7 +21,8 @@ using namespace llvm; using namespace llvm::pdb; -NativeRawSymbol::NativeRawSymbol(const NativeSession &PDBSession) {} +NativeRawSymbol::NativeRawSymbol(NativeSession &PDBSession) + : Session(PDBSession) {} void NativeRawSymbol::dump(raw_ostream &OS, int Indent) const {} @@ -62,6 +65,11 @@ uint32_t NativeRawSymbol::getAddressSection() const { } uint32_t NativeRawSymbol::getAge() const { + auto &File = Session.getPDBFile(); + auto IS = File.getPDBInfoStream(); + if (IS) + return IS->getAge(); + consumeError(IS.takeError()); return 0; } @@ -248,7 +256,7 @@ uint32_t NativeRawSymbol::getSubTypeId() const { } std::string NativeRawSymbol::getSymbolsFileName() const { - return 0; + return Session.getPDBFile().getFilePath(); } uint32_t NativeRawSymbol::getSymIndexId() const { @@ -328,7 +336,12 @@ PDB_SymType NativeRawSymbol::getSymTag() const { } PDB_UniqueId NativeRawSymbol::getGuid() const { - return {{0}}; + auto &File = Session.getPDBFile(); + auto IS = File.getPDBInfoStream(); + if (IS) + return IS->getGuid(); + consumeError(IS.takeError()); + return PDB_UniqueId{{0}}; } int32_t NativeRawSymbol::getOffset() const { diff --git a/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp b/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp index cafaa9bffa3..6827fbf4fb4 100644 --- a/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp @@ -14,6 +14,7 @@ #include "llvm/DebugInfo/PDB/GenericError.h" #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h" #include "llvm/DebugInfo/PDB/IPDBSourceFile.h" +#include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h" #include "llvm/DebugInfo/PDB/Native/PDBFile.h" #include "llvm/DebugInfo/PDB/Native/RawError.h" #include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h" @@ -68,8 +69,12 @@ uint64_t NativeSession::getLoadAddress() const { return 0; } void NativeSession::setLoadAddress(uint64_t Address) {} -std::unique_ptr<PDBSymbolExe> NativeSession::getGlobalScope() const { - return nullptr; +std::unique_ptr<PDBSymbolExe> NativeSession::getGlobalScope() { + auto RawSymbol = llvm::make_unique<NativeRawSymbol>(*this); + auto PdbSymbol(PDBSymbol::create(*this, std::move(RawSymbol))); + std::unique_ptr<PDBSymbolExe> ExeSymbol( + static_cast<PDBSymbolExe *>(PdbSymbol.release())); + return ExeSymbol; } std::unique_ptr<PDBSymbol> |