|
Packit Service |
97d2fb |
#! /usr/bin/env bash
|
|
Packit Service |
97d2fb |
# Copyright (C) 2014 Red Hat, Inc.
|
|
Packit Service |
97d2fb |
# This file is part of elfutils.
|
|
Packit Service |
97d2fb |
#
|
|
Packit Service |
97d2fb |
# This file is free software; you can redistribute it and/or modify
|
|
Packit Service |
97d2fb |
# it under the terms of the GNU General Public License as published by
|
|
Packit Service |
97d2fb |
# the Free Software Foundation; either version 3 of the License, or
|
|
Packit Service |
97d2fb |
# (at your option) any later version.
|
|
Packit Service |
97d2fb |
#
|
|
Packit Service |
97d2fb |
# elfutils is distributed in the hope that it will be useful, but
|
|
Packit Service |
97d2fb |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
97d2fb |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
97d2fb |
# GNU General Public License for more details.
|
|
Packit Service |
97d2fb |
#
|
|
Packit Service |
97d2fb |
# You should have received a copy of the GNU General Public License
|
|
Packit Service |
97d2fb |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
. $srcdir/backtrace-subr.sh
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
tempfiles deleted deleted-lib.so
|
|
Packit Service |
97d2fb |
cp -p ${abs_builddir}/deleted ${abs_builddir}/deleted-lib.so .
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
# We don't want to run the deleted process under valgrind then
|
|
Packit Service |
97d2fb |
# stack will see the valgrind process backtrace.
|
|
Packit Service |
97d2fb |
OLD_VALGRIND_CMD="$VALGRIND_CMD"
|
|
Packit Service |
97d2fb |
unset VALGRIND_CMD
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
pid=$(testrun ${abs_builddir}/deleted)
|
|
Packit Service |
97d2fb |
sleep 1
|
|
Packit Service |
97d2fb |
rm -f deleted deleted-lib.so
|
|
Packit Service |
97d2fb |
tempfiles bt bt.err
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
set VALGRIND_CMD="$OLD_VALGRIND_CMD"
|
|
Packit Service |
97d2fb |
# It may have non-zero exit code with:
|
|
Packit Service |
97d2fb |
# .../elfutils/src/stack: dwfl_thread_getframes tid 26376 at 0x4006c8 in .../elfutils/tests/deleted: no matching address range
|
|
Packit Service |
97d2fb |
testrun ${abs_top_builddir}/src/stack -p $pid 1>bt 2>bt.err || true
|
|
Packit Service |
97d2fb |
cat bt bt.err
|
|
Packit Service |
97d2fb |
kill -9 $pid
|
|
Packit Service |
97d2fb |
wait
|
|
Packit Service |
97d2fb |
check_native_unsupported bt.err deleted
|
|
Packit Service |
97d2fb |
if grep -q -E ': dwfl_linux_proc_attach pid ([[:digit:]]+): Function not implemented$' bt.err; then
|
|
Packit Service |
97d2fb |
echo >&2 deleted: OS not supported
|
|
Packit Service |
97d2fb |
exit 77
|
|
Packit Service |
97d2fb |
fi
|
|
Packit Service |
97d2fb |
# For PPC64 we need access to the OPD table which we get through the shdrs
|
|
Packit Service |
97d2fb |
# (see backends/ppc64_init.c) but for the deleted-lib we only have phdrs.
|
|
Packit Service |
97d2fb |
# So we don't have the name of the function. But since we should find
|
|
Packit Service |
97d2fb |
# the EH_FRAME through phdrs just fine, we can unwind into main.
|
|
Packit Service |
97d2fb |
if test "`uname -m`" != "ppc64"; then
|
|
Packit Service |
97d2fb |
grep -qw libfunc bt
|
|
Packit Service |
97d2fb |
fi
|
|
Packit Service |
97d2fb |
grep -qw main bt
|