[Lldb-commits] [PATCH] D129724: [lldb] Remove ELF .zdebug support

Fangrui Song via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 13 20:09:28 PDT 2022


MaskRay created this revision.
MaskRay added reviewers: ckissane, labath.
Herald added subscribers: StephenFan, emaste.
Herald added a reviewer: alexander-shaposhnikov.
Herald added a project: All.
MaskRay requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

clang 14 removed -gz=zlib-gnu support and ld.lld/llvm-objcopy removed zlib-gnu
support recently. Remove lldb support by migrating away from
llvm::object::Decompressor::isCompressedELFSection.
The API has another user llvm-dwp, so it is not removed in this patch.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129724

Files:
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/test/Shell/ObjectFile/ELF/compressed-sections.yaml
  lldb/test/Shell/SymbolFile/DWARF/x86/gnu-style-compression.yaml


Index: lldb/test/Shell/SymbolFile/DWARF/x86/gnu-style-compression.yaml
===================================================================
--- lldb/test/Shell/SymbolFile/DWARF/x86/gnu-style-compression.yaml
+++ /dev/null
@@ -1,56 +0,0 @@
-## NB: This is a yaml file because llvm gnu-style writing support in 14.0
-## (2022, D117744). In due time we may want to remove it from lldb as well.
-
-## Debug info generated from the following sources using clang-13
-## struct A {
-##  long a = 42;
-## };
-## extern constexpr short s = 47;
-## extern constexpr A a{};
-
-# REQUIRES: zlib
-
-# RUN: yaml2obj %s > %t
-# RUN: %lldb %t -o "target var s a" -b | FileCheck %s
-
-# CHECK: (const short) s = 47
-# CHECK: (const A) a = (a = 42)
-
---- !ELF
-FileHeader:
-  Class:           ELFCLASS64
-  Data:            ELFDATA2LSB
-  Type:            ET_EXEC
-  Machine:         EM_X86_64
-  Entry:           0x401000
-Sections:
-  - Name:            .rodata
-    Type:            SHT_PROGBITS
-    Flags:           [ SHF_ALLOC ]
-    Address:         0x401000
-    AddressAlign:    0x8
-    Offset:          0x1000
-    Content:         2F000000000000002A00000000000000
-  - Name:            .zdebug_info
-    Type:            SHT_PROGBITS
-    AddressAlign:    0x1
-    Content:         5A4C49420000000000000077789C2B666060606100010E4610A9C820CA00012640CCE407248C81989197939941C0012CC16C01D2130024589998C280540848011F2733074C4124488E35116C28171B48493E480937505B04488A830100368605A7
-  - Name:            .debug_abbrev
-    Type:            SHT_PROGBITS
-    AddressAlign:    0x1
-    Content:         011101250E1305030E10171B0E0000023400030E49133F193A0B3B0B0218000003260049130000042400030E3E0B0B0B0000051301360B030E0B0B3A0B3B0B0000060D00030E49133A0B3B0B380B000000
-  - Name:            .debug_line
-    Type:            SHT_PROGBITS
-    AddressAlign:    0x1
-    Content:         3C000000040036000000010101FB0E0D0001010101000000010000012F746D700000676E752D7374796C652D636F6D7072657373696F6E2E6370700001000000
-DWARF:
-  debug_str:
-    - clang version 13.0.0
-    - '/tmp/gnu-style-compression.cpp'
-    - '/tmp/my_working_directory'
-    - s
-    - short
-    - a
-    - long int
-    - A
-...
Index: lldb/test/Shell/ObjectFile/ELF/compressed-sections.yaml
===================================================================
--- lldb/test/Shell/ObjectFile/ELF/compressed-sections.yaml
+++ lldb/test/Shell/ObjectFile/ELF/compressed-sections.yaml
@@ -16,6 +16,7 @@
     Type:            SHT_PROGBITS
     Flags:           [ SHF_COMPRESSED ]
     Content:         deadbeefbaadf00d
+## The legacy .zdebug format is not supported, so the content is not uncompressed.
   - Name:            .zdebug_info
     Type:            SHT_PROGBITS
     Content:         5A4C49420000000000000008789c5330700848286898000009c802c1
@@ -40,5 +41,5 @@
 # CHECK: dwarf-info
 # CHECK: File size: 28
 # CHECK: Data: (
-# CHECK-NEXT: 20304050 60708090
+# CHECK-NEXT: 5A4C4942 00000000 00000008 789C5330 70084828 68980000 09C802C1
 # CHECK-NEXT: )
Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===================================================================
--- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -3365,8 +3365,7 @@
     return section->GetObjectFile()->ReadSectionData(section, section_data);
 
   size_t result = ObjectFile::ReadSectionData(section, section_data);
-  if (result == 0 || !llvm::object::Decompressor::isCompressedELFSection(
-                         section->Get(), section->GetName().GetStringRef()))
+  if (result == 0 || !(section->Get() & llvm::ELF::SHF_COMPRESSED))
     return result;
 
   auto Decompressor = llvm::object::Decompressor::create(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129724.444504.patch
Type: text/x-patch
Size: 3729 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220714/afaea334/attachment-0001.bin>


More information about the lldb-commits mailing list