Re: RFC: Handling dwz multi debuginfo files

From: Mark Wielaard <mjw at redhat dot com>

To: elfutils-devel at lists dot fedorahosted dot org

Date: Tue, 31 Jul 2012 16:34:50 +0200

Subject: Re: RFC: Handling dwz multi debuginfo files

On Wed, 2012-06-27 at 23:33 +0200, Mark Wielaard wrote:
> This patch adds support for dwz multi debuginfo files to libdw.
> Fedora is planning to use these in the next release:
> https://fedoraproject.org/wiki/Features/DwarfCompressor
> The new DW_FORMs are proposed for DWARF5:
> http://www.dwarfstd.org/ShowIssue.php?issue=120604.1
> But are currently only a GNU extension written by the dwz tool:
> http://sourceware.org/git/?p=dwz.git;a=summary
>
> libdw was already setup anticipating such a scheme, so adding support
> wasn't so hard. Basically a Dwarf descriptor can now have an alternative
> Dwarf descriptor that is consulted whenever one of the new DW_FROM_*alts
> is seen.
>
> dwarf_begin_elf will find the right dwz alternative to use. But this is
> currently tied somewhat to how fedora implemented this. There are also
> two new functions dwarf_getalt () and dwarf_addalt () that can be used
> to directly manipulate the alternative Dwarf descriptor. I anticipate
> those will be used by some new libdwfl callbacks if we decide those are
> necessary to support other ways to get/set alternative Dwarf
> descriptors.
We (Roland, Petr and I) briefly discussed this and thought it better to
not introduce any new interfaces for this at this point. So this new
patch removes them and makes things a little simpler. There are no user
visible changes except that debug files with a separate dwz multi file
now just work. In the future libdwfl may use internal calls, which it
already does, when it supports sharing (I looked briefly at the
pmachata/sharing branch, but that is a lot of code and needs works to
bring it forward to 2012 - the branch is from 2007). The patch (and the
branch) are also rebased against current master and fixed a typo that
Tom Tromey found in some comments.
There is a testcase included and I tested with systemtap on fedora
rawhide, which recently switched to using the dwz compressor on all
packages.
Patch also on mjw/dwz branch. Please take a look and yell and scream if
anything looks odd.
Thanks,
Mark