This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Patch to handle compressed sections
- From: Thiago Jung Bauermann <bauerman at br dot ibm dot com>
- To: Craig Silverstein <csilvers at google dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 26 Mar 2008 13:09:39 -0300
- Subject: Re: Patch to handle compressed sections
- References: <20080325230440.BF0623F25D6@localhost>
On Tue, 2008-03-25 at 16:04 -0700, Craig Silverstein wrote:
> This patch adds support for reading compressed debug sections, as are
> produced by the new gold linker when it's run with
> --compress-debug-sections=zlib.
Neat. Out of curiosity, does this approach work well in practice? If you
need to compress debug info, it means you are dealing with a very large
amount of it. Isn't it cumbersome for GDB to deal with it later? I
imagine it must be slow to wait for GDB to uncompress and interpret it
all, and it must use a very big amount of memory.
It's a trade-off where you ease the burden on the computer where the
program runs, and permits you to have debuginfo around where you
probably couldn't before, but on the other hand you need a lot of
resources to actually be able to work with that debuginfo in a debug
environment, right?
> +/* Note that if the debugging section has been compressed, it might
> + have a name like .debug_info.zlib.nnnn (where nnn is the
> + uncompressed size). */
I am not as fluent in ELF and DWARF representation as I would like, so
take this for what it's worth:
Encoding this information in the section name looks strange to me. Isn't
it possible to define a new flag in the section's sh_flags to signal
that the section is compressed and then use the first few bytes of the
section contents for the information above?
Or alternatively, create a note section for that? This route might be
easier in that it doesn't raise compatibility concerns, and there's no
immediate need to actually extend the ELF standard.
> + /* Handle the case of a section compressed using zlib. */
> + if (strncmp (compression_type, ".zlib.", sizeof(".zlib.")-1) == 0)
> + {
> +#ifndef HAVE_ZLIB_H
> + error (_("Dwarf Error: Can't uncompress zlib-compressed DWARF data "
> + "in '%s'"),
> + bfd_get_filename (abfd));
> +#else
I think it's better for this error message to say something along the
lines of "Support for compressed DWARF data is disabled in this copy of
GDB".
--
[]'s
Thiago Jung Bauermann
Software Engineer
IBM Linux Technology Center