Jan Kratochvil | 0375056 | 2014-08-17 18:49:36 +0200 | [diff] [blame] | 1 | #! /bin/bash |
| 2 | # Copyright (C) 2014 Red Hat, Inc. |
| 3 | # This file is part of elfutils. |
| 4 | # |
| 5 | # This file is free software; you can redistribute it and/or modify |
| 6 | # it under the terms of the GNU General Public License as published by |
| 7 | # the Free Software Foundation; either version 3 of the License, or |
| 8 | # (at your option) any later version. |
| 9 | # |
| 10 | # elfutils is distributed in the hope that it will be useful, but |
| 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | # GNU General Public License for more details. |
| 14 | # |
| 15 | # You should have received a copy of the GNU General Public License |
| 16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
Mark Wielaard | cdfc853 | 2014-12-19 18:33:52 +0100 | [diff] [blame] | 18 | . $srcdir/backtrace-subr.sh |
Jan Kratochvil | 0375056 | 2014-08-17 18:49:36 +0200 | [diff] [blame] | 19 | |
| 20 | tempfiles deleted deleted-lib.so |
| 21 | cp -p ${abs_builddir}/deleted ${abs_builddir}/deleted-lib.so . |
Mark Wielaard | 281ebd7 | 2014-10-02 22:53:44 +0200 | [diff] [blame] | 22 | |
| 23 | # We don't want to run the deleted process under valgrind then |
| 24 | # stack will see the valgrind process backtrace. |
| 25 | OLD_VALGRIND_CMD="$VALGRIND_CMD" |
| 26 | unset VALGRIND_CMD |
| 27 | |
Jan Kratochvil | 0375056 | 2014-08-17 18:49:36 +0200 | [diff] [blame] | 28 | pid=$(testrun ${abs_builddir}/deleted) |
| 29 | sleep 1 |
| 30 | rm -f deleted deleted-lib.so |
Mark Wielaard | cdfc853 | 2014-12-19 18:33:52 +0100 | [diff] [blame] | 31 | tempfiles bt bt.err |
Mark Wielaard | 281ebd7 | 2014-10-02 22:53:44 +0200 | [diff] [blame] | 32 | |
| 33 | set VALGRIND_CMD="$OLD_VALGRIND_CMD" |
Jan Kratochvil | 0375056 | 2014-08-17 18:49:36 +0200 | [diff] [blame] | 34 | # It may have non-zero exit code with: |
| 35 | # .../elfutils/src/stack: dwfl_thread_getframes tid 26376 at 0x4006c8 in .../elfutils/tests/deleted: no matching address range |
Mark Wielaard | cdfc853 | 2014-12-19 18:33:52 +0100 | [diff] [blame] | 36 | testrun ${abs_top_builddir}/src/stack -p $pid 1>bt 2>bt.err || true |
| 37 | cat bt bt.err |
Jan Kratochvil | 0375056 | 2014-08-17 18:49:36 +0200 | [diff] [blame] | 38 | kill -9 $pid |
| 39 | wait |
Mark Wielaard | cdfc853 | 2014-12-19 18:33:52 +0100 | [diff] [blame] | 40 | check_native_unsupported bt.err deleted |
Mark Wielaard | 3943a38 | 2014-12-19 20:53:22 +0100 | [diff] [blame] | 41 | # For PPC64 we need access to the OPD table which we get through the shdrs |
| 42 | # (see backends/ppc64_init.c) but for the deleted-lib we only have phdrs. |
| 43 | # So we don't have the name of the function. But since we should find |
| 44 | # the EH_FRAME through phdrs just fine, we can unwind into main. |
| 45 | if test "`uname -m`" != "ppc64"; then |
| 46 | grep -qw libfunc bt |
| 47 | fi |
Jan Kratochvil | 0375056 | 2014-08-17 18:49:36 +0200 | [diff] [blame] | 48 | grep -qw main bt |