blob: 2b5a9a84f56bdbbed84fa067c7d42c1e8ee7dce9 [file] [log] [blame]
Jan Kratochvil03750562014-08-17 18:49:36 +02001#! /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 Wielaardcdfc8532014-12-19 18:33:52 +010018. $srcdir/backtrace-subr.sh
Jan Kratochvil03750562014-08-17 18:49:36 +020019
20tempfiles deleted deleted-lib.so
21cp -p ${abs_builddir}/deleted ${abs_builddir}/deleted-lib.so .
Mark Wielaard281ebd72014-10-02 22:53:44 +020022
23# We don't want to run the deleted process under valgrind then
24# stack will see the valgrind process backtrace.
25OLD_VALGRIND_CMD="$VALGRIND_CMD"
26unset VALGRIND_CMD
27
Jan Kratochvil03750562014-08-17 18:49:36 +020028pid=$(testrun ${abs_builddir}/deleted)
29sleep 1
30rm -f deleted deleted-lib.so
Mark Wielaardcdfc8532014-12-19 18:33:52 +010031tempfiles bt bt.err
Mark Wielaard281ebd72014-10-02 22:53:44 +020032
33set VALGRIND_CMD="$OLD_VALGRIND_CMD"
Jan Kratochvil03750562014-08-17 18:49:36 +020034# 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 Wielaardcdfc8532014-12-19 18:33:52 +010036testrun ${abs_top_builddir}/src/stack -p $pid 1>bt 2>bt.err || true
37cat bt bt.err
Jan Kratochvil03750562014-08-17 18:49:36 +020038kill -9 $pid
39wait
Mark Wielaardcdfc8532014-12-19 18:33:52 +010040check_native_unsupported bt.err deleted
Mark Wielaard3943a382014-12-19 20:53:22 +010041# 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.
45if test "`uname -m`" != "ppc64"; then
46 grep -qw libfunc bt
47fi
Jan Kratochvil03750562014-08-17 18:49:36 +020048grep -qw main bt