[Lldb-commits] [PATCH] D133530: [lldb] Add zstd support

Fangrui Song via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 8 20:38:47 PDT 2022


MaskRay added inline comments.


================
Comment at: lldb/test/Shell/ObjectFile/ELF/compressed-sections-zstd.yaml:19
+    Content:         deadbeefbaadf00d
+## The legacy .zdebug format is not supported.
+  - Name:            .zdebug_info
----------------
Delete `.zdebug`. It is unrelated to zstd


================
Comment at: lldb/test/Shell/ObjectFile/ELF/compressed-sections-zstd.yaml:26
+# CHECK-NEXT: Type: regular
+# CHECK: VM address: 0
+# CHECK-NEXT: VM size: 0
----------------
Align


================
Comment at: llvm/lib/Object/Decompressor.cpp:48
+  if (ELFCompressionSchemeId == ELFCOMPRESS_ZSTD)
+    CompressionType = llvm::DebugCompressionType::Zstd;
+
----------------
Use a switch so that in the case of new compression format, the code get notified  due to -Wswitch


================
Comment at: llvm/lib/Object/Decompressor.cpp:52
     return createError("unsupported compression type");
+  if (llvm::compression::getReasonIfUnsupported(
+          compression::formatFor(CompressionType)) != nullptr) {
----------------
Just use the return type of `getReasonIfUnsupported` as the error message


================
Comment at: llvm/lib/Object/Decompressor.cpp:74
   size_t Size = Buffer.size();
-  return compression::zlib::uncompress(arrayRefFromStringRef(SectionData),
-                                       Buffer.data(), Size);
+  return compression::decompress(compression::formatFor(CompressionType),
+                                 arrayRefFromStringRef(SectionData),
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133530/new/

https://reviews.llvm.org/D133530



More information about the lldb-commits mailing list