blob: 6e18e77f9655a1c5955ac87d12c89be794094b3a [file] [log] [blame]
Jan Kratochvil7c6e7852014-01-15 21:16:57 +01001#! /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
18if test -n "$ELFUTILS_DISABLE_DEMANGLE"; then
19 exit 77
20fi
21
22. $srcdir/backtrace-subr.sh
Jan Kratochvil7c6e7852014-01-15 21:16:57 +010023
24child=testfile-backtrace-demangle
25testfiles $child{,.core}
26tempfiles $child.{bt,err}
Mark Wielaardd7cffa72014-01-16 09:45:51 +010027
28# There can be more than 3 frames, but depending on the system/installed
29# glibc we might not be able to unwind fully till the end.
30# cxxfunc -> f -> main
31# Expect to see the top two and a warning that there are more frames
32# (exit code 1)
33testrun ${abs_top_builddir}/src/stack -n 2 -e $child --core $child.core >$child.bt 2>$child.err || exitcode=$?
Jan Kratochvil7c6e7852014-01-15 21:16:57 +010034cat $child.{bt,err}
Mark Wielaardd7cffa72014-01-16 09:45:51 +010035if test $exitcode != 1 || ! grep "shown max number of frames" $child.err; then
36 echo >&2 $2: expected more than 2 frames
37 false
38fi
Jan Kratochvil7c6e7852014-01-15 21:16:57 +010039if ! grep -w f $child.bt; then
40 echo >&2 $2: no f
41 false
42fi
43if ! grep ' cxxfunc(int)' $child.bt; then
44 echo >&2 $2: no cxxfunc
45 false
46fi