public inbox for debugedit@sourceware.org
 help / color / mirror / Atom feed
* [Bug debugedit/27636] New: Debugedit doesn't handle compressed debug ELF sections
@ 2021-03-23 14:19 mark at klomp dot org
  2023-12-05 14:14 ` [Bug debugedit/27636] " mark at klomp dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: mark at klomp dot org @ 2021-03-23 14:19 UTC (permalink / raw)
  To: debugedit

https://sourceware.org/bugzilla/show_bug.cgi?id=27636

            Bug ID: 27636
           Summary: Debugedit doesn't handle compressed debug ELF sections
           Product: debugedit
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: debugedit
          Assignee: unassigned at sourceware dot org
          Reporter: mark at klomp dot org
                CC: debugedit at sourceware dot org
  Target Milestone: ---

When seeing compressed debug ELF sections debugedit gets confused:

debugedit: ./foo.o: DWARF version 0 unhandled

This is a somewhat useless error message.

We should at least detect SHF_COMPRESSED (or .zdebug...) and explicitly say we
don't handle compressed sections.

If we do decide to handle compressed sections there are a couple of ways:
- Do we simply always uncompress and leave it that way?
- Do we recompress afterwards?
- Do we require an explicit flag to (de/re)compress?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug debugedit/27636] Debugedit doesn't handle compressed debug ELF sections
  2021-03-23 14:19 [Bug debugedit/27636] New: Debugedit doesn't handle compressed debug ELF sections mark at klomp dot org
@ 2023-12-05 14:14 ` mark at klomp dot org
  2023-12-11 13:59 ` mark at klomp dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mark at klomp dot org @ 2023-12-05 14:14 UTC (permalink / raw)
  To: debugedit

https://sourceware.org/bugzilla/show_bug.cgi?id=27636

--- Comment #1 from Mark Wielaard <mark at klomp dot org> ---
https://sourceware.org/pipermail/debugedit/2022-November/000160.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug debugedit/27636] Debugedit doesn't handle compressed debug ELF sections
  2021-03-23 14:19 [Bug debugedit/27636] New: Debugedit doesn't handle compressed debug ELF sections mark at klomp dot org
  2023-12-05 14:14 ` [Bug debugedit/27636] " mark at klomp dot org
@ 2023-12-11 13:59 ` mark at klomp dot org
  2023-12-11 14:01 ` mark at klomp dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mark at klomp dot org @ 2023-12-11 13:59 UTC (permalink / raw)
  To: debugedit

https://sourceware.org/bugzilla/show_bug.cgi?id=27636

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #2 from Mark Wielaard <mark at klomp dot org> ---
commit 3e7aeeab4f744ad15108775685db68d3a35b0735
Author: Mark Wielaard <mark@klomp.org>
Date:   Thu Mar 23 18:07:40 2023 +0100

    debugedit: Add support for .debug_str_offsets (DW_FORM_strx)

    In theory supporting strx .debug_str_offsets is easy, the strings in
    .debug_str are just read through an indirection table. When the
    strings are updated in .debug_str we just need to rewrite the
    indirection table.

    The tricky part is the ET_REL (object files or kernel modules)
    support. Relocation reading is "global" per section and we expect to
    read a relocation only once. But we need to read the
    DW_AT_str_offsets_base before reading any strx form attributes. So we
    read that first, then reset the relptr. And when we read from the
    .debug_str_offsets section we need to save and restore the .debug_info
    relptr.

            * tools/debugedit.c (do_read_24): New function.
            (str_offsets_base): New static variable.
            (buf_read_ule24): New function.
            (buf_read_ube24): Likewise.
            (setup_relbuf): Handle .debug_str_offsets.
            (do_read_uleb128): New function.
            (do_read_str_form_relocated): Likewise.
            (read_abbrev): Handle DW_FORM_strx[1234].
            (edit_strp): Take the actual string form as argument.
            Use do_read_str_form_relocated.
            (read_dwarf5_line_entries): Pass form to edit_strp.
            (edit_attributes_str_comp_dir): Take the actual string
            form as argument. Use do_read_str_form_relocated.
            (edit_attributes): Handle DW_FORM_strx[1234].
            (edit_info): Read DW_AT_str_offsets_base first.
            (update_str_offsets): New function.
            (edit_dwarf2): Setup do_read_24. Call update_str_offsets.

    https://sourceware.org/bugzilla/show_bug.cgi?id=28728

    Signed-off-by: Mark Wielaard <mark@klomp.org>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug debugedit/27636] Debugedit doesn't handle compressed debug ELF sections
  2021-03-23 14:19 [Bug debugedit/27636] New: Debugedit doesn't handle compressed debug ELF sections mark at klomp dot org
  2023-12-05 14:14 ` [Bug debugedit/27636] " mark at klomp dot org
  2023-12-11 13:59 ` mark at klomp dot org
@ 2023-12-11 14:01 ` mark at klomp dot org
  2024-06-27  7:56 ` hjl.tools at gmail dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mark at klomp dot org @ 2023-12-11 14:01 UTC (permalink / raw)
  To: debugedit

https://sourceware.org/bugzilla/show_bug.cgi?id=27636

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #3 from Mark Wielaard <mark at klomp dot org> ---
Sorry, wrong bug. sigh.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug debugedit/27636] Debugedit doesn't handle compressed debug ELF sections
  2021-03-23 14:19 [Bug debugedit/27636] New: Debugedit doesn't handle compressed debug ELF sections mark at klomp dot org
                   ` (2 preceding siblings ...)
  2023-12-11 14:01 ` mark at klomp dot org
@ 2024-06-27  7:56 ` hjl.tools at gmail dot com
  2024-08-19 17:16 ` mark at klomp dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: hjl.tools at gmail dot com @ 2024-06-27  7:56 UTC (permalink / raw)
  To: debugedit

https://sourceware.org/bugzilla/show_bug.cgi?id=27636

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |NEW

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug debugedit/27636] Debugedit doesn't handle compressed debug ELF sections
  2021-03-23 14:19 [Bug debugedit/27636] New: Debugedit doesn't handle compressed debug ELF sections mark at klomp dot org
                   ` (3 preceding siblings ...)
  2024-06-27  7:56 ` hjl.tools at gmail dot com
@ 2024-08-19 17:16 ` mark at klomp dot org
  2024-10-28 13:31 ` mark at klomp dot org
  2025-03-04 15:31 ` mark at klomp dot org
  6 siblings, 0 replies; 8+ messages in thread
From: mark at klomp dot org @ 2024-08-19 17:16 UTC (permalink / raw)
  To: debugedit

https://sourceware.org/bugzilla/show_bug.cgi?id=27636

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://sourceware.org/bugz
                   |                            |illa/show_bug.cgi?id=32102

--- Comment #4 from Mark Wielaard <mark at klomp dot org> ---
(In reply to Mark Wielaard from comment #0)
> If we do decide to handle compressed sections there are a couple of ways:
> - Do we simply always uncompress and leave it that way?
> - Do we recompress afterwards?

Adding this to the patch suggested in comment #1 ran into this elfutils bug:
https://sourceware.org/bugzilla/show_bug.cgi?id=32102

So for now the easiest way is to just uncompress and leave it like that.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug debugedit/27636] Debugedit doesn't handle compressed debug ELF sections
  2021-03-23 14:19 [Bug debugedit/27636] New: Debugedit doesn't handle compressed debug ELF sections mark at klomp dot org
                   ` (4 preceding siblings ...)
  2024-08-19 17:16 ` mark at klomp dot org
@ 2024-10-28 13:31 ` mark at klomp dot org
  2025-03-04 15:31 ` mark at klomp dot org
  6 siblings, 0 replies; 8+ messages in thread
From: mark at klomp dot org @ 2024-10-28 13:31 UTC (permalink / raw)
  To: debugedit

https://sourceware.org/bugzilla/show_bug.cgi?id=27636

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at sourceware dot org   |mark at klomp dot org

--- Comment #5 from Mark Wielaard <mark at klomp dot org> ---
Sorry this took so long, I worked around the elfutils bug (even though it is
now fixed in 0.192):
https://inbox.sourceware.org/debugedit/20241028133015.3213072-1-mark@klomp.org/

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug debugedit/27636] Debugedit doesn't handle compressed debug ELF sections
  2021-03-23 14:19 [Bug debugedit/27636] New: Debugedit doesn't handle compressed debug ELF sections mark at klomp dot org
                   ` (5 preceding siblings ...)
  2024-10-28 13:31 ` mark at klomp dot org
@ 2025-03-04 15:31 ` mark at klomp dot org
  6 siblings, 0 replies; 8+ messages in thread
From: mark at klomp dot org @ 2025-03-04 15:31 UTC (permalink / raw)
  To: debugedit

https://sourceware.org/bugzilla/show_bug.cgi?id=27636

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #6 from Mark Wielaard <mark at klomp dot org> ---
commit c156ae62c3913aa86bd4cd4abda93772747e029f
Author:     Morten Linderud <morten@linderud.pw>
AuthorDate: Sun Nov 6 18:10:23 2022 +0100
Commit:     Mark Wielaard <mark@klomp.org>
CommitDate: Mon Oct 28 14:28:16 2024 +0100

    debugedit: decompress (and recompress) DWARF sections

    When encountering compressed DWARF section try to decompress them
    before rewriting. Afterwards recompress them. All this is
    automatic. No new command line options.

    Decompression was added by Morten, Mark then added recompression.

    The recompression support needed a bit of workaround for an elfutils
    < 0.192 bug https://sourceware.org/bugzilla/show_bug.cgi?id=32102

    Various new tests were added. In debugedit.at DEBUGEDIT_SETUP now
    takes an (optional) second arg to set the -gz=... option. readelf is
    now called with -zp to automatically decompress any compressed
    data/string sections.

    https://sourceware.org/bugzilla/show_bug.cgi?id=27636

    Signed-off-by: Morten Linderud <morten@linderud.pw>
    Signed-off-by: Mark Wielaard <mark@klomp.org>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-03-04 15:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-23 14:19 [Bug debugedit/27636] New: Debugedit doesn't handle compressed debug ELF sections mark at klomp dot org
2023-12-05 14:14 ` [Bug debugedit/27636] " mark at klomp dot org
2023-12-11 13:59 ` mark at klomp dot org
2023-12-11 14:01 ` mark at klomp dot org
2024-06-27  7:56 ` hjl.tools at gmail dot com
2024-08-19 17:16 ` mark at klomp dot org
2024-10-28 13:31 ` mark at klomp dot org
2025-03-04 15:31 ` mark at klomp dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).