1# Copyright 1998, 2007, 2008, 2009, 2010, 2011 2# Free Software Foundation, Inc. 3# 4# This program is free software; you can redistribute it and/or modify 5# it under the terms of the GNU General Public License as published by 6# the Free Software Foundation; either version 3 of the License, or 7# (at your option) any later version. 8# 9# This program is distributed in the hope that it will be useful, 10# but WITHOUT ANY WARRANTY; without even the implied warranty of 11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12# GNU General Public License for more details. 13# 14# You should have received a copy of the GNU General Public License 15# along with this program. If not, see <http://www.gnu.org/licenses/>. 16 17# This file was written by Michael Snyder (msnyder@cygnus.com) 18 19load_lib "trace-support.exp"; 20 21if $tracelevel then { 22 strace $tracelevel 23} 24 25 26gdb_exit 27gdb_start 28 29set testfile "actions" 30set srcfile ${testfile}.c 31set binfile ${objdir}/${subdir}/while-stepping 32if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" $binfile \ 33 executable {debug nowarnings}] != "" } { 34 untested while-stepping.exp 35 return -1 36} 37gdb_reinitialize_dir $srcdir/$subdir 38 39# If testing on a remote host, download the source file. 40# remote_download host $srcdir/$subdir/$srcfile 41 42gdb_file_cmd $binfile 43 44# 45# test while-stepping command 46# 47 48gdb_delete_tracepoints 49set trcpt1 [gdb_gettpnum gdb_c_test] 50if { $trcpt1 <= 0 } then { 51 fail "Could not find gdb_c_test function" 52 return; 53} 54 55# 5.12 basic while-stepping command (collect regs) 56 57gdb_test "info tracepoints" \ 58 "Num Type\[ \]+Disp Enb Address\[ \]+What.* 59\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+" \ 60 "5.12: set a tracepoint, stepcount is zero" 61 62set stepcount 12 63 64gdb_trace_setactions "5.12: set stepcount to $stepcount" \ 65 "" \ 66 "while-stepping $stepcount" "" \ 67 "collect \$regs" "^$" \ 68 "end" "" 69 70gdb_test "info tracepoints" \ 71 "Num Type\[ \]+Disp Enb Address\[ \]+What.* 72\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. 73\[\t \]+while-stepping 12.*" \ 74 "5.12: info trace shows \"while-stepping\"" 75 76# 5.13 step out of context while collecting local variable 77# [deferred to dynamic test section] 78 79proc while_stepping_bogus_arg { bogus msgstring } { 80 global gdb_prompt; 81 82 gdb_trace_setactions "$msgstring" \ 83 "" \ 84 "while-stepping $bogus" ".*while-stepping step count" 85} 86 87# 5.14 while-stepping (no argument) 88 89while_stepping_bogus_arg "" "5.14: while-stepping null stepcount" 90 91# 5.15 while-stepping (zero stepcount) 92 93while_stepping_bogus_arg "0" "5.15: while-stepping rejects zero stepcount" 94 95# 5.16 while-stepping without collecting anything 96gdb_trace_setactions "5.16: step without collecting anything" \ 97 "" \ 98 "while-stepping $stepcount" "^$" \ 99 "end" "" 100 101gdb_test "info tracepoints" \ 102 "Num Type\[ \]+Disp Enb Address\[ \]+What.* 103\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. 104.*while-stepping $stepcount.* 105.*end.*" \ 106 "5.16: confirm actions, step without collecting anything" 107 108