libdw errors for DW_FORM_GNU_strp_alt attributes

Mark Wielaard mjw at redhat.com
Mon Apr 7 14:37:31 UTC 2014


On Fri, 2014-04-04 at 13:47 +0200, Florian Weimer wrote:
> If I run the attached test program on the file 
> /usr/lib/debug/usr/bin/bsdiff.debug from the Fedora package 
> bsdiff-debuginfo-4.3-12.fc20.x86_64, I get the following output:
> 
> Compilation unit at offset 0, tag 17:
>    name (format 0xe): "bsdiff.c"
>    comp_dir (format 0x1f21) present with error 36: no alternative debug 
> link found
>    producer (format 0x1f21) present with error 36: no alternative debug 
> link found

That means those attributes use DW_FORM_GNU_ref_alt or
DW_FORM_GNU_strp_alt and are referencing a value in the alternative
debug file. The error means that alternative debug file wasn't found.

> How can I obtain these attributes?

If elfutils was configure with --enable-dwz then it should automagically
find the alternative debug (dwz) file. And it does for me on f20 with
elfutils-libs-0.158-1.fc20.x86_64:

./report-cu /usr/lib/debug/usr/bin/bsdiff.debug
Compilation unit at offset 0, tag 17:
  name (format 0xe): "bsdiff.c"
  comp_dir (format 0x1f21): "/usr/src/debug/bsdiff-4.3"
  producer (format 0x1f21): "GNU C 4.8.1 20130717 (Red Hat 4.8.1-5) -m64 -mtune=generic -march=x86-64 -g -O2 -fexceptions -fstack-protector-strong --param ssp-buffer-size=4"

The alt file is found by inspecting the .gnu_debugaltlink section in the
bsdiff.debug file and resolving either the file name
(../../.dwz/bsdiff-4.3-12.fc20.x86_64 which
is /lib/debug/.dwz/bsdiff-4.3-12.fc20.x86_64) or the build-id given in
that section (42643ed4e062195a11211c3696fc5e6cec73d0fb) which resolves
to /lib/debug/.build-id/42/643ed4e062195a11211c3696fc5e6cec73d0fb.debug
-> ../../.dwz/bsdiff-4.3-12.fc20.x86_64 (the same file through a soft
link).

We currently don't have an interface to explicitly set the alt-debug
file for a Dwarf but should (and then the magic lookup should be moved
from libdw to libdwfl, but that has as drawback that a simple
dwarf_begin () won't set it automagically anymore and you'll have to
either use dwfl_begin () to set it automagically or use an explicit
setter for it).

Cheers,

Mark



More information about the elfutils-devel mailing list