Blame tests/run-deleted.sh

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