[pdb] added support for dumping globals stream
Summary: This adds support for dumping the globals stream from PDB files using llvm-pdbdump, similar to the support we have for the publics stream.
Reviewers: ruiu, zturner
Subscribers: beanz, mgorny, modocache
Differential Revision: https://reviews.llvm.org/D25801
llvm-svn: 284861
diff --git a/llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp b/llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp
index db39dae..c69f384 100644
--- a/llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp
+++ b/llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp
@@ -18,6 +18,7 @@
#include "llvm/DebugInfo/PDB/PDBExtras.h"
#include "llvm/DebugInfo/PDB/Raw/DbiStream.h"
#include "llvm/DebugInfo/PDB/Raw/EnumTables.h"
+#include "llvm/DebugInfo/PDB/Raw/GlobalsStream.h"
#include "llvm/DebugInfo/PDB/Raw/ISectionContribVisitor.h"
#include "llvm/DebugInfo/PDB/Raw/InfoStream.h"
#include "llvm/DebugInfo/PDB/Raw/ModInfo.h"
@@ -122,6 +123,9 @@
if (auto EC = dumpSectionMap())
return EC;
+ if (auto EC = dumpGlobalsStream())
+ return EC;
+
if (auto EC = dumpPublicsStream())
return EC;
@@ -343,6 +347,26 @@
P.printList(Name, Vec);
}
+Error LLVMOutputStyle::dumpGlobalsStream() {
+ if (!opts::raw::DumpGlobals)
+ return Error::success();
+
+ DictScope D(P, "Globals Stream");
+ auto Globals = File.getPDBGlobalsStream();
+ if (!Globals)
+ return Globals.takeError();
+
+ auto Dbi = File.getPDBDbiStream();
+ if (!Dbi)
+ return Dbi.takeError();
+
+ P.printNumber("Stream number", Dbi->getGlobalSymbolStreamIndex());
+ P.printNumber("Number of buckets", Globals->getNumBuckets());
+ P.printList("Hash Buckets", Globals->getHashBuckets());
+
+ return Error::success();
+}
+
Error LLVMOutputStyle::dumpStreamBlocks() {
if (!opts::raw::DumpStreamBlocks)
return Error::success();