From 653baa2aaab66224c6f610dc133e8857cf53535a Mon Sep 17 00:00:00 2001 From: Bob Haarman Date: Fri, 21 Oct 2016 19:43:19 +0000 Subject: [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 --- llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp') diff --git a/llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp b/llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp index db39dae9e4f..c69f3849572 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 @@ Error LLVMOutputStyle::dump() { if (auto EC = dumpSectionMap()) return EC; + if (auto EC = dumpGlobalsStream()) + return EC; + if (auto EC = dumpPublicsStream()) return EC; @@ -343,6 +347,26 @@ void LLVMOutputStyle::dumpBitVector(StringRef Name, const BitVector &V) { 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(); -- cgit v1.2.3