From: Jan Kratochvil Date: Wed, 17 Oct 2012 19:49:10 +0000 (+0200) Subject: libdwfl/ X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2972c2a989cfd1ccc69939d34bc44c612b742d47;p=thirdparty%2Felfutils.git libdwfl/ 2012-10-17 Jan Kratochvil * dwfl_module_getdwarf.c (__libdwfl_getelf): Do not return yet on matching build-id. Check ELFERR before closing this MOD file. tests/ 2012-10-17 Jan Kratochvil * run-addrname-test.sh: New test for DSO with build-id bias. * testfile69.core.bz2: New file. * testfile69.so.bz2: New file. Signed-off-by: Jan Kratochvil --- diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 189d3b717..db3c9b7be 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,8 @@ +2012-10-17 Jan Kratochvil + + * dwfl_module_getdwarf.c (__libdwfl_getelf): Do not return yet on + matching build-id. Check ELFERR before closing this MOD file. + 2012-10-10 Jan Kratochvil * dwfl_segment_report_module.c (dwfl_segment_report_module): diff --git a/libdwfl/dwfl_module_getdwarf.c b/libdwfl/dwfl_module_getdwarf.c index bbf9ff3d8..fe0755b98 100644 --- a/libdwfl/dwfl_module_getdwarf.c +++ b/libdwfl/dwfl_module_getdwarf.c @@ -176,8 +176,8 @@ __libdwfl_getelf (Dwfl_Module *mod) mod->main.elf), 2)) { case 2: - /* Build ID matches as it should. */ - return; + /* Build ID matches as it should. But initialize MAIN_BIAS below. */ + break; case -1: /* ELF error. */ mod->elferr = INTUSE(dwfl_errno) (); @@ -192,13 +192,16 @@ __libdwfl_getelf (Dwfl_Module *mod) abort (); } - /* We get here when it was the right ELF file. Clear it out. */ - elf_end (mod->main.elf); - mod->main.elf = NULL; - if (mod->main.fd >= 0) + if (mod->elferr != DWFL_E_NOERROR) { - close (mod->main.fd); - mod->main.fd = -1; + /* We get here when it was the right ELF file. Clear it out. */ + elf_end (mod->main.elf); + mod->main.elf = NULL; + if (mod->main.fd >= 0) + { + close (mod->main.fd); + mod->main.fd = -1; + } } } diff --git a/tests/ChangeLog b/tests/ChangeLog index 2495fb58c..9e8ad2c15 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,9 @@ +2012-10-17 Jan Kratochvil + + * run-addrname-test.sh: New test for DSO with build-id bias. + * testfile69.core.bz2: New file. + * testfile69.so.bz2: New file. + 2012-10-10 Jan Kratochvil * run-addrname-test.sh: New test for core vDSO bias. diff --git a/tests/run-addrname-test.sh b/tests/run-addrname-test.sh index 4feb19365..cc8aa335a 100755 --- a/tests/run-addrname-test.sh +++ b/tests/run-addrname-test.sh @@ -298,4 +298,12 @@ __vdso_time ??:0 EOF +testfiles testfile69.core testfile69.so +testrun_compare ../src/addr2line --core=./testfile69.core -S 0x7f0bc6a33535 0x7f0bc6a33546 <<\EOF +libstatic+0x9 +??:0 +libglobal+0x9 +??:0 +EOF + exit 0 diff --git a/tests/testfile69.core.bz2 b/tests/testfile69.core.bz2 new file mode 100644 index 000000000..99553182a Binary files /dev/null and b/tests/testfile69.core.bz2 differ diff --git a/tests/testfile69.so.bz2 b/tests/testfile69.so.bz2 new file mode 100755 index 000000000..fdddab98c Binary files /dev/null and b/tests/testfile69.so.bz2 differ