[PATCH] D20470: [llvm-dwarfdump] - Teach dwarfdump to decompress debug sections in zlib style.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Fri May 20 09:48:50 PDT 2016


dblaikie added a comment.

Generally looks good. I'm not sure about renaming the zdebug section to debug in the output, but I'm not set against it either.


================
Comment at: lib/DebugInfo/DWARF/DWARFContext.cpp:626
@@ +625,3 @@
+  if (Is64Bit)
+    Extractor.getUnsigned(&Offset, sizeof(Elf64_Word));
+
----------------
You could just increment Offset (by sizeof(Elf64_Word)) here, I think?

================
Comment at: lib/DebugInfo/DWARF/DWARFContext.cpp:681-685
@@ -639,10 +680,7 @@
+    if (ZLibStyleCompressed || name.startswith("zdebug_")) {
+      SmallString<32> Out;
+      if (!tryDecompress(name, data, Out, ZLibStyleCompressed, IsLittleEndian,
+                         AddressSize == 8))
         continue;
-      UncompressedSections.resize(UncompressedSections.size() + 1);
-      if (zlib::uncompress(data, UncompressedSections.back(), OriginalSize) !=
-          zlib::StatusOK) {
-        UncompressedSections.pop_back();
-        continue;
-      }
-      // Make data point to uncompressed section contents and save its contents.
-      name = name.substr(1);
+      UncompressedSections.emplace_back(Out);
       data = UncompressedSections.back();
----------------
This involves making extra copies of the data. Is there a reason you went with this over the original code that decompressed straight into the UncompressedSections?


http://reviews.llvm.org/D20470





More information about the llvm-commits mailing list