1 # This testcase is part of GDB, the GNU debugger.
3 # Copyright 2013 Free Software Foundation, Inc.
5 # Contributed by Intel Corp. <markus.t.metzger@intel.com>
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 # check for btrace support
21 if { [skip_btrace_tests] } { return -1 }
24 standard_testfile x86-tailcall.S
27 if [info exists COMPILE] {
28 # make check RUNTESTFLAGS="gdb.btrace/tailcall.exp COMPILE=1"
29 standard_testfile x86-tailcall.c
30 lappend opts debug optimize=-O2
31 } elseif { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
32 verbose "Skipping ${testfile}."
36 if [prepare_for_testing tailcall.exp $testfile $srcfile $opts] {
43 # we want to see the full trace for this test
44 gdb_test_no_output "set record function-call-history-size 0"
46 # trace the call to foo
47 gdb_test_no_output "record btrace"
50 # show the flat branch trace
51 gdb_test "record function-call-history 1" [join [list \
57 # show the branch trace with calls indented
58 gdb_test "record function-call-history /c 1" [join [list \
65 gdb_test "record goto 3" ".*bar \\(\\) at .*x86-tailcall.c:24\r\n.*"
68 gdb_test "backtrace" [join [list \
69 "#0.*bar \\(\\) at x86-tailcall.c:24" \
70 "#1.*foo \\(\\) at x86-tailcall.c:29" \
71 "#2.*main \\(\\) at x86-tailcall.c:37" \
72 "Backtrace stopped: not enough registers or memory available to unwind further" \
76 gdb_test "up" "#1\[^\r\n\]*foo \\(\\) at x86-tailcall.c:29\r\n.*" "up to foo"
77 gdb_test "up" "#2\[^\r\n\]*main \\(\\) at x86-tailcall.c:37\r\n.*" "up to main"