summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2017-10-27 00:45:51 +0000
committerReid Kleckner <rnk@google.com>2017-10-27 00:45:51 +0000
commit145090f124039a3f02819030d762f1d74d2cba1b (patch)
tree4fd7b50f3251a693df2e1c7667dec6c75c58ab38
parent32bcb5d7fb43a4c1c81632441ec5271d94d0caf2 (diff)
downloadbcm5719-llvm-145090f124039a3f02819030d762f1d74d2cba1b.tar.gz
bcm5719-llvm-145090f124039a3f02819030d762f1d74d2cba1b.zip
[PDB] Handle an empty globals hash table with no buckets
llvm-svn: 316722
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/GlobalsStream.cpp5
-rw-r--r--llvm/test/DebugInfo/PDB/Inputs/pdbdump-globals-empty.pdbbin0 -> 86016 bytes
-rw-r--r--llvm/test/DebugInfo/PDB/pdbdump-globals-empty.test6
-rw-r--r--llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp6
4 files changed, 13 insertions, 4 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Native/GlobalsStream.cpp b/llvm/lib/DebugInfo/PDB/Native/GlobalsStream.cpp
index 1fe35a691c3..97bbbebd575 100644
--- a/llvm/lib/DebugInfo/PDB/Native/GlobalsStream.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/GlobalsStream.cpp
@@ -117,7 +117,8 @@ Error GSIHashTable::read(BinaryStreamReader &Reader) {
return EC;
if (auto EC = readGSIHashRecords(HashRecords, HashHdr, Reader))
return EC;
- if (auto EC = readGSIHashBuckets(HashBuckets, HashBitmap, HashHdr, Reader))
- return EC;
+ if (HashHdr->HrSize > 0)
+ if (auto EC = readGSIHashBuckets(HashBuckets, HashBitmap, HashHdr, Reader))
+ return EC;
return Error::success();
}
diff --git a/llvm/test/DebugInfo/PDB/Inputs/pdbdump-globals-empty.pdb b/llvm/test/DebugInfo/PDB/Inputs/pdbdump-globals-empty.pdb
new file mode 100644
index 00000000000..a688d399895
--- /dev/null
+++ b/llvm/test/DebugInfo/PDB/Inputs/pdbdump-globals-empty.pdb
Binary files differ
diff --git a/llvm/test/DebugInfo/PDB/pdbdump-globals-empty.test b/llvm/test/DebugInfo/PDB/pdbdump-globals-empty.test
new file mode 100644
index 00000000000..59a06ea5e85
--- /dev/null
+++ b/llvm/test/DebugInfo/PDB/pdbdump-globals-empty.test
@@ -0,0 +1,6 @@
+RUN: llvm-pdbutil dump -globals %S/Inputs/pdbdump-globals-empty.pdb | FileCheck %s
+
+CHECK: Global Symbols
+CHECK: ============================================================
+CHECK: Records
+CHECK-NOT: S_
diff --git a/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp b/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
index 8a4d21b27ba..5b02d68bc7a 100644
--- a/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
+++ b/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
@@ -639,9 +639,11 @@ Error DumpOutputStyle::dumpUdtStats() {
}
auto &SymbolRecords = cantFail(getPdb().getPDBSymbolStream());
- auto &Globals = cantFail(getPdb().getPDBGlobalsStream());
+ auto ExpGlobals = getPdb().getPDBGlobalsStream();
+ if (!ExpGlobals)
+ return ExpGlobals.takeError();
- for (uint32_t PubSymOff : Globals.getGlobalsTable()) {
+ for (uint32_t PubSymOff : ExpGlobals->getGlobalsTable()) {
CVSymbol Sym = SymbolRecords.readRecord(PubSymOff);
HandleOneSymbol(Sym);
}
OpenPOWER on IntegriCloud