aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/DebugInfo/PDB/PDB.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2016-04-21 20:58:35 +0000
committerZachary Turner <zturner@google.com>2016-04-21 20:58:35 +0000
commita12b3d4626ee6dcb5cc98b121dd287b444b6bd3c (patch)
tree372590fc3d32faad953fd3f78f528743e55738fa /llvm/lib/DebugInfo/PDB/PDB.cpp
parent5852c5a12f268aee0274ced9109d72da50985ebe (diff)
downloadllvm-a12b3d4626ee6dcb5cc98b121dd287b444b6bd3c.zip
llvm-a12b3d4626ee6dcb5cc98b121dd287b444b6bd3c.tar.gz
llvm-a12b3d4626ee6dcb5cc98b121dd287b444b6bd3c.tar.bz2
Refactor raw pdb dumper into library
PDB parsing code was hand-rolled into llvm-pdbdump. This patch moves the parsing of this code into DebugInfoPDB and makes the dumper use this. This is achieved by implementing the skeleton of RawPdbSession, the non-DIA counterpart to the existing PDB read interface. None of the type / source file / etc information is accessible yet, so this implementation is not yet close to achieving parity with the DIA counterpart, but the RawSession class simply holds a reference to a PDBFile class which handles parsing the file format. Additionally a PDBStream class is introduced which allows accessing the bytes of a particular stream in a PDB file. Differential Revision: http://reviews.llvm.org/D19343 Reviewed By: majnemer llvm-svn: 267049
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/PDB.cpp')
-rw-r--r--llvm/lib/DebugInfo/PDB/PDB.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/DebugInfo/PDB/PDB.cpp b/llvm/lib/DebugInfo/PDB/PDB.cpp
index bb40942..723d1d2 100644
--- a/llvm/lib/DebugInfo/PDB/PDB.cpp
+++ b/llvm/lib/DebugInfo/PDB/PDB.cpp
@@ -17,23 +17,28 @@
#if HAVE_DIA_SDK
#include "llvm/DebugInfo/PDB/DIA/DIASession.h"
#endif
+#include "llvm/DebugInfo/PDB/Raw/RawSession.h"
using namespace llvm;
PDB_ErrorCode llvm::loadDataForPDB(PDB_ReaderType Type, StringRef Path,
std::unique_ptr<IPDBSession> &Session) {
// Create the correct concrete instance type based on the value of Type.
+ if (Type == PDB_ReaderType::Raw)
+ return RawSession::createFromPdb(Path, Session);
+
#if HAVE_DIA_SDK
return DIASession::createFromPdb(Path, Session);
#endif
- return PDB_ErrorCode::NoDiaSupport;
}
PDB_ErrorCode llvm::loadDataForEXE(PDB_ReaderType Type, StringRef Path,
std::unique_ptr<IPDBSession> &Session) {
// Create the correct concrete instance type based on the value of Type.
+ if (Type == PDB_ReaderType::Raw)
+ return RawSession::createFromExe(Path, Session);
+
#if HAVE_DIA_SDK
return DIASession::createFromExe(Path, Session);
#endif
- return PDB_ErrorCode::NoDiaSupport;
}