summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2016-06-03 05:52:57 +0000
committerZachary Turner <zturner@google.com>2016-06-03 05:52:57 +0000
commit3df1bfaaec1c70c6501f01868bcd81764c9582e9 (patch)
treeb1451ece7ed3236beda44a10c3e9f514decd66dd /llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
parente7ae106147bfa93390e1b275829c93cc60712aa4 (diff)
downloadbcm5719-llvm-3df1bfaaec1c70c6501f01868bcd81764c9582e9.tar.gz
bcm5719-llvm-3df1bfaaec1c70c6501f01868bcd81764c9582e9.zip
[pdb] Print out file names instead of file offsets.
When printing line information and file checksums, we were printing the file offset field from the struct header. This teaches llvm-pdbdump how to turn those numbers into the filename. In the case of file checksums, this is done by looking in the global string table. In the case of line contributions, this is done by indexing into the file names buffer of the DBI stream. Why they use a different technique I don't know. llvm-svn: 271630
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp')
-rw-r--r--llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp b/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
index d0fbb142ec3..73d8eef570f 100644
--- a/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
+++ b/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
@@ -11,6 +11,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/DebugInfo/PDB/Raw/DbiStream.h"
#include "llvm/DebugInfo/PDB/Raw/InfoStream.h"
+#include "llvm/DebugInfo/PDB/Raw/NameHashTable.h"
#include "llvm/DebugInfo/PDB/Raw/PublicsStream.h"
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
#include "llvm/DebugInfo/PDB/Raw/SymbolStream.h"
@@ -359,3 +360,24 @@ Expected<SymbolStream &> PDBFile::getPDBSymbolStream() {
}
return *Symbols;
}
+
+Expected<NameHashTable &> PDBFile::getStringTable() {
+ if (!StringTable || !StringTableStream) {
+ auto InfoS = getPDBInfoStream();
+ if (auto EC = InfoS.takeError())
+ return std::move(EC);
+ auto &IS = InfoS.get();
+ uint32_t NameStreamIndex = IS.getNamedStreamIndex("/names");
+
+ if (NameStreamIndex == 0)
+ return make_error<RawError>(raw_error_code::no_stream);
+ auto S = llvm::make_unique<MappedBlockStream>(NameStreamIndex, *this);
+ codeview::StreamReader Reader(*S);
+ auto N = llvm::make_unique<NameHashTable>();
+ if (auto EC = N->load(Reader))
+ return std::move(EC);
+ StringTable = std::move(N);
+ StringTableStream = std::move(S);
+ }
+ return *StringTable;
+}
OpenPOWER on IntegriCloud