[llvm] r305237 - [llvm-pdbutil] Fix one more issue with no-id-stream PDBs.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 12 14:57:42 PDT 2017


Author: zturner
Date: Mon Jun 12 16:57:41 2017
New Revision: 305237

URL: http://llvm.org/viewvc/llvm-project?rev=305237&view=rev
Log:
[llvm-pdbutil] Fix one more issue with no-id-stream PDBs.

This one occurred when we were dumping symbols, we have code
that is prepared to dump many different types of symbols,
including symbols which reference an ID stream.  So when creating
the dumper object, we assume that there is an ID stream.  Fix
this assumption.

Modified:
    llvm/trunk/tools/llvm-pdbutil/LLVMOutputStyle.cpp

Modified: llvm/trunk/tools/llvm-pdbutil/LLVMOutputStyle.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/LLVMOutputStyle.cpp?rev=305237&r1=305236&r2=305237&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbutil/LLVMOutputStyle.cpp (original)
+++ llvm/trunk/tools/llvm-pdbutil/LLVMOutputStyle.cpp Mon Jun 12 16:57:41 2017
@@ -89,7 +89,7 @@ struct PageStats {
 class C13RawVisitor : public DebugSubsectionVisitor {
 public:
   C13RawVisitor(ScopedPrinter &P, LazyRandomTypeCollection &TPI,
-                LazyRandomTypeCollection &IPI)
+                LazyRandomTypeCollection *IPI)
       : P(P), TPI(TPI), IPI(IPI) {}
 
   Error visitUnknown(DebugUnknownSubsectionRef &Unknown) override {
@@ -299,13 +299,18 @@ public:
 
 private:
   Error dumpTypeRecord(StringRef Label, TypeIndex Index) {
-    CompactTypeDumpVisitor CTDV(IPI, Index, &P);
-    DictScope D(P, Label);
-    if (IPI.contains(Index)) {
-      CVType Type = IPI.getType(Index);
-      if (auto EC = codeview::visitTypeRecord(Type, CTDV))
-        return EC;
-    } else {
+    bool Success = false;
+    if (IPI) {
+      CompactTypeDumpVisitor CTDV(*IPI, Index, &P);
+      DictScope D(P, Label);
+      if (IPI->contains(Index)) {
+        CVType Type = IPI->getType(Index);
+        if (auto EC = codeview::visitTypeRecord(Type, CTDV))
+          return EC;
+      }
+    }
+    
+    if (!Success) {
       P.printString(
           llvm::formatv("Index: {0:x} (unknown function)", Index.getIndex())
               .str());
@@ -339,7 +344,7 @@ private:
 
   ScopedPrinter &P;
   LazyRandomTypeCollection &TPI;
-  LazyRandomTypeCollection &IPI;
+  LazyRandomTypeCollection *IPI;
 };
 }
 
@@ -881,6 +886,8 @@ Error LLVMOutputStyle::dumpDbiStream() {
     return Error::success();
   }
 
+  ExitOnError Err("Error while processing DBI Stream");
+
   auto DS = File.getPDBDbiStream();
   if (!DS)
     return DS.takeError();
@@ -972,10 +979,10 @@ Error LLVMOutputStyle::dumpDbiStream() {
         }
         if (!opts::shared::DumpModuleSubsections.empty()) {
           ListScope SS(P, "Subsections");
-          auto ExpectedIpi = initializeTypeDatabase(StreamIPI);
-          if (!ExpectedIpi)
-            return ExpectedIpi.takeError();
-          auto &Ipi = *ExpectedIpi;
+          auto &InfoS = Err(File.getPDBInfoStream());
+          LazyRandomTypeCollection *Ipi = nullptr;
+          if (InfoS.containsIdStream())
+            Ipi = &Err(initializeTypeDatabase(StreamIPI));
           auto ExpectedStrings = File.getStringTable();
           if (!ExpectedStrings)
             return joinErrors(




More information about the llvm-commits mailing list