On Wed, 2013-12-18 at 11:41 +0100, Mark Wielaard wrote:
On Sat, 2013-12-14 at 23:59 +0100, Mark Wielaard wrote:
> Extra testcases were added for both addr2line and the dwflsyms testscase.
I added some more tests based on the already existing dwflsyms testcases
for separate debuginfo, minisymtab and prelinked files, but now
generated on ppc64. Which revealed a couple of corner case issues. In
particular when retrying to match the (resolved) value in
dwfl_module_addrinfo we need to first check the address is actually
larger than the one we are looking for. And we needed to keep better
track of the elf file the symbol is defined in, which we always want to
return to the user if requested, but we possibly want to check the
address against the main elf file to check the section matches. For this
last issue a resolved flag was introduced.
Besides these fixes, a rebase on master, a NEWS update and the new tests
the patch is the same as the previous one. (Also on mjw/opd branch.)
I pushed this variant to master now. It helped find several other bugs
in the unwinder [testcases] (on ppc64) as reported on the list, but I
didn't find any new issues with the actual code.
Cheers,
Mark
From f4e15a20d5fa276ae6d7aa3e450eab9bec7f3415 Mon Sep 17 00:00:00
2001
From: Mark Wielaard <mjw(a)redhat.com>
Date: Wed, 18 Dec 2013 11:05:54 +0100
Subject: [PATCH] libdwfl: Introduce dwfl_module_getsym_info and dwfl_module_addrinfo.
Some arches like ppc64 use function descriptor values instead of function
addresses causing matching of names and addresses to fail when using
dwfl_module_getsym or dwfl_module_addrsym.
Add ebl hook to resolve any function descriptor values found in non-ET_REL
modules.
The new function dwfl_module_getsym_info doesn't adjust the symbol value
in any way, but returns the adjusted and/or resolved address associated
with the symbol separately. The new function dwfl_module_addrinfo resolves
against both the address associated with the symbol (which could be the
function entry address) value and the adjusted st_value. So that it is
easy to resolve and match either function descriptors and/or function
entry addresses.
Since these new functions also return more information they replace the
dwfl_module_getsym_elf and dwfl_module_addrsym_elf functions that never
made it into a released elfutils version.
addr2line and readelf now use the new functions when looking up functions
names. addr2line will now also display the section the address was found
in when given -x.
Extra testcases were added for both addr2line and the dwflsyms testscase.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
ChangeLog | 6 +
NEWS | 3 +
backends/ChangeLog | 7 +
backends/Makefile.am | 2 +-
backends/ppc64_init.c | 30 ++
backends/ppc64_resolve_sym.c | 63 +++
libdw/ChangeLog | 6 +
libdw/libdw.map | 4 +-
libdwfl/ChangeLog | 31 ++
libdwfl/derelocate.c | 13 +-
libdwfl/dwfl_module_addrname.c | 6 +-
libdwfl/dwfl_module_addrsym.c | 220 +++++++----
libdwfl/dwfl_module_getsym.c | 63 +++-
libdwfl/libdwfl.h | 80 +++-
libdwfl/libdwflP.h | 27 ++-
libebl/ChangeLog | 9 +
libebl/Makefile.am | 2 +-
libebl/ebl-hooks.h | 5 +
.../eblresolvesym.c | 21 +-
libebl/libebl.h | 6 +
libebl/libeblP.h | 5 +
src/ChangeLog | 12 +
src/addr2line.c | 54 +++-
src/readelf.c | 16 +-
tests/ChangeLog | 22 +
tests/Makefile.am | 7 +-
tests/dwflsyms.c | 59 +++-
tests/run-addrname-test.sh | 35 ++
tests/run-dwflsyms.sh | 413 ++++++++++++++++++++
tests/testfile66.bz2 | Bin 0 -> 741 bytes
tests/testfile66.core.bz2 | Bin 0 -> 56448 bytes
tests/testfilebazdbgppc64.bz2 | Bin 0 -> 2366 bytes
tests/testfilebazdbgppc64.debug.bz2 | Bin 0 -> 2295 bytes
tests/testfilebazdbgppc64_pl.bz2 | Bin 0 -> 2775 bytes
tests/testfilebazdbgppc64_plr.bz2 | Bin 0 -> 2399 bytes
tests/testfilebazdynppc64.bz2 | Bin 0 -> 2327 bytes
tests/testfilebazmdbppc64.bz2 | Bin 0 -> 3528 bytes
tests/testfilebazminppc64.bz2 | Bin 0 -> 3464 bytes
tests/testfilebazminppc64_pl.bz2 | Bin 0 -> 3900 bytes
tests/testfilebazminppc64_plr.bz2 | Bin 0 -> 3535 bytes
tests/testfilebaztabppc64.bz2 | Bin 0 -> 3697 bytes
41 files changed, 1076 insertions(+), 151 deletions(-)
create mode 100644 backends/ppc64_resolve_sym.c
copy libdwfl/dwfl_module_addrname.c => libebl/eblresolvesym.c (72%)
create mode 100755 tests/testfile66.bz2
create mode 100644 tests/testfile66.core.bz2
create mode 100755 tests/testfilebazdbgppc64.bz2
create mode 100755 tests/testfilebazdbgppc64.debug.bz2
create mode 100755 tests/testfilebazdbgppc64_pl.bz2
create mode 100755 tests/testfilebazdbgppc64_plr.bz2
create mode 100755 tests/testfilebazdynppc64.bz2
create mode 100755 tests/testfilebazmdbppc64.bz2
create mode 100755 tests/testfilebazminppc64.bz2
create mode 100755 tests/testfilebazminppc64_pl.bz2
create mode 100755 tests/testfilebazminppc64_plr.bz2
create mode 100755 tests/testfilebaztabppc64.bz2