MiniDebugInfo support

Mark Wielaard mjw at redhat.com
Tue Nov 6 17:50:27 UTC 2012


On Tue, Nov 06, 2012 at 03:32:11PM +0100, Martin Milata wrote:
> The idea behind minidebuginfo is to take the separate debuginfo file
> that is created during the package build process, drop most of its
> sections except the symbol table, LZMA-compress it and put it into the
> .gnu_debugdata section of the binary being build. See the feature
> page [2] or GDB [3] and RPM [4] implementation if you want details.

The name seems a little confusing. It isn't "mini-debuginfo", it really
is a stripped down and compressed symbol table. It is useful when there
is no separate debuginfo file that contains the symtab. Though a bit
cumbersome to get at since it is inside a section that needs to be
decompressed, which makes it only really usefull for the offline case.

How standardized is this? Is it just for Fedora or do other distros
also use it? Is the support in GDB and RPM upstream or only in the
Fedora packages? Can it be seen as a standard GNU extension?
 
> Thanks to the find_debuginfo callback in libdwfl, it is very simple to
> implement the support in the application -- if regular debuginfo file is
> not found we can extract the .gnu_debugdata section to a temporary file
> and make the library use it, and then delete it when it's not needed
> anymore.

Do you have this implemented this way already? If so could you provide
a link?
 
> However, if elfutils supported this feature directly, more users can
> benefit from it. I'd like to try to put together a patch for that, but
> it is not clear to me how to go about this. Implementing this as a
> standard callback probably requires creating a temporary file as the
> library needs a file descriptor of the debuginfo. We can then keep track
> of the file and delete it afterwards, or unlink it immediately after
> opening it - but that would prevent us from returning a meaningful file
> name...
> 
> So essentially, I have two questions:
> 1) Is such functionality desirable in elfutils?
> 2) What is the right way to add the support for it to the library?

If there is no symtab/strtab available I guess this could be used
as fallback for dwfl_module_getsymtab()/dwfl_module_getsym(). It would
probably be a good idea if there was some way to find out if the
data comes from a real symtab or from this minisymtab, since if it
comes from the minisymtab it will be incomplete. Maybe we just want
different functions for accessing it, but it seems such a close
match that it might be worth it to see if we can somehow make this
transparently available to any application using dwfl_module_getsymtab()
and dwfl_module_getsym(), assuming applications won't get confused
about the reduced symbol set (I think it might be fine, but if not
someone will certainly yell and scream I am missing something obvious).

libdwfl already has support for handling compressed data directly,
see the code in libdwfl/open.c used for compressed kernel images and
the code in dwarf_begin_elf.c to support compressed debuginfo sections,
so no need to write out temporary files. You'll need some variant of
that to use the compressed image.

I think it makes the most sense to hide it all behind an interface
(like) dwfl_module_getsymtab() and dwfl_module_getsym(). But maybe a
case can be made for supporting something more low-level and make it
easily possible to get an Elf handle for the image in the section
from a Dwfl?

Cheers,

Mark


More information about the elfutils-devel mailing list