[PATCH] D23047: pdbdump: Do not treat stream 0 pages as allocated pages.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 1 18:57:50 PDT 2016


ruiu created this revision.
ruiu added a reviewer: zturner.
ruiu added a subscriber: llvm-commits.

I examined a few PDBs and all of them treated pages for stream 0
are unused, thus they were unmarked in their free page bitmap.
I think we should do the same thing for compatibility.

https://reviews.llvm.org/D23047

Files:
  tools/llvm-pdbdump/LLVMOutputStyle.cpp

Index: tools/llvm-pdbdump/LLVMOutputStyle.cpp
===================================================================
--- tools/llvm-pdbdump/LLVMOutputStyle.cpp
+++ tools/llvm-pdbdump/LLVMOutputStyle.cpp
@@ -303,14 +303,17 @@
 
   recordKnownUsedPage(PS, File.getBlockMapIndex()); // Stream Table
 
-  for (auto DB : File.getDirectoryBlockArray()) {
+  for (auto DB : File.getDirectoryBlockArray())
     recordKnownUsedPage(PS, DB);
-  }
-  for (auto &SE : File.getStreamMap()) {
-    for (auto &S : SE) {
-      recordKnownUsedPage(PS, S);
-    }
-  }
+
+  // Record pages used by streams. Note that pages for stream 0
+  // are considered being unused because that's what MSVC tools do.
+  // Stream 0 doesn't contain actual data, so it makes some sense,
+  // though it's a bit confusing to us.
+  for (auto &SE : File.getStreamMap())
+    for (auto &S : SE)
+      if (S != 0)
+        recordKnownUsedPage(PS, S);
 
   dumpBitVector("Msf Free Pages", FPM);
   dumpBitVector("Orphaned Pages", PS.OrphanedPages);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23047.66421.patch
Type: text/x-patch
Size: 1011 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160802/d23581c7/attachment.bin>


More information about the llvm-commits mailing list