|
Packit Service |
97d2fb |
#! /usr/bin/env bash
|
|
Packit Service |
97d2fb |
# Copyright (C) 2014, 2015 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 |
if test -n "$ELFUTILS_DISABLE_DEMANGLE"; then
|
|
Packit Service |
97d2fb |
echo "demangler unsupported"
|
|
Packit Service |
97d2fb |
exit 77
|
|
Packit Service |
97d2fb |
fi
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
. $srcdir/backtrace-subr.sh
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
child=testfile-backtrace-demangle
|
|
Packit Service |
97d2fb |
testfiles $child{,.core}
|
|
Packit Service |
97d2fb |
tempfiles $child.{bt,err}
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
# Disable valgrind while dumping because of a bug unmapping libc.so.
|
|
Packit Service |
97d2fb |
# https://bugs.kde.org/show_bug.cgi?id=327427
|
|
Packit Service |
97d2fb |
SAVED_VALGRIND_CMD="$VALGRIND_CMD"
|
|
Packit Service |
97d2fb |
unset VALGRIND_CMD
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
# There can be more than 3 frames, but depending on the system/installed
|
|
Packit Service |
97d2fb |
# glibc we might not be able to unwind fully till the end.
|
|
Packit Service |
97d2fb |
# cxxfunc -> f -> main
|
|
Packit Service |
97d2fb |
# Expect to see the top two and a warning that there are more frames
|
|
Packit Service |
97d2fb |
# (exit code 1)
|
|
Packit Service |
97d2fb |
testrun ${abs_top_builddir}/src/stack -n 2 -e $child --core $child.core >$child.bt 2>$child.err || exitcode=$?
|
|
Packit Service |
97d2fb |
cat $child.{bt,err}
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
if [ "x$SAVED_VALGRIND_CMD" != "x" ]; then
|
|
Packit Service |
97d2fb |
VALGRIND_CMD="$SAVED_VALGRIND_CMD"
|
|
Packit Service |
97d2fb |
export VALGRIND_CMD
|
|
Packit Service |
97d2fb |
fi
|
|
Packit Service |
97d2fb |
|
|
Packit Service |
97d2fb |
if test $exitcode != 1 || ! grep "shown max number of frames" $child.err; then
|
|
Packit Service |
97d2fb |
echo >&2 $2: expected more than 2 frames
|
|
Packit Service |
97d2fb |
false
|
|
Packit Service |
97d2fb |
fi
|
|
Packit Service |
97d2fb |
if ! grep -w f $child.bt; then
|
|
Packit Service |
97d2fb |
echo >&2 $2: no f
|
|
Packit Service |
97d2fb |
false
|
|
Packit Service |
97d2fb |
fi
|
|
Packit Service |
97d2fb |
if ! grep ' cxxfunc(int)' $child.bt; then
|
|
Packit Service |
97d2fb |
echo >&2 $2: no cxxfunc
|
|
Packit Service |
97d2fb |
false
|
|
Packit Service |
97d2fb |
fi
|