[llvm] r270655 - [llvm-pdbdump] Stream 0 isn't actually the MSF superblock.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Tue May 24 20:53:16 PDT 2016


Author: zturner
Date: Tue May 24 22:53:16 2016
New Revision: 270655

URL: http://llvm.org/viewvc/llvm-project?rev=270655&view=rev
Log:
[llvm-pdbdump] Stream 0 isn't actually the MSF superblock.

Oddly enough, I realized we don't actually know what stream
0 is (if anything).

Modified:
    llvm/trunk/lib/DebugInfo/PDB/Raw/PDBFile.cpp
    llvm/trunk/test/DebugInfo/PDB/pdbdump-headers.test
    llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp

Modified: llvm/trunk/lib/DebugInfo/PDB/Raw/PDBFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Raw/PDBFile.cpp?rev=270655&r1=270654&r2=270655&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/PDBFile.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/PDBFile.cpp Tue May 24 22:53:16 2016
@@ -124,6 +124,7 @@ StringRef PDBFile::getBlockData(uint32_t
 Error PDBFile::parseFileHeaders() {
   std::error_code EC;
   MemoryBufferRef BufferRef = *Context->Buffer;
+
   // Make sure the file is sufficiently large to hold a super block.
   // Do this before attempting to read the super block.
   if (BufferRef.getBufferSize() < sizeof(SuperBlock))

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=270655&r1=270654&r2=270655&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/PDB/pdbdump-headers.test (original)
+++ llvm/trunk/test/DebugInfo/PDB/pdbdump-headers.test Tue May 24 22:53:16 2016
@@ -18,7 +18,7 @@
 ; EMPTY-NEXT:   NumStreams: 17
 ; EMPTY-NEXT: }
 ; EMPTY-NEXT: Streams [
-; EMPTY-NEXT:   Stream 0: [MSF Superblock] (40 bytes)
+; EMPTY-NEXT:   Stream 0: [???] (40 bytes)
 ; EMPTY-NEXT:   Stream 1: [PDB Stream] (118 bytes)
 ; EMPTY-NEXT:   Stream 2: [TPI Stream] (5392 bytes)
 ; EMPTY-NEXT:   Stream 3: [DBI Stream] (739 bytes)

Modified: llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp?rev=270655&r1=270654&r2=270655&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp (original)
+++ llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp Tue May 24 22:53:16 2016
@@ -237,9 +237,7 @@ static Error dumpStreamSummary(ScopedPri
     std::string Label("Stream ");
     Label += to_string(StreamIdx);
     std::string Value;
-    if (StreamIdx == 0)
-      Value = "MSF Superblock";
-    else if (StreamIdx == StreamPDB)
+    if (StreamIdx == StreamPDB)
       Value = "PDB Stream";
     else if (StreamIdx == StreamDBI)
       Value = "DBI Stream";
@@ -320,6 +318,8 @@ static Error dumpStreamData(ScopedPrinte
 }
 
 static Error dumpInfoStream(ScopedPrinter &P, PDBFile &File) {
+  if (!opts::DumpHeaders)
+    return Error::success();
   auto InfoS = File.getPDBInfoStream();
   if (auto EC = InfoS.takeError())
     return EC;
@@ -374,6 +374,11 @@ static Error dumpNamedStream(ScopedPrint
 
 static Error dumpDbiStream(ScopedPrinter &P, PDBFile &File,
                            codeview::CVTypeDumper &TD) {
+  bool DumpModules =
+      opts::DumpModules || opts::DumpModuleSyms || opts::DumpModuleFiles;
+  if (!opts::DumpHeaders && !DumpModules)
+    return Error::success();
+
   auto DbiS = File.getPDBDbiStream();
   if (auto EC = DbiS.takeError())
     return EC;
@@ -400,7 +405,7 @@ static Error dumpDbiStream(ScopedPrinter
   DllStream.flush();
   P.printVersion(DllName, Major, Minor, DS.getPdbDllVersion());
 
-  if (opts::DumpModules || opts::DumpModuleSyms || opts::DumpModuleFiles) {
+  if (DumpModules) {
     ListScope L(P, "Modules");
     for (auto &Modi : DS.modules()) {
       DictScope DD(P);




More information about the llvm-commits mailing list