summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2013-10-10 11:40:12 +0200
committerMark Wielaard <[email protected]>2013-10-22 13:59:23 +0200
commite6a9bb8c63adaeaceafc50301b085121c962b631 (patch)
tree569d2939a228f29fa48b6b8bc66bde1c29014a3a /tests
parentd182974079c7205973ae7885b95216a5b83b6f82 (diff)
libdw: Handle dwz multi files correctly in dwarf_getfuncs.
Don't use DIE offsets, but use their addresses to make sure they are unique. Include test cases where main and alt file have subprograms at same offsets. Reported-by: Josh Stone <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog10
-rw-r--r--tests/Makefile.am4
-rwxr-xr-xtests/run-allfcts-multi.sh56
-rw-r--r--tests/test-offset-loop.alt.bz2bin0 -> 685 bytes
-rwxr-xr-xtests/test-offset-loop.bz2bin0 -> 3062 bytes
5 files changed, 69 insertions, 1 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index f6b794b2..11974e15 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,13 @@
+2013-10-10 Mark Wielaard <[email protected]>
+ Josh Stone <[email protected]>
+
+ * run-allfcts-multi.sh: New test.
+ * test-offset-loop.bz2: New testfile.
+ * test-offset-loop.alt.bz2: New testfile.
+ * Makefile.am (TESTS): Add run-allcft-multi.sh if ENABLE_DWZ.
+ (EXTRA_DIST): Add run-allfcts-multi.sh, test-offset-loop.bz2 and
+ test-offset-loop.alt.bz2.
+
2013-10-15 Mark Wielaard <[email protected]>
* run-unstrip-M.sh: New test.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f3c56bff..d07cb0b0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -106,7 +106,7 @@ TESTS += $(asm_TESTS)
endif
if ENABLE_DWZ
-TESTS += run-readelf-dwz-multi.sh
+TESTS += run-readelf-dwz-multi.sh run-allfcts-multi.sh
endif
@@ -164,6 +164,8 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
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 \
+ run-allfcts-multi.sh \
+ test-offset-loop.bz2 test-offset-loop.alt.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/run-allfcts-multi.sh b/tests/run-allfcts-multi.sh
new file mode 100755
index 00000000..727b76ee
--- /dev/null
+++ b/tests/run-allfcts-multi.sh
@@ -0,0 +1,56 @@
+#! /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
+
+# See run-readelf-dwz-multi.sh
+testfiles libtestfile_multi_shared.so testfile_multi_main testfile_multi.dwz
+testfiles testfile-dwzstr testfile-dwzstr.multi
+
+testrun_compare ${abs_builddir}/allfcts testfile_multi_main libtestfile_multi_shared.so testfile-dwzstr <<\EOF
+/home/mark/src/tests/dwz/main.c:3:main
+/home/mark/src/tests/dwz/shared.c:3:call_foo
+/home/mark/src/tests/main.c:8:main
+EOF
+
+# - test-offset-loop.c
+#
+# #include <stdbool.h>
+# #include <string.h>
+# #include <errno.h>
+# void padding (int x, int y, int z) { }
+# static inline bool is_error (int err) { return err != 0; }
+# static inline int get_errno (void) { return errno; }
+# int main () { return is_error (get_errno ()); }
+#
+# gcc -g -O2 test-offset-loop.c -o test-offset-loop
+# cp test-offset-loop test-offset-loop2
+# dwz test-offset-loop test-offset-loop2 -m test-offset-loop.alt
+
+testfiles test-offset-loop test-offset-loop.alt
+tempfiles allfcts.out
+
+# Use head to capture output because the output could be infinite...
+testrun ${abs_builddir}/allfcts test-offset-loop | head -n 20 > allfcts.out
+testrun_compare cat allfcts.out <<\EOF
+/tmp/test-offset-loop.c:6:get_errno
+/tmp/test-offset-loop.c:5:is_error
+/tmp/test-offset-loop.c:4:padding
+/tmp/test-offset-loop.c:7:main
+EOF
+
+exit 0
diff --git a/tests/test-offset-loop.alt.bz2 b/tests/test-offset-loop.alt.bz2
new file mode 100644
index 00000000..c1906b6d
--- /dev/null
+++ b/tests/test-offset-loop.alt.bz2
Binary files differ
diff --git a/tests/test-offset-loop.bz2 b/tests/test-offset-loop.bz2
new file mode 100755
index 00000000..62185c0a
--- /dev/null
+++ b/tests/test-offset-loop.bz2
Binary files differ