Jan Kratochvil | 7c6e785 | 2014-01-15 21:16:57 +0100 | [diff] [blame] | 1 | #! /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 | |
| 18 | if test -n "$ELFUTILS_DISABLE_DEMANGLE"; then |
| 19 | exit 77 |
| 20 | fi |
| 21 | |
| 22 | . $srcdir/backtrace-subr.sh |
Jan Kratochvil | 7c6e785 | 2014-01-15 21:16:57 +0100 | [diff] [blame] | 23 | |
| 24 | child=testfile-backtrace-demangle |
| 25 | testfiles $child{,.core} |
| 26 | tempfiles $child.{bt,err} |
Mark Wielaard | d7cffa7 | 2014-01-16 09:45:51 +0100 | [diff] [blame] | 27 | |
| 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) |
| 33 | testrun ${abs_top_builddir}/src/stack -n 2 -e $child --core $child.core >$child.bt 2>$child.err || exitcode=$? |
Jan Kratochvil | 7c6e785 | 2014-01-15 21:16:57 +0100 | [diff] [blame] | 34 | cat $child.{bt,err} |
Mark Wielaard | d7cffa7 | 2014-01-16 09:45:51 +0100 | [diff] [blame] | 35 | if test $exitcode != 1 || ! grep "shown max number of frames" $child.err; then |
| 36 | echo >&2 $2: expected more than 2 frames |
| 37 | false |
| 38 | fi |
Jan Kratochvil | 7c6e785 | 2014-01-15 21:16:57 +0100 | [diff] [blame] | 39 | if ! grep -w f $child.bt; then |
| 40 | echo >&2 $2: no f |
| 41 | false |
| 42 | fi |
| 43 | if ! grep ' cxxfunc(int)' $child.bt; then |
| 44 | echo >&2 $2: no cxxfunc |
| 45 | false |
| 46 | fi |