diff options
| author | Mark Wielaard <[email protected]> | 2013-03-25 11:45:22 +0100 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2013-04-04 21:26:09 +0200 |
| commit | b79788c8dcef524ad207f5e961dc11c216e86ffc (patch) | |
| tree | 819c166a9e02b1b810da676e6d8c1ff10720f9b2 /tests | |
| parent | 60ef9ab76eecfa175bc0bea4ab6005a947987781 (diff) | |
readelf: Display raw .debug_aranges. Use libdw only for decodedaranges.
Display "raw" .debug_aranges by default. Only use libdw parsing when
--debug-dump=decodedaranges is given.
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ChangeLog | 7 | ||||
| -rw-r--r-- | tests/Makefile.am | 2 | ||||
| -rwxr-xr-x | tests/run-readelf-aranges.sh | 161 | ||||
| -rwxr-xr-x | tests/testfilefoobarbaz.bz2 | bin | 0 -> 3974 bytes |
4 files changed, 170 insertions, 0 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index 34657773..2da85cf0 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,5 +1,12 @@ 2013-03-25 Mark Wielaard <[email protected]> + * run-readelf-aranges.sh: New test. + * testfilefoobarbaz.bz2: New test file. + * Makefile.am (TESTS): Add run-readelf-aranges.sh. + (EXTRA_DIST): Add run-readelf-aranges.sh and testfilefoobarbaz.bz2. + +2013-03-25 Mark Wielaard <[email protected]> + * run-readelf-dwz-multi.sh: Expect high_pc also as address. 2013-03-20 Jan Kratochvil <[email protected]> diff --git a/tests/Makefile.am b/tests/Makefile.am index 9b0bbf1a..4e630398 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -75,6 +75,7 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \ 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-loc.sh \ + run-readelf-aranges.sh \ run-native-test.sh run-bug1-test.sh \ dwfl-bug-addr-overflow run-addrname-test.sh \ dwfl-bug-fd-leak dwfl-bug-report \ @@ -157,6 +158,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \ testfile49.bz2 testfile50.bz2 testfile51.bz2 \ run-readelf-macro.sh testfilemacro.bz2 \ run-readelf-loc.sh testfileloc.bz2 \ + run-readelf-aranges.sh testfilefoobarbaz.bz2 \ run-readelf-dwz-multi.sh libtestfile_multi_shared.so.bz2 \ testfile_multi.dwz.bz2 testfile_multi_main.bz2 \ testfile-dwzstr.bz2 testfile-dwzstr.multi.bz2 \ diff --git a/tests/run-readelf-aranges.sh b/tests/run-readelf-aranges.sh new file mode 100755 index 00000000..a610fca0 --- /dev/null +++ b/tests/run-readelf-aranges.sh @@ -0,0 +1,161 @@ +#! /bin/sh +# Copyright (C) 2013 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 + +# Tests readelf --debug-dump=aranges and --debug-dump=decodedaranges +# +# - foobarbaz.h +# +# int bar (); +# int baz (int i); +# +# - bar.c +# +# #include "foobarbaz.h" +# +# static int bi; +# +# static int +# barbaz (int i) +# { +# return i * 2 - 1; +# } +# +# __attribute__ ((constructor)) void +# nobar () +# { +# bi = 1; +# } +# +# int +# bar () +# { +# bi++; +# return barbaz (bi); +# } +# +# - foo.c +# +# include "foobarbaz.h" +# +# static int fi = 0; +# +# static int +# foo (int i, int j) +# { +# if (i > j) +# return i - j + fi; +# else +# return (2 * j) - i + fi; +# } +# +# int +# main (int argc, char **argv) +# { +# int a = bar (); +# int b = baz (a + argc); +# int r = foo (a, b) - 1; +# +# return r - 48; +# } +# +# - baz.c +# include "foobarbaz.h" +# +# static int bj; +# +# static int +# bazbaz (int j) +# { +# return bj * j - bar (); +# } +# +# __attribute__ ((constructor)) void +# nobaz () +# { +# bj = 1; +# } +# +# int +# baz (int i) +# { +# if (i < 0) +# return bazbaz (i); +# else +# { +# while (i-- > 0) +# bj += bar (); +# } +# return bazbaz (i); +# } +# +# gcc -g -O2 -m32 -c baz.c +# gcc -g -O2 -m32 -c bar.c +# gcc -g -O2 -m32 -c foo.c +# gcc -g -O2 -m32 -o testfilefoobarbaz foo.o bar.o baz.o + +testfiles testfilefoobarbaz + +testrun_compare ../src/readelf --debug-dump=aranges testfilefoobarbaz <<EOF + +DWARF section [27] '.debug_aranges' at offset 0x1044: + +Table at offset 0: + + Length: 28 + DWARF version: 2 + CU offset: 0 + Address size: 4 + Segment size: 0 + + 0x080482f0 <main>..0x08048323 <main+0x33> + +Table at offset 32: + + Length: 36 + DWARF version: 2 + CU offset: 136 + Address size: 4 + Segment size: 0 + + 0x08048440 <bar>..0x08048451 <bar+0x11> + 0x08048330 <nobar>..0x0804833a <nobar+0xa> + +Table at offset 72: + + Length: 36 + DWARF version: 2 + CU offset: 1d1 + Address size: 4 + Segment size: 0 + + 0x08048460 <baz>..0x080484bb <baz+0x5b> + 0x08048340 <nobaz>..0x0804834a <nobaz+0xa> +EOF + +testrun_compare ../src/readelf --debug-dump=decodedaranges testfilefoobarbaz <<\EOF + +DWARF section [27] '.debug_aranges' at offset 0x1044 contains 5 entries: + [0] start: 0x080482f0, length: 52, CU DIE offset: 11 + [1] start: 0x08048330, length: 11, CU DIE offset: 321 + [2] start: 0x08048340, length: 11, CU DIE offset: 476 + [3] start: 0x08048440, length: 18, CU DIE offset: 321 + [4] start: 0x08048460, length: 92, CU DIE offset: 476 +EOF + +exit 0 diff --git a/tests/testfilefoobarbaz.bz2 b/tests/testfilefoobarbaz.bz2 Binary files differnew file mode 100755 index 00000000..0e721ffe --- /dev/null +++ b/tests/testfilefoobarbaz.bz2 |
