summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog18
-rw-r--r--tests/Makefile.am12
-rwxr-xr-xtests/run-readelf-gdb_index.sh130
-rwxr-xr-xtests/run-unstrip-n.sh11
-rw-r--r--tests/testcore-rtlib-ppc.bz2bin0 -> 200184 bytes
-rwxr-xr-xtests/testfilegdbindex5.bz2bin0 -> 3481 bytes
-rwxr-xr-xtests/testfilegdbindex7.bz2bin0 -> 3497 bytes
7 files changed, 165 insertions, 6 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 48337f6a..63ca9b7b 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -5,6 +5,24 @@
* Makefile.am (TESTS): Add run-readelf-macro.sh.
(EXTRA_DIST): Add run-readelf-macro.sh and testfilemacro.bz2.
+2012-06-27 Mark Wielaard <[email protected]>
+
+ * run-readelf-gdb-index.sh: New test.
+ * testfilegdbindex5.bz2: New testfile.
+ * testfilegdbindex7.bz2: Likewise.
+ * Makefile.am (TESTS): Add run-readelf-gdb-index.sh.
+ (EXTRA_DIST): run-readelf-gdb_index.sh, testfilegdbindex5.bz2 and
+ testfilegdbindex7.bz2.
+
+2012-07-17 Mark Wielaard <[email protected]>
+
+ * testcore-rtlib-ppc.bz2: New testfile.
+ * run-unstrip-n.sh: Check new ppc core testfile.
+
+2012-06-26 Mike Frysinger <[email protected]>
+
+ * Makefile.am (check_PROGRAMS): Rename from noinst_PROGRAMS.
+
2012-06-26 Mark Wielaard <[email protected]>
* run-macro-test.sh: New test.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9f876e75..bffa571e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -40,7 +40,7 @@ else
tests_rpath = no
endif
-noinst_PROGRAMS = arextract arsymtest newfile saridx scnnames sectiondump \
+check_PROGRAMS = arextract arsymtest newfile saridx scnnames sectiondump \
showptable update1 update2 update3 update4 test-nlist \
show-die-info get-files get-lines get-pubnames \
get-aranges allfcts line2addr addrscopes funcscopes \
@@ -80,16 +80,16 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
run-early-offscn.sh run-dwarf-getmacros.sh \
run-test-flag-nobits.sh run-prelink-addr-test.sh \
run-dwarf-getstring.sh run-rerequest_tag.sh run-typeiter.sh \
- run-readelf-d.sh run-unstrip-n.sh run-low_high_pc.sh \
- run-macro-test.sh
+ run-readelf-d.sh run-readelf-gdb_index.sh run-unstrip-n.sh \
+ run-low_high_pc.sh run-macro-test.sh
if !STANDALONE
-noinst_PROGRAMS += msg_tst md5-sha1-test
+check_PROGRAMS += msg_tst md5-sha1-test
TESTS += msg_tst md5-sha1-test
endif
if HAVE_LIBASM
-noinst_PROGRAMS += $(asm_TESTS)
+check_PROGRAMS += $(asm_TESTS)
TESTS += $(asm_TESTS)
endif
@@ -159,6 +159,8 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
testfile56.bz2 testfile57.bz2 testfile58.bz2 \
run-typeiter.sh testfile59.bz2 \
run-readelf-d.sh testlib_dynseg.so.bz2 \
+ run-readelf-gdb_index.sh testfilegdbindex5.bz2 \
+ testfilegdbindex7.bz2 \
run-unstrip-n.sh testcore-rtlib.bz2 \
run-low_high_pc.sh testfile_low_high_pc.bz2 \
run-macro-test.sh testfile-macinfo.bz2 testfile-macros.bz2
diff --git a/tests/run-readelf-gdb_index.sh b/tests/run-readelf-gdb_index.sh
new file mode 100755
index 00000000..31c94c14
--- /dev/null
+++ b/tests/run-readelf-gdb_index.sh
@@ -0,0 +1,130 @@
+#! /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
+# struct foo
+# {
+# const char *bar;
+# };
+#
+# extern char *global;
+# int say (struct foo *prefix);
+
+# hello.c
+# #include "common.h"
+#
+# static char *hello = "Hello";
+#
+# int
+# main (int argc, char **argv)
+# {
+# struct foo baz;
+# global = hello;
+# baz.bar = global;
+# return say(&baz);
+# }
+
+# world.c
+# #include "common.h"
+#
+# char *global;
+#
+# static int hello (const char *bar)
+# {
+# return bar == global;
+# }
+#
+# int
+# say (struct foo *prefix)
+# {
+# return hello (prefix->bar);
+# }
+
+# gcc -g -fdebug-types-section -c hello.c
+# gcc -g -fdebug-types-section -c world.c
+# gcc -g -fdebug-types-section -o testfilegdbindex7 hello.o world.o
+# gdb testfilegdbindex7
+# (gdb) save gdb-index .
+# objcopy --add-section .gdb_index=testfilegdbindex7.gdb-index --set-section-flags .gdb_index=readonly testfilegdbindex7 testfilegdbindex7
+
+testfiles testfilegdbindex5 testfilegdbindex7
+
+testrun_compare ../src/readelf --debug-dump=gdb_index testfilegdbindex5 <<\EOF
+
+GDB section [33] '.gdb_index' at offset 0xe76 contains 8383 bytes :
+ Version: 5
+ CU offset: 0x18
+ TU offset: 0x38
+ address offset: 0x50
+ symbol offset: 0x78
+ constant offset: 0x2078
+
+ CU list at offset 0x18 contains 2 entries:
+ [ 0] start: 00000000, length: 184
+ [ 1] start: 0x0000b8, length: 204
+
+ TU list at offset 0x38 contains 1 entries:
+ [ 0] CU offset: 0, type offset: 29, signature: 0x87e03f92cc37cdf0
+
+ Address list at offset 0x50 contains 2 entries:
+ [ 0] 0x000000000040049c <main>..0x00000000004004d1 <main+0x35>, CU index: 0
+ [ 1] 0x00000000004004d4 <hello>..0x000000000040050b <say+0x1c>, CU index: 1
+
+ Symbol table at offset 0x50 contains 1024 slots:
+ [ 123] symbol: global, CUs: 1
+ [ 489] symbol: main, CUs: 0
+ [ 518] symbol: char, CUs: 0
+ [ 661] symbol: foo, CUs: 0T
+ [ 741] symbol: hello, CUs: 0, 1
+ [ 746] symbol: say, CUs: 1
+ [ 754] symbol: int, CUs: 0
+EOF
+
+testrun_compare ../src/readelf --debug-dump=gdb_index testfilegdbindex7 <<\EOF
+
+GDB section [33] '.gdb_index' at offset 0xe76 contains 8399 bytes :
+ Version: 7
+ CU offset: 0x18
+ TU offset: 0x38
+ address offset: 0x50
+ symbol offset: 0x78
+ constant offset: 0x2078
+
+ CU list at offset 0x18 contains 2 entries:
+ [ 0] start: 00000000, length: 184
+ [ 1] start: 0x0000b8, length: 204
+
+ TU list at offset 0x38 contains 1 entries:
+ [ 0] CU offset: 0, type offset: 29, signature: 0x87e03f92cc37cdf0
+
+ Address list at offset 0x50 contains 2 entries:
+ [ 0] 0x000000000040049c <main>..0x00000000004004d1 <main+0x35>, CU index: 0
+ [ 1] 0x00000000004004d4 <hello>..0x000000000040050b <say+0x1c>, CU index: 1
+
+ Symbol table at offset 0x50 contains 1024 slots:
+ [ 123] symbol: global, CUs: 1 (var:G)
+ [ 489] symbol: main, CUs: 0 (func:G)
+ [ 518] symbol: char, CUs: 0 (type:S)
+ [ 661] symbol: foo, CUs: 0T (type:S)
+ [ 741] symbol: hello, CUs: 0 (var:S), 1 (func:S)
+ [ 746] symbol: say, CUs: 1 (func:G)
+ [ 754] symbol: int, CUs: 0 (type:S)
+EOF
+
+exit 0
diff --git a/tests/run-unstrip-n.sh b/tests/run-unstrip-n.sh
index 342a6adc..a2f0d6c0 100755
--- a/tests/run-unstrip-n.sh
+++ b/tests/run-unstrip-n.sh
@@ -31,7 +31,7 @@
#
# gcc -m32 -o rt_crash -lrt rt_crash.c
-testfiles testcore-rtlib
+testfiles testcore-rtlib testcore-rtlib-ppc
testrun_compare ../src/unstrip -n --core=testcore-rtlib <<\EOF
0x8048000+0x2000 f1c600bc36cb91bf01f9a63a634ecb79aa4c3199@0x8048178 . - [exe]
@@ -42,4 +42,13 @@ testrun_compare ../src/unstrip -n --core=testcore-rtlib <<\EOF
0xf77d7000+0x21000 6d2cb32650054f1c176d01d48713a4a5e5e84c1a@0xf77d7124 /lib/ld-linux.so.2 - ld-linux.so.2
EOF
+testrun_compare ../src/unstrip -n --core=testcore-rtlib-ppc <<\EOF
+0x10000000+0x20000 979b7a26747cc09bd84a42b311b5288c704baea5@0x10000174 . - [exe]
+0x100000+0x10000 708b900b05176964512a6b0fe90c2a0c9d73d726@0x100334 . - linux-vdso32.so.1
+0xfd50000+0x30000 3f7d21508470322d2f47acddc20ab10516edba99@0xfd50164 /lib/librt.so.1 - librt.so.1
+0xfdf0000+0x1c0000 edf3dd232e09d01b90683889bd16b9406c52d4de@0xfdf0184 /lib/libc.so.6 - libc.so.6
+0xfdb0000+0x40000 f6ee91d4c629bc7dacc10534cb30056914e7e0b5@0xfdb0164 /lib/libpthread.so.0 - libpthread.so.0
+0xffb0000+0x50000 edec437a85026a1cf8cda94003706202733130c1@0xffb0124 /lib/ld.so.1 - ld.so.1
+EOF
+
exit 0
diff --git a/tests/testcore-rtlib-ppc.bz2 b/tests/testcore-rtlib-ppc.bz2
new file mode 100644
index 00000000..a3cec603
--- /dev/null
+++ b/tests/testcore-rtlib-ppc.bz2
Binary files differ
diff --git a/tests/testfilegdbindex5.bz2 b/tests/testfilegdbindex5.bz2
new file mode 100755
index 00000000..45ee945a
--- /dev/null
+++ b/tests/testfilegdbindex5.bz2
Binary files differ
diff --git a/tests/testfilegdbindex7.bz2 b/tests/testfilegdbindex7.bz2
new file mode 100755
index 00000000..2a7c6c2c
--- /dev/null
+++ b/tests/testfilegdbindex7.bz2
Binary files differ