This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: objdump -S omits source when input uses .gnu_debuglink
Andreas Schwab <schwab@suse.de> writes:
> Nick Clifton <nickc@redhat.com> writes:
>
>> Hi Noah,
>>
>>> When an object's debugging information resides in a separate file, linked via a
>>> .gnu_debuglink section, `objdump -S' does not show source code; the output is
>>> rigorously identical to that of `objdump -d'.
>>
>> Hmm, this was not quite as straightforward as I would have hoped, but I
>> think there is a way to do it. Please could you try out the attached
>> patch and let me know if it works for you.
>
> This does not work with a separate debug directory.
And here is a patch to fix that.
Andreas.
2007-06-22 Andreas Schwab <schwab@suse.de>
* configure.in (--with-separate-debug-dir): New option.
* configure: Regenerate.
* Makefile.am (dwarf2.lo): Add rule to pass DEBUGDIR.
* Makefile.in: Regenerate.
* dwarf2.c (_bfd_dwarf2_find_nearest_line): Pass DEBUGDIR to
bfd_follow_gnu_debuglink.
(_bfd_dwarf2_find_line): Likewise.
Index: bfd/Makefile.am
===================================================================
RCS file: /cvs/src/src/bfd/Makefile.am,v
retrieving revision 1.197
diff -u -a -p -r1.197 Makefile.am
--- bfd/Makefile.am 14 Jun 2007 15:30:59 -0000 1.197
+++ bfd/Makefile.am 22 Jun 2007 13:06:24 -0000
@@ -784,6 +784,9 @@ targets.lo: targets.c Makefile
archures.lo: archures.c Makefile
$(LIBTOOL) --mode=compile $(COMPILE) -c $(TDEFAULTS) $(srcdir)/archures.c
+dwarf2.lo: dwarf2.c Makefile
+ $(LIBTOOL) --mode=compile $(COMPILE) -c -DDEBUGDIR=\"$(DEBUGDIR)\" $(srcdir)/dwarf2.c
+
elf32-target.h : elfxx-target.h
rm -f elf32-target.h
sed -e s/NN/32/g < $(srcdir)/elfxx-target.h > elf32-target.new
Index: bfd/configure.in
===================================================================
RCS file: /cvs/src/src/bfd/configure.in,v
retrieving revision 1.228
diff -u -a -p -r1.228 configure.in
--- bfd/configure.in 24 Apr 2007 04:05:03 -0000 1.228
+++ bfd/configure.in 22 Jun 2007 13:06:25 -0000
@@ -66,6 +66,14 @@ if test $use_secureplt = true; then
[Define if we should default to creating read-only plt entries])
fi
+DEBUGDIR=${libdir}/debug
+
+AC_ARG_WITH(separate-debug-dir,
+ AS_HELP_STRING([--with-separate-debug-dir=DIR],
+ [Look for global separate debug info in DIR [[default=LIBDIR/debug]]]),
+[DEBUGDIR=${withval}])
+AC_SUBST(DEBUGDIR)
+
ACX_PKGVERSION([GNU Binutils])
ACX_BUGURL([http://www.sourceware.org/bugzilla/])
Index: bfd/dwarf2.c
===================================================================
RCS file: /cvs/src/src/bfd/dwarf2.c,v
retrieving revision 1.94
diff -u -a -p -r1.94 dwarf2.c
--- bfd/dwarf2.c 22 Jun 2007 08:13:12 -0000 1.94
+++ bfd/dwarf2.c 22 Jun 2007 13:06:25 -0000
@@ -2378,7 +2378,7 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd
msec = find_debug_info (abfd, NULL);
if (msec == NULL)
{
- char * debug_filename = bfd_follow_gnu_debuglink (abfd, NULL);
+ char * debug_filename = bfd_follow_gnu_debuglink (abfd, DEBUGDIR);
if (debug_filename == NULL)
/* No dwarf2 info, and no gnu_debuglink to follow.
@@ -2617,7 +2617,7 @@ _bfd_dwarf2_find_line (bfd *abfd,
msec = find_debug_info (abfd, NULL);
if (msec == NULL)
{
- char * debug_filename = bfd_follow_gnu_debuglink (abfd, NULL);
+ char * debug_filename = bfd_follow_gnu_debuglink (abfd, DEBUGDIR);
if (debug_filename == NULL)
/* No dwarf2 info, and no gnu_debuglink to follow.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."