diff options
author | Mark Wielaard <mjw@redhat.com> | 2012-06-22 12:02:45 +0200 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2012-08-09 16:32:43 +0200 |
commit | 775375e3bd177cb19acb5020b6e0917551807276 (patch) | |
tree | 26ec5e40f426d5ace9fd636818197cd0025b672a /tests | |
parent | 836db608432ba50f76c0a63ec7bd05694341a1d4 (diff) | |
download | elfutils-775375e3bd177cb19acb5020b6e0917551807276.tar.gz |
libdw: Add support for DWZ multifile forms DW_FORM_GNU_ref_alt/strp_alt.
DWZ multifile forms http://www.dwarfstd.org/ShowIssue.php?issue=120604.1
DW_FORM_GNU_ref_alt and DW_FORM_GNU_strp_alt reference an alternative
debuginfo file. dwarf_begin and dwarf_begin_elf will try to use this
automatically. There are no user visible changes to the libdw interface.
dwarf_formref_die, dwarf_formstring and dwarf_formudata can now return
a Dwarf_Die which comes from a CU in the alternative Dwarf descriptor.
__libdw_read_offset was adjusted to take an alternative Dwarf descriptor
into account.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ChangeLog | 11 | ||||
-rw-r--r-- | tests/Makefile.am | 4 | ||||
-rwxr-xr-x | tests/libtestfile_multi_shared.so.bz2 | bin | 0 -> 2547 bytes | |||
-rwxr-xr-x | tests/run-readelf-dwz-multi.sh | 156 | ||||
-rw-r--r-- | tests/testfile_multi.dwz.bz2 | bin | 0 -> 512 bytes | |||
-rwxr-xr-x | tests/testfile_multi_main.bz2 | bin | 0 -> 3086 bytes |
6 files changed, 170 insertions, 1 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index 2291b62b..1cdd4646 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,14 @@ +2012-06-27 Mark Wielaard <mjw@redhat.com> + + * Makefile.am (TESTS): Add run-readelf-dwz-multi.sh. + (EXTRA_DIST): Add run-readelf-dwz-multi.sh, + libtestfile_multi_shared.so.bz2, testfile_multi.dwz.bz2 and + testfile_multi_main.bz2. + * run-readelf-dwz-multi.sh: New test. + * libtestfile_multi_shared.so.bz2: New testfile. + * testfile_multi.dwz.bz2: New testifle. + * testfile_multi_main.bz2: New testifle. + 2012-08-01 Petr Machata <pmachata@redhat.com> * run-test-archive64.sh: New test. diff --git a/tests/Makefile.am b/tests/Makefile.am index d0f4e80a..df66db6e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -73,7 +73,7 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \ run-nm-self.sh run-readelf-self.sh \ run-readelf-test1.sh run-readelf-test2.sh run-readelf-test3.sh \ run-readelf-test4.sh run-readelf-twofiles.sh \ - run-readelf-macro.sh \ + run-readelf-macro.sh run-readelf-dwz-multi.sh \ run-native-test.sh run-bug1-test.sh \ dwfl-bug-addr-overflow run-addrname-test.sh \ dwfl-bug-fd-leak dwfl-bug-report \ @@ -145,6 +145,8 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \ testfile46.bz2 testfile47.bz2 testfile48.bz2 testfile48.debug.bz2 \ testfile49.bz2 testfile50.bz2 testfile51.bz2 \ run-readelf-macro.sh testfilemacro.bz2 \ + run-readelf-dwz-multi.sh libtestfile_multi_shared.so.bz2 \ + testfile_multi.dwz.bz2 testfile_multi_main.bz2 \ run-prelink-addr-test.sh \ testfile52-32.so.bz2 testfile52-32.so.debug.bz2 \ testfile52-32.prelink.so.bz2 testfile52-32.noshdrs.so.bz2 \ diff --git a/tests/libtestfile_multi_shared.so.bz2 b/tests/libtestfile_multi_shared.so.bz2 Binary files differnew file mode 100755 index 00000000..e9eb6a70 --- /dev/null +++ b/tests/libtestfile_multi_shared.so.bz2 diff --git a/tests/run-readelf-dwz-multi.sh b/tests/run-readelf-dwz-multi.sh new file mode 100755 index 00000000..42e6aa4c --- /dev/null +++ b/tests/run-readelf-dwz-multi.sh @@ -0,0 +1,156 @@ +#! /bin/sh +# Copyright (C) 2012 Red Hat, Inc. +# This file is part of elfutils. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# elfutils is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +. $srcdir/test-subr.sh + +# common.h +# +# #include <stdio.h> +# +# struct foobar +# { +# int foo; +# struct foobar *bar; +# }; +# +# extern int call_foo(struct foobar *foobar_struct_ptr); + +# main.c +# +# #include "common.h" +# +# int main(int argc, char ** argv) +# { +# struct foobar b; +# b.foo = 42; +# b.bar = &b; +# +# return call_foo(b.bar); +# } + +# shared.c +# +# #include "common.h" +# +# int call_foo(struct foobar *fb) +# { +# return fb->bar->foo - 42; +# } + +# gcc -fPIC -g -c -Wall shared.c +# gcc -shared -o libtestfile_multi_shared.so shared.o +# gcc -g -o testfile_multi_main -L. -ltestfile_multi_shared main.c -Wl,-rpath,. +# dwz -m testfile_multi.dwz testfile_multi_main libtestfile_multi_shared.so + +testfiles libtestfile_multi_shared.so testfile_multi_main testfile_multi.dwz + +testrun_compare ../src/readelf --debug-dump=info testfile_multi_main <<\EOF + +DWARF section [28] '.debug_info' at offset 0x1078: + [Offset] + Compilation unit at offset 0: + Version: 4, Abbreviation section offset: 0, Address size: 8, Offset size: 4 + [ b] compile_unit + producer (strp) "GNU C 4.7.0 20120507 (Red Hat 4.7.0-5) -mtune=generic -march=x86-64 -g" + language (data1) ISO C89 (1) + name (strp) "main.c" + comp_dir (GNU_strp_alt) "/home/mark/src/tests/dwz" + low_pc (addr) 0x00000000004006ac <main> + high_pc (udata) 44 + stmt_list (sec_offset) 0 + [ 26] imported_unit + import (GNU_ref_alt) [ b] + [ 2b] pointer_type + byte_size (data1) 8 + type (GNU_ref_alt) [ 53] + [ 31] subprogram + external (flag_present) + name (strp) "main" + decl_file (data1) 1 + decl_line (data1) 3 + prototyped (flag_present) + type (GNU_ref_alt) [ 3e] + low_pc (addr) 0x00000000004006ac <main> + high_pc (udata) 44 + frame_base (exprloc) + [ 0] call_frame_cfa + GNU_all_tail_call_sites (flag_present) + sibling (ref_udata) [ 6e] + [ 48] formal_parameter + name (strp) "argc" + decl_file (data1) 1 + decl_line (data1) 3 + type (GNU_ref_alt) [ 3e] + location (exprloc) + [ 0] fbreg -36 + [ 56] formal_parameter + name (strp) "argv" + decl_file (data1) 1 + decl_line (data1) 3 + type (ref_udata) [ 6e] + location (exprloc) + [ 0] fbreg -48 + [ 61] variable + name (string) "b" + decl_file (data1) 1 + decl_line (data1) 5 + type (GNU_ref_alt) [ 5a] + location (exprloc) + [ 0] fbreg -32 + [ 6e] pointer_type + byte_size (data1) 8 + type (ref_udata) [ 2b] +EOF + +testrun_compare ../src/readelf --debug-dump=info libtestfile_multi_shared.so <<\EOF + +DWARF section [25] '.debug_info' at offset 0x106c: + [Offset] + Compilation unit at offset 0: + Version: 4, Abbreviation section offset: 0, Address size: 8, Offset size: 4 + [ b] compile_unit + producer (strp) "GNU C 4.7.0 20120507 (Red Hat 4.7.0-5) -fpreprocessed -mtune=generic -march=x86-64 -g -fPIC" + language (data1) ISO C89 (1) + name (strp) "shared.c" + comp_dir (GNU_strp_alt) "/home/mark/src/tests/dwz" + low_pc (addr) +0x0000000000000670 <call_foo> + high_pc (udata) 23 + stmt_list (sec_offset) 0 + [ 26] imported_unit + import (GNU_ref_alt) [ b] + [ 2b] subprogram + external (flag_present) + name (strp) "call_foo" + decl_file (data1) 1 + decl_line (data1) 3 + prototyped (flag_present) + type (GNU_ref_alt) [ 3e] + low_pc (addr) +0x0000000000000670 <call_foo> + high_pc (udata) 23 + frame_base (exprloc) + [ 0] call_frame_cfa + GNU_all_call_sites (flag_present) + [ 41] formal_parameter + name (string) "fb" + decl_file (data1) 1 + decl_line (data1) 3 + type (GNU_ref_alt) [ 76] + location (exprloc) + [ 0] fbreg -24 +EOF + +exit 0 diff --git a/tests/testfile_multi.dwz.bz2 b/tests/testfile_multi.dwz.bz2 Binary files differnew file mode 100644 index 00000000..1f52fb69 --- /dev/null +++ b/tests/testfile_multi.dwz.bz2 diff --git a/tests/testfile_multi_main.bz2 b/tests/testfile_multi_main.bz2 Binary files differnew file mode 100755 index 00000000..bc6ca5fd --- /dev/null +++ b/tests/testfile_multi_main.bz2 |