public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "mark at klomp dot org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/29584] gdb: support zstd compressed .gnu_debugdata
Date: Sun, 19 Feb 2023 13:23:28 +0000	[thread overview]
Message-ID: <bug-29584-4717-ycCHbm8zzO@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-29584-4717@http.sourceware.org/bugzilla/>

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

--- Comment #7 from Mark Wielaard <mark at klomp dot org> ---
(In reply to Fangrui Song from comment #5)
> (In reply to Mark Wielaard from comment #4)
> > If we are changing the format, Can't we use standard ELF section compression?
> > That supports zstd these days. Then the .gnu_debugdata can be just a normal
> > ELF section, that is a mini-ELF image, which happens to be zstd compressed.
> 
> We can do that but it likely doesn't provide an overall advantage.
>
> The .gnu_debugdata content is an ELF file, not a regular section.
> We don't benefit from information like ch_type/ch_size/ch_addrline
> in the Chdr header.

I think it does provide an advantage because programs already need to handle
standard compressed Elf sections, so they don't need any special code for
decompressing this (assuming we'll drop the old compression scheme eventually).

> To embed an ELF file (with .symtab, .strtab, and optionally .debug_*), we
> need
> one `objcopy --add-section` command, then one `eu-elfcompress -n` command
> (with
> no binutils equivalent
> https://sourceware.org/bugzilla/show_bug.cgi?id=27452).
> Even eu-elfcompress -n doesn't provide the various zstd options that a
> distribution may toggle.

There is already support in eu-elfcompress, it will show up in the next release
(0.189, hopefully later this month):

  -n, --name=SECTION         SECTION name to (de)compress, SECTION is an
                             extended wildcard pattern (defaults to
                             '.?(z)debug*')
[...]
  -t, --type=TYPE            What type of compression to apply. TYPE can be
                             'none' (decompress), 'zlib' (ELF ZLIB compression,
                             the default, 'zlib-gabi' is an alias), 'zlib-gnu'
                             (.zdebug GNU style compression, 'gnu' is an alias)
                             or 'zstd' (ELF ZSTD compression)

> Also, this process involves two binary manipulation commands on
> the ELF file.
> 
> If we use `zstd a.debug; objcopy -S
> --add-section=.gnu_debugdata=a.debug.zstd a a.stripped`,
> there is just one binary manipulation command, and we can toggle zstd
> options easily.

It is slightly more that that. See debugedit find-debuginfo add_mini how the
section is created:
https://sourceware.org/git/?p=debugedit.git;a=blob;f=scripts/find-debuginfo.in;hb=HEAD#l332

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

  parent reply	other threads:[~2023-02-19 13:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-19  4:24 [Bug gdb/29584] New: " i at maskray dot me
2022-09-19  4:24 ` [Bug gdb/29584] " i at maskray dot me
2022-09-27  2:54 ` i at maskray dot me
2023-02-16  2:55 ` i at maskray dot me
2023-02-16  6:15 ` tromey at sourceware dot org
2023-02-16  6:25 ` i at maskray dot me
2023-02-16  9:08 ` mark at klomp dot org
2023-02-16 17:42 ` i at maskray dot me
2023-02-16 21:46 ` tromey at sourceware dot org
2023-02-19 13:23 ` mark at klomp dot org [this message]
2023-02-19 19:24 ` i at maskray dot me
2024-03-15  9:16 ` sam at gentoo dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-29584-4717-ycCHbm8zzO@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).