Commit: addr2line: try harder to load symbols
Nick Clifton
nickc@redhat.com
Fri Mar 15 16:24:00 GMT 2013
Hi Guys,
I am applying the patch below to fix a problem with addr2line and ELF
targets. The problem is that bfd_get_symtab_upper_bound() will always
return a non-zero value (for ELF targets) because an extra entry is
allowed to null terminate the symtab vector. This means that, without
this patch, addr2line will never try to load the dynamic symbols even
if there are no ordinary symbols available.
Cheers
Nick
binutils/ChangeLog
2013-03-15 Nick Clifton <nickc@redhat.com>
* addr2line.c (slurp_symtab): If canonicalization reveals that
there were no ordinary symbols, try loading the dynamic symbols
instead.
Index: binutils/addr2line.c
===================================================================
RCS file: /cvs/src/src/binutils/addr2line.c,v
retrieving revision 1.43
diff -u -3 -p -r1.43 addr2line.c
--- binutils/addr2line.c 18 Jan 2013 13:14:35 -0000 1.43
+++ binutils/addr2line.c 15 Mar 2013 16:15:54 -0000
@@ -130,6 +130,17 @@ slurp_symtab (bfd *abfd)
symcount = bfd_canonicalize_symtab (abfd, syms);
if (symcount < 0)
bfd_fatal (bfd_get_filename (abfd));
+
+ /* If there are no symbols left after canonicalization and
+ we have not tried the dynamic symbols then give them a go. */
+ if (symcount == 0
+ && ! dynamic
+ && (storage = bfd_get_dynamic_symtab_upper_bound (abfd)) > 0)
+ {
+ free (syms);
+ syms = xmalloc (storage);
+ symcount = bfd_canonicalize_dynamic_symtab (abfd, syms);
+ }
}
/* These global variables are used to pass information between
More information about the Binutils
mailing list