summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-09-01 20:06:56 +0000
committerZachary Turner <zturner@google.com>2017-09-01 20:06:56 +0000
commitabb17cc084d917a54b3e5021bbb3ecdfc1a49d23 (patch)
tree2ceb0b03a84f9954158397e0222afba212cf9227 /llvm/lib/DebugInfo/PDB
parentc36039f462a8270a69b64309810f537e4991bb1c (diff)
downloadbcm5719-llvm-abb17cc084d917a54b3e5021bbb3ecdfc1a49d23.tar.gz
bcm5719-llvm-abb17cc084d917a54b3e5021bbb3ecdfc1a49d23.zip
[llvm-pdbutil] Support dumping CodeView from object files.
We have llvm-readobj for dumping CodeView from object files, and llvm-pdbutil has always been more focused on PDB. However, llvm-pdbutil has a lot of useful options for summarizing debug information in aggregate and presenting high level statistical views. Furthermore, it's arguably better as a testing tool since we don't have to write tests to conform to a state-machine like structure where you match multiple lines in succession, each depending on a previous match. llvm-pdbutil dumps much more concisely, so it's possible to use single-line matches in many cases where as with readobj tests you have to use multi-line matches with an implicit state machine. Because of this, I'm adding object file support to llvm-pdbutil. In fact, this mirrors the cvdump tool from Microsoft, which also supports both object files and pdb files. In the future we could perhaps rename this tool llvm-cvutil. In the meantime, this allows us to deep dive into object files the same way we already can with PDB files. llvm-svn: 312358
Diffstat (limited to 'llvm/lib/DebugInfo/PDB')
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp b/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp
index 414de7be91f..15b31d821b1 100644
--- a/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp
@@ -312,6 +312,9 @@ Expected<TpiStream &> PDBFile::getPDBTpiStream() {
Expected<TpiStream &> PDBFile::getPDBIpiStream() {
if (!Ipi) {
+ if (!hasPDBIpiStream())
+ return make_error<RawError>(raw_error_code::no_stream);
+
auto IpiS = safelyCreateIndexedStream(ContainerLayout, *Buffer, StreamIPI);
if (!IpiS)
return IpiS.takeError();
@@ -407,9 +410,18 @@ bool PDBFile::hasPDBGlobalsStream() {
return DbiS->getGlobalSymbolStreamIndex() < getNumStreams();
}
-bool PDBFile::hasPDBInfoStream() { return StreamPDB < getNumStreams(); }
+bool PDBFile::hasPDBInfoStream() const { return StreamPDB < getNumStreams(); }
+
+bool PDBFile::hasPDBIpiStream() const {
+ if (!hasPDBInfoStream())
+ return false;
+
+ if (StreamIPI >= getNumStreams())
+ return false;
-bool PDBFile::hasPDBIpiStream() const { return StreamIPI < getNumStreams(); }
+ auto &InfoStream = cantFail(const_cast<PDBFile *>(this)->getPDBInfoStream());
+ return InfoStream.containsIdStream();
+}
bool PDBFile::hasPDBPublicsStream() {
auto DbiS = getPDBDbiStream();
OpenPOWER on IntegriCloud