[llvm] r306150 - [llvm-pdbutil] Show what blocks a stream occupies.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 23 13:28:15 PDT 2017


Author: zturner
Date: Fri Jun 23 15:28:14 2017
New Revision: 306150

URL: http://llvm.org/viewvc/llvm-project?rev=306150&view=rev
Log:
[llvm-pdbutil] Show what blocks a stream occupies.

This is useful when you want to look at a specific chunk of a
stream or look for discontinuities, and you need to know the
list of blocks occupied by a stream.

Modified:
    llvm/trunk/test/DebugInfo/PDB/pdbdump-headers.test
    llvm/trunk/tools/llvm-pdbutil/DumpOutputStyle.cpp
    llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp
    llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.h

Modified: llvm/trunk/test/DebugInfo/PDB/pdbdump-headers.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/PDB/pdbdump-headers.test?rev=306150&r1=306149&r2=306150&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/PDB/pdbdump-headers.test (original)
+++ llvm/trunk/test/DebugInfo/PDB/pdbdump-headers.test Fri Jun 23 15:28:14 2017
@@ -22,23 +22,40 @@ ALL-NEXT:   Has conflicting types: false
 ALL-NEXT:   Is stripped: false
 ALL:                                  Streams
 ALL-NEXT: ============================================================
-ALL-NEXT: Stream  0: [Old MSF Directory] (40 bytes)
-ALL-NEXT:   Stream  1: [PDB Stream] (118 bytes)
-ALL-NEXT:   Stream  2: [TPI Stream] (5392 bytes)
-ALL-NEXT:   Stream  3: [DBI Stream] (739 bytes)
-ALL-NEXT:   Stream  4: [IPI Stream] (784 bytes)
-ALL-NEXT:   Stream  5: [Named Stream "/LinkInfo"] (0 bytes)
-ALL-NEXT:   Stream  6: [Global Symbol Hash] (556 bytes)
-ALL-NEXT:   Stream  7: [Public Symbol Hash] (604 bytes)
-ALL-NEXT:   Stream  8: [Public Symbol Records] (104 bytes)
-ALL-NEXT:   Stream  9: [Named Stream "/src/headerblock"] (0 bytes)
-ALL-NEXT:   Stream 10: [Section Header Data] (160 bytes)
-ALL-NEXT:   Stream 11: [New FPO Data] (32 bytes)
-ALL-NEXT:   Stream 12: [Module "d:\src\llvm\test\DebugInfo\PDB\Inputs\empty.obj"] (308 bytes)
-ALL-NEXT:   Stream 13: [Named Stream "/names"] (239 bytes)
-ALL-NEXT:   Stream 14: [Module "* Linker *"] (520 bytes)
-ALL-NEXT:   Stream 15: [TPI Hash] (308 bytes)
-ALL-NEXT:   Stream 16: [IPI Hash] (68 bytes)
+ALL-NEXT:     Stream  0: [Old MSF Directory] (40 bytes)
+ALL-NEXT:                Blocks: [8]
+ALL-NEXT:     Stream  1: [PDB Stream] (118 bytes)
+ALL-NEXT:                Blocks: [19]
+ALL-NEXT:     Stream  2: [TPI Stream] (5392 bytes)
+ALL-NEXT:                Blocks: [18, 17]
+ALL-NEXT:     Stream  3: [DBI Stream] (739 bytes)
+ALL-NEXT:                Blocks: [14]
+ALL-NEXT:     Stream  4: [IPI Stream] (784 bytes)
+ALL-NEXT:                Blocks: [20]
+ALL-NEXT:     Stream  5: [Named Stream "/LinkInfo"] (0 bytes)
+ALL-NEXT:                Blocks: []
+ALL-NEXT:     Stream  6: [Global Symbol Hash] (556 bytes)
+ALL-NEXT:                Blocks: [11]
+ALL-NEXT:     Stream  7: [Public Symbol Hash] (604 bytes)
+ALL-NEXT:                Blocks: [13]
+ALL-NEXT:     Stream  8: [Public Symbol Records] (104 bytes)
+ALL-NEXT:                Blocks: [12]
+ALL-NEXT:     Stream  9: [Named Stream "/src/headerblock"] (0 bytes)
+ALL-NEXT:                Blocks: []
+ALL-NEXT:     Stream 10: [Section Header Data] (160 bytes)
+ALL-NEXT:                Blocks: [10]
+ALL-NEXT:     Stream 11: [New FPO Data] (32 bytes)
+ALL-NEXT:                Blocks: [15]
+ALL-NEXT:     Stream 12: [Module "d:\src\llvm\test\DebugInfo\PDB\Inputs\empty.obj"] (308 bytes)
+ALL-NEXT:                Blocks: [6]
+ALL-NEXT:     Stream 13: [Named Stream "/names"] (239 bytes)
+ALL-NEXT:                Blocks: [16]
+ALL-NEXT:     Stream 14: [Module "* Linker *"] (520 bytes)
+ALL-NEXT:                Blocks: [7]
+ALL-NEXT:     Stream 15: [TPI Hash] (308 bytes)
+ALL-NEXT:                Blocks: [21]
+ALL-NEXT:     Stream 16: [IPI Hash] (68 bytes)
+ALL-NEXT:                Blocks: [22]
 ALL:                                String Table
 ALL-NEXT: ============================================================
 ALL-NEXT:    ID | String

Modified: llvm/trunk/tools/llvm-pdbutil/DumpOutputStyle.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/DumpOutputStyle.cpp?rev=306150&r1=306149&r2=306150&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbutil/DumpOutputStyle.cpp (original)
+++ llvm/trunk/tools/llvm-pdbutil/DumpOutputStyle.cpp Fri Jun 23 15:28:14 2017
@@ -199,6 +199,13 @@ Error DumpOutputStyle::dumpStreamSummary
         "Stream {0}: [{1}] ({2} bytes)",
         fmt_align(StreamIdx, AlignStyle::Right, NumDigits(StreamCount)),
         StreamPurposes[StreamIdx], File.getStreamByteSize(StreamIdx));
+    if (opts::dump::DumpStreamBlocks) {
+      auto Blocks = File.getStreamBlockList(StreamIdx);
+      std::vector<uint32_t> BV(Blocks.begin(), Blocks.end());
+      P.formatLine("       {0}  Blocks: [{1}]",
+                   fmt_repeat(' ', NumDigits(StreamCount)),
+                   make_range(BV.begin(), BV.end()));
+    }
   }
 
   return Error::success();

Modified: llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp?rev=306150&r1=306149&r2=306150&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp (original)
+++ llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp Fri Jun 23 15:28:14 2017
@@ -308,6 +308,10 @@ cl::opt<bool> DumpSummary("summary", cl:
 cl::opt<bool> DumpStreams("streams",
                           cl::desc("dump summary of the PDB streams"),
                           cl::cat(MsfOptions), cl::sub(DumpSubcommand));
+cl::opt<bool> DumpStreamBlocks(
+    "stream-blocks",
+    cl::desc("Add block information to the output of -streams"),
+    cl::cat(MsfOptions), cl::sub(DumpSubcommand));
 
 // TYPE OPTIONS
 cl::opt<bool> DumpTypes("types",
@@ -978,6 +982,7 @@ int main(int argc_, const char *argv_[])
       opts::dump::DumpSectionContribs = true;
       opts::dump::DumpSectionMap = true;
       opts::dump::DumpStreams = true;
+      opts::dump::DumpStreamBlocks = true;
       opts::dump::DumpStringTable = true;
       opts::dump::DumpSummary = true;
       opts::dump::DumpSymbols = true;

Modified: llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.h?rev=306150&r1=306149&r2=306150&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.h (original)
+++ llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.h Fri Jun 23 15:28:14 2017
@@ -108,6 +108,7 @@ namespace dump {
 
 extern llvm::cl::opt<bool> DumpSummary;
 extern llvm::cl::opt<bool> DumpStreams;
+extern llvm::cl::opt<bool> DumpStreamBlocks;
 
 extern llvm::cl::opt<bool> DumpLines;
 extern llvm::cl::opt<bool> DumpInlineeLines;




More information about the llvm-commits mailing list