[Lldb-commits] [lldb] ecfaf48 - [lldb] Remove ELF .zdebug support

Fangrui Song via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 14 10:12:52 PDT 2022


Author: Fangrui Song
Date: 2022-07-14T10:12:48-07:00
New Revision: ecfaf4801cd0cc85fdced820110652f0281765fa

URL: https://github.com/llvm/llvm-project/commit/ecfaf4801cd0cc85fdced820110652f0281765fa
DIFF: https://github.com/llvm/llvm-project/commit/ecfaf4801cd0cc85fdced820110652f0281765fa.diff

LOG: [lldb] Remove ELF .zdebug support

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.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D129724

Added: 
    

Modified: 
    lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
    lldb/test/Shell/ObjectFile/ELF/compressed-sections.yaml

Removed: 
    lldb/test/Shell/SymbolFile/DWARF/x86/gnu-style-compression.yaml


################################################################################
diff  --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index f9fb36890d5ac..122298d87bf8d 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1607,7 +1607,7 @@ lldb::user_id_t ObjectFileELF::GetSectionIndexByName(const char *name) {
 }
 
 static SectionType GetSectionTypeFromName(llvm::StringRef Name) {
-  if (Name.consume_front(".debug_") || Name.consume_front(".zdebug_")) {
+  if (Name.consume_front(".debug_")) {
     return llvm::StringSwitch<SectionType>(Name)
         .Case("abbrev", eSectionTypeDWARFDebugAbbrev)
         .Case("abbrev.dwo", eSectionTypeDWARFDebugAbbrevDwo)
@@ -3365,8 +3365,7 @@ size_t ObjectFileELF::ReadSectionData(Section *section,
     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(

diff  --git a/lldb/test/Shell/ObjectFile/ELF/compressed-sections.yaml b/lldb/test/Shell/ObjectFile/ELF/compressed-sections.yaml
index e252713210e62..d4d289954801a 100644
--- a/lldb/test/Shell/ObjectFile/ELF/compressed-sections.yaml
+++ b/lldb/test/Shell/ObjectFile/ELF/compressed-sections.yaml
@@ -16,6 +16,7 @@ Sections:
     Type:            SHT_PROGBITS
     Flags:           [ SHF_COMPRESSED ]
     Content:         deadbeefbaadf00d
+## The legacy .zdebug format is not supported.
   - Name:            .zdebug_info
     Type:            SHT_PROGBITS
     Content:         5A4C49420000000000000008789c5330700848286898000009c802c1
@@ -37,8 +38,8 @@ Sections:
 # CHECK-NEXT: Data: ()
 
 # CHECK: Name: .zdebug_info
-# CHECK: dwarf-info
+# CHECK: regular
 # CHECK: File size: 28
 # CHECK: Data: (
-# CHECK-NEXT: 20304050 60708090
+# CHECK-NEXT: 5A4C4942 00000000 00000008 789C5330 70084828 68980000 09C802C1
 # CHECK-NEXT: )

diff  --git a/lldb/test/Shell/SymbolFile/DWARF/x86/gnu-style-compression.yaml b/lldb/test/Shell/SymbolFile/DWARF/x86/gnu-style-compression.yaml
deleted file mode 100644
index 069753835474b..0000000000000
--- a/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
-...


        


More information about the lldb-commits mailing list