old-cross-binutils/gdb/testsuite/gdb.trace/backtrace.exp
Pedro Alves 4ec7020176 Remove superfluous semicolons from testsuite throughout.
A few months ago semicolons after "return" were removed throughout the
testsuite.  However, as I pointed out in review, they're unnecessary
not just after "return", but pretty much after any tcl command.  ';'
is the command separator, and you only need it if there's another
command on the same line afterwards.

This patch was written by running:

 $ find . -name "*.exp" | xargs grep -l ";\s*$" | xargs sed -i 's/\([^#][^\s*;]*\)\s*;\s*$/\1/'

and then undoing changes to comments, and lib/future.exp.

Tested on x86_64 Fedora 17.

gdb/testsuite/
2013-06-07  Pedro Alves  <palves@redhat.com>

	* boards/native-extended-gdbserver.exp: Remove semicolon.
	* config/arm-ice.exp: Likewise.
	* config/bfin.exp: Likewise.
	* config/cygmon.exp: Likewise.
	* config/h8300.exp: Likewise.
	* config/monitor.exp: Likewise.
	* config/sid.exp: Likewise.
	* config/sim.exp: Likewise.
	* config/slite.exp: Likewise.
	* config/vx.exp: Likewise.
	* gdb.arch/i386-bp_permanent.exp: Likewise.
	* gdb.asm/asm-source.exp: Likewise.
	* gdb.base/args.exp: Likewise.
	* gdb.base/attach-pie-misread.exp: Likewise.
	* gdb.base/auxv.exp: Likewise.
	* gdb.base/bigcore.exp: Likewise.
	* gdb.base/bitfields2.exp: Likewise.
	* gdb.base/bitfields.exp: Likewise.
	* gdb.base/break.exp: Likewise.
	* gdb.base/break-interp.exp: Likewise.
	* gdb.base/callfuncs.exp: Likewise.
	* gdb.base/call-sc.exp: Likewise.
	* gdb.base/commands.exp: Likewise.
	* gdb.base/corefile.exp: Likewise.
	* gdb.base/dbx.exp: Likewise.
	* gdb.base/ending-run.exp: Likewise.
	* gdb.base/exprs.exp: Likewise.
	* gdb.base/funcargs.exp: Likewise.
	* gdb.base/hbreak2.exp: Likewise.
	* gdb.base/huge.exp: Likewise.
	* gdb.base/list.exp: Likewise.
	* gdb.base/memattr.exp: Likewise.
	* gdb.base/overlays.exp: Likewise.
	* gdb.base/printcmds.exp: Likewise.
	* gdb.base/recurse.exp: Likewise.
	* gdb.base/remotetimeout.exp: Likewise.
	* gdb.base/reread.exp: Likewise.
	* gdb.base/savedregs.exp: Likewise.
	* gdb.base/scope.exp: Likewise.
	* gdb.base/sepdebug.exp: Likewise.
	* gdb.base/setshow.exp: Likewise.
	* gdb.base/setvar.exp: Likewise.
	* gdb.base/sigaltstack.exp: Likewise.
	* gdb.base/siginfo-addr.exp: Likewise.
	* gdb.base/siginfo.exp: Likewise.
	* gdb.base/siginfo-obj.exp: Likewise.
	* gdb.base/sigrepeat.exp: Likewise.
	* gdb.base/sigstep.exp: Likewise.
	* gdb.base/structs.exp: Likewise.
	* gdb.base/testenv.exp: Likewise.
	* gdb.base/twice.exp: Likewise.
	* gdb.base/valgrind-db-attach.exp: Likewise.
	* gdb.base/valgrind-infcall.exp: Likewise.
	* gdb.base/varargs.exp: Likewise.
	* gdb.base/watchpoint.exp: Likewise.
	* gdb.cp/gdb1355.exp: Likewise.
	* gdb.cp/misc.exp: Likewise.
	* gdb.disasm/hppa.exp: Likewise.
	* gdb.disasm/t01_mov.exp: Likewise.
	* gdb.disasm/t02_mova.exp: Likewise.
	* gdb.disasm/t03_add.exp: Likewise.
	* gdb.disasm/t04_sub.exp: Likewise.
	* gdb.disasm/t05_cmp.exp: Likewise.
	* gdb.disasm/t06_ari2.exp: Likewise.
	* gdb.disasm/t07_ari3.exp: Likewise.
	* gdb.disasm/t08_or.exp: Likewise.
	* gdb.disasm/t09_xor.exp: Likewise.
	* gdb.disasm/t10_and.exp: Likewise.
	* gdb.disasm/t11_logs.exp: Likewise.
	* gdb.disasm/t12_bit.exp: Likewise.
	* gdb.disasm/t13_otr.exp: Likewise.
	* gdb.gdb/selftest.exp: Likewise.
	* gdb.hp/gdb.base-hp/callfwmall.exp: Likewise.
	* gdb.mi/mi-reverse.exp: Likewise.
	* gdb.pascal/floats.exp: Likewise.
	* gdb.python/py-inferior.exp: Likewise.
	* gdb.threads/attach-into-signal.exp: Likewise.
	* gdb.threads/pthreads.exp: Likewise.
	* gdb.threads/thread_events.exp: Likewise.
	* gdb.threads/watchthreads.exp: Likewise.
	* gdb.trace/actions-changed.exp: Likewise.
	* gdb.trace/actions.exp: Likewise.
	* gdb.trace/ax.exp: Likewise.
	* gdb.trace/backtrace.exp: Likewise.
	* gdb.trace/change-loc.exp: Likewise.
	* gdb.trace/deltrace.exp: Likewise.
	* gdb.trace/disconnected-tracing.exp: Likewise.
	* gdb.trace/ftrace.exp: Likewise.
	* gdb.trace/infotrace.exp: Likewise.
	* gdb.trace/passc-dyn.exp: Likewise.
	* gdb.trace/passcount.exp: Likewise.
	* gdb.trace/pending.exp: Likewise.
	* gdb.trace/qtro.exp: Likewise.
	* gdb.trace/range-stepping.exp: Likewise.
	* gdb.trace/report.exp: Likewise.
	* gdb.trace/save-trace.exp: Likewise.
	* gdb.trace/status-stop.exp: Likewise.
	* gdb.trace/strace.exp: Likewise.
	* gdb.trace/tfile.exp: Likewise.
	* gdb.trace/tfind.exp: Likewise.
	* gdb.trace/trace-break.exp: Likewise.
	* gdb.trace/tracecmd.exp: Likewise.
	* gdb.trace/trace-mt.exp: Likewise.
	* gdb.trace/tspeed.exp: Likewise.
	* gdb.trace/tsv.exp: Likewise.
	* gdb.trace/while-stepping.exp: Likewise.
	* lib/gdb.exp: Likewise.
	* lib/gdbserver-support.exp: Likewise.
	* lib/java.exp: Likewise.
	* lib/mi-support.exp: Likewise.
	* lib/pascal.exp: Likewise.
	* lib/prompt.exp: Likewise.
	* lib/trace-support.exp: Likewise.
2013-06-07 17:31:09 +00:00

332 lines
9.6 KiB
Text

# Copyright 1998-2013 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This file was written by Michael Snyder (msnyder@cygnus.com)
load_lib "trace-support.exp"
gdb_exit
gdb_start
standard_testfile actions.c
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
executable {debug nowarnings}] != "" } {
untested backtrace.exp
return -1
}
gdb_load $binfile
gdb_test "tstop" ".*" ""
gdb_test "tfind none" ".*" ""
runto_main
gdb_reinitialize_dir $srcdir/$subdir
if { ![gdb_target_supports_trace] } then {
unsupported "Current target does not support trace"
return 1
}
#
# test backtraces in trace frames
#
set testline1 0
set testline2 0
set testline3 0
set testline4 0
set testline5 0
set testline6 0
set arg1 1
set arg2 2
set arg3 3
set arg4 4
set arg5 5
set arg6 6
set baseline [gdb_find_recursion_test_baseline $srcfile]
if { $baseline == -1 } {
fail "Could not find gdb_recursion_test function"
return
}
set return_me 0
gdb_test_multiple "list $baseline, +12" "all tests in this module will fail" {
-re "\[\r\n\](\[0-9\]+).*gdbtestline 1 " {
set testline1 $expect_out(1,string)
exp_continue
}
-re "\[\r\n\](\[0-9\]+).*gdbtestline 2 " {
set testline2 $expect_out(1,string)
exp_continue
}
-re "\[\r\n\](\[0-9\]+).*gdbtestline 3 " {
set testline3 $expect_out(1,string)
exp_continue
}
-re "\[\r\n\](\[0-9\]+).*gdbtestline 4 " {
set testline4 $expect_out(1,string)
exp_continue
}
-re "\[\r\n\](\[0-9\]+).*gdbtestline 5 " {
set testline5 $expect_out(1,string)
exp_continue
}
-re "\[\r\n\](\[0-9\]+).*gdbtestline 6 " {
set testline6 $expect_out(1,string)
exp_continue
}
-re ".*$gdb_prompt $" {
if { ($testline1 == 0) || ($testline2 == 0) || ($testline3 == 0) || ($testline4 == 0) || ($testline5 == 0) || ($testline6 == 0) } {
untested backtrace.exp
set return_me 1
all tests in this module will fail."
}
}
default {
untested backtrace.exp
set return_me 1
all tests in this module will fail."
}
}
if { $return_me == 1 } then {
return -1
}
#
# Setup backtrace experiment. This will involve:
# 1) a tracepoint where nothing is collected
# 2) a tracepoint where only regs are collected
# 3) a tracepoint where regs, locals and args are collected
# 4) a tracepoint where regs plus some amount of stack are collected.
#
gdb_delete_tracepoints
set tdp2 [gdb_gettpnum $testline2]
set tdp3 [gdb_gettpnum $testline3]
set tdp4 [gdb_gettpnum $testline4]
set tdp5 [gdb_gettpnum $testline5]
set tdp6 [gdb_gettpnum $testline6]
if { $tdp2 <= 0 || $tdp3 <= 0 || \
$tdp4 <= 0 || $tdp5 <= 0 || $tdp6 <= 0 } then {
fail "setting tracepoints failed"
return
}
#gdb_trace_setactions "setup TP to collect FP" \
# "$tdp2" \
# "collect \$fp" ""
#
gdb_trace_setactions "8.6: setup TP to collect regs" \
"$tdp3" \
"collect \$regs" "^$"
gdb_trace_setactions "8.6: setup TP to collect regs, args, and locals" \
"$tdp4" \
"collect \$regs, \$args, \$locs" "^$"
if [is_amd64_regs_target] {
set fpreg "\$rbp"
set spreg "\$rsp"
} elseif [is_x86_like_target] {
set fpreg "\$ebp"
set spreg "\$esp"
} else {
set fpreg "\$fp"
set spreg "\$sp"
}
gdb_trace_setactions "8.6: setup TP to collect stack mem cast expr" \
"$tdp6" \
"collect $fpreg, \(\*\(void \*\*\) \($spreg\)\) @ 64" "^$"
gdb_test "tstart" ".*" ""
gdb_test "break end" ".*" ""
gdb_test "continue" \
"Continuing.*Breakpoint $decimal, end.*" \
"run trace experiment"
gdb_test "tstop" ".*" ""
proc gdb_backtrace_tdp_1 { msg } {
global gdb_prompt
# We are in a trace frame at which we didn't collect anything
# except $PC. Therefore we expect to be able to identify stack
# frame #0, but that's about all. In particular we do not expect
# to be able to display the function's arguments or locals, and we
# do not expect to be able to identify the caller of this function.
gdb_test "backtrace" \
"#0\[\t \]+gdb_recursion_test.*depth=.*" \
"$msg"
}
proc gdb_backtrace_tdp_2 { msg } {
global gdb_prompt
# We are in a trace frame at which we collected only the registers
# Therefore we expect to be able to identify stack frame #0, but
# we don't expect to be able to display its args unles they are
# passed in registers (which isn't the case for m68k), and we
# don't expect to be able to identify the caller's stack frame.
gdb_test "backtrace" \
"#0\[\t \]+gdb_recursion_test.*depth=.*" \
"$msg"
}
proc gdb_backtrace_tdp_3 { msg } {
global gdb_prompt
# We are in a trace frame at which we collected all registers, all
# arguments and all locals. This means that the display of
# stack frame #0 should be complete (including argument values).
gdb_test_multiple "backtrace" "$msg" {
-re "#0\[\t \]+gdb_recursion_test.*depth=\[0-9\]+.*q1=\[0-9\]+.*q2=\[0-9\]+.*q3=\[0-9\]+.*q4=\[0-9\]+.*q5=\[0-9\]+.*q6=\[0-9\]+.*$gdb_prompt $" {
pass "$msg"
}
-re "#0\[\t \]+gdb_recursion_test.*depth=Cannot access.*$gdb_prompt $" {
fail "$msg (failed to collect arguments)"
}
}
}
proc gdb_backtrace_tdp_4 { msg depth } {
global gdb_prompt
# We are in a trace frame at which we collected all registers,
# plus a sizeable hunk of stack memory. This should enable us to
# display at least several stack frames worth of backtrace. We'll
# assume that if we can't display at least "depth" levels (with
# args), it counts as an error.
gdb_test_multiple "backtrace" "$msg" {
-re "#$depth\[\t \].*gdb_recursion_test.*depth=\[0-9\]+.*q1=\[0-9\]+.*q2=\[0-9\]+.*q3=\[0-9\]+.*q4=\[0-9\]+.*q5=\[0-9\]+.*q6=\[0-9\]+.*$gdb_prompt $" {
pass "$msg"
}
-re "#$depth\[\t \].*gdb_recursion_test.*depth=.*$gdb_prompt $" {
fail "$msg (args missing from #$depth stack frame)"
}
-re "#\[0-9\]+\[\t \].*gdb_recursion_test.*depth=.*$gdb_prompt $" {
fail "$msg (fewer than $depth stack frames found)"
}
}
}
#
# begin backtrace test
#
set timeout 60
gdb_tfind_test "init: make sure not debugging any trace frame" "none" "-1"
gdb_tfind_test "8.6: find start frame" "start" "0"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
"TDP $tdp2:" ""
gdb_backtrace_tdp_1 "8.6: Backtrace, depth == 1, collect nothing"
gdb_tfind_test "8.6: find frame 1" "1" "1"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
"TDP $tdp3:" ""
gdb_backtrace_tdp_2 "8.6: Backtrace, depth == 1, collect regs"
gdb_tfind_test "8.6: find frame 2" "2" "2"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
"TDP $tdp4:" ""
gdb_backtrace_tdp_3 "8.6: Backtrace, depth == 1, collect args and locals"
gdb_tfind_test "8.6: find frame 4" "4" "4"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
"TDP $tdp6:" ""
gdb_backtrace_tdp_4 "8.6: Backtrace, depth == 1, collect stack mem expr" "0"
gdb_tfind_test "8.6: find frame 5" "5" "5"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
"TDP $tdp2:" ""
gdb_backtrace_tdp_1 "8.6: Backtrace, depth == 2, collect nothing"
gdb_tfind_test "8.6: find frame 6" "6" "6"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
"TDP $tdp3:" ""
gdb_backtrace_tdp_2 "8.6: Backtrace, depth == 2, collect regs"
gdb_tfind_test "8.6: find frame 7" "7" "7"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
"TDP $tdp4:" ""
gdb_backtrace_tdp_3 "8.6: Backtrace, depth == 2, collect args and locals"
gdb_tfind_test "8.6: find frame 9" "9" "9"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
"TDP $tdp6:" ""
gdb_backtrace_tdp_4 "8.6: Backtrace, depth == 1, collect stack mem expr" "0"
gdb_tfind_test "8.6: find frame 10" "10" "10"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
"TDP $tdp2:" ""
gdb_backtrace_tdp_1 "8.6: Backtrace, depth == 3, collect nothing"
gdb_tfind_test "8.6: find frame 11" "11" "11"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
"TDP $tdp3:" ""
gdb_backtrace_tdp_2 "8.6: Backtrace, depth == 3, collect regs"
gdb_tfind_test "8.6: find frame 12" "12" "12"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
"TDP $tdp4:" ""
gdb_backtrace_tdp_3 "8.6: Backtrace, depth == 3, collect args and locals"
gdb_tfind_test "8.6: find frame 14" "14" "14"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
"TDP $tdp6:" ""
gdb_backtrace_tdp_4 "8.6: Backtrace, depth == 1, collect stack mem expr" "0"
gdb_tfind_test "8.6: find frame 15" "15" "15"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
"TDP $tdp2:" ""
gdb_backtrace_tdp_1 "8.6: Backtrace, depth == 4, collect nothing"
gdb_tfind_test "8.6: find frame 16" "16" "16"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
"TDP $tdp3:" ""
gdb_backtrace_tdp_2 "8.6: Backtrace, depth == 4, collect regs"
gdb_tfind_test "8.6: find frame 17" "17" "17"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
"TDP $tdp4:" ""
gdb_backtrace_tdp_3 "8.6: Backtrace, depth == 4, collect args and locals"
gdb_tfind_test "8.6: find frame 19" "19" "19"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
"TDP $tdp6:" ""
gdb_backtrace_tdp_4 "8.6: Backtrace, depth == 1, collect stack mem expr" "0"
gdb_test "printf \"x \%d x\\n\", depth == 3" \
"x 0 x" \
"1.13: trace in recursion: depth not equal to 3"
# Finished!
gdb_test "tfind none" ".*" ""