1# Copyright 1998 Free Software Foundation, Inc. 2# 3# This program is free software; you can redistribute it and/or modify 4# it under the terms of the GNU General Public License as published by 5# the Free Software Foundation; either version 2 of the License, or 6# (at your option) any later version. 7# 8# This program is distributed in the hope that it will be useful, 9# but WITHOUT ANY WARRANTY; without even the implied warranty of 10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11# GNU General Public License for more details. 12# 13# You should have received a copy of the GNU General Public License 14# along with this program; if not, write to the Free Software 15# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 16 17# Please email any bugs, comments, and/or additions to this file to: 18# bug-gdb@prep.ai.mit.edu 19 20# This file was written by Michael Snyder (msnyder@cygnus.com) 21 22load_lib "trace-support.exp"; 23 24if $tracelevel then { 25 strace $tracelevel 26} 27 28set prms_id 0 29set bug_id 0 30 31gdb_exit 32gdb_start 33if [istarget "m68k-*-elf"] then { 34 set srcfile gdb_c_test.c 35 set binfile [board_info target d490_binfile]; 36} else { 37 set testfile "actions" 38 set srcfile ${testfile}.c 39 set binfile $objdir/$subdir/$testfile 40 if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ 41 executable {debug additional_flags=-w}] != "" } { 42 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." 43 } 44} 45gdb_reinitialize_dir $srcdir/$subdir 46 47# If testing on a remote host, download the source file. 48# remote_download host $srcdir/$subdir/$srcfile 49 50gdb_file_cmd $binfile 51 52# define relative source line numbers: 53# all subsequent line numbers are relative to this first one (baseline) 54set baseline [gdb_find_recursion_test_baseline $srcfile]; 55if { $baseline == -1 } then { 56 fail "Could not find gdb_recursion_test function" 57 return; 58} 59 60set testline1 [expr $baseline + 3] 61 62# 63# test "passcount" command 64# 65 66gdb_delete_tracepoints 67set trcpt1 [gdb_gettpnum gdb_c_test]; 68set trcpt2 [gdb_gettpnum gdb_asm_test]; 69set trcpt3 [gdb_gettpnum $testline1]; 70if { $trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0 } then { 71 fail "setting tracepoints" 72 return; 73} 74 75# 4.1 passcount of specified tracepoint 76 77gdb_test "info tracepoints" \ 78 "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+0\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+0\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+0\[\t \]+.*in gdb_recursion_test.*" \ 79 "4.1a: set three tracepoints, passcounts all zero" 80 81gdb_test "passcount 2 $trcpt1" \ 82 "Setting tracepoint $trcpt1.s passcount to 2" \ 83 "4.1b: set 1st tracepoint's passcount to two" 84 85gdb_test "info tracepoints" \ 86 "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+2\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+0\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+0\[\t \]+.*in gdb_recursion_test.*" \ 87 "4.1c: verify 1st tracepoint's passcount set to two" 88 89gdb_test "passcount 4 $trcpt2" \ 90 "Setting tracepoint $trcpt2.s passcount to 4" \ 91 "4.1d: set 2nd tracepoint's passcount to four" 92 93gdb_test "info tracepoints" \ 94 "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+2\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+0\[\t \]+.*in gdb_recursion_test.*" \ 95 "4.1c: verify 2nd tracepoint's passcount set to four" 96 97# 4.2 passcount of last (default) tracepoint 98 99gdb_test "passcount 6" \ 100 "Setting tracepoint $trcpt3.s passcount to 6" \ 101 "4.2b: set last (default) tp's passcount to six" 102 103gdb_test "info tracepoints" \ 104 "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+2\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+6\[\t \]+.*in gdb_recursion_test.*" \ 105 "4.2b: verify last (default) tp's passcount set to six" 106 107# 4.3 run until stopped explicitly by user 108# [deferred to dynamic test section] 109 110# 4.4 reset the previously set passcounts to new values 111 112gdb_test "passcount 7" \ 113 "Setting tracepoint $trcpt3.s passcount to 7" \ 114 "4.4a: reset last (default) tp's passcount to seven" 115 116gdb_test "info tracepoints" \ 117 "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+2\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+7\[\t \]+.*in gdb_recursion_test.*" \ 118 "4.4a: verify reset last (default) tp's passcount to seven" 119 120gdb_test "passcount 5 $trcpt2" \ 121 "Setting tracepoint $trcpt2.s passcount to 5" \ 122 "4.4b: reset second tracepoint's passcount to five" 123 124gdb_test "info tracepoints" \ 125 "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+2\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+5\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+7\[\t \]+.*in gdb_recursion_test.*" \ 126 "4.4c: verify reset second tracepoint's passcount to five" 127 128# 4.20 <FIXME test number> passcount for "all" 129 130gdb_test "passcount 3 all" \ 131 ".*$trcpt1.s pass.* 3.*$trcpt2.s pass.* 3.*$trcpt3.s pass.* 3" \ 132 "4.20a: set all three passcounts to three" 133 134gdb_test "info tracepoints" \ 135 "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+3\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+3\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+3\[\t \]+.*in gdb_recursion_test.*" \ 136 "4.20a: set all three passcounts to three" 137 138gdb_test "passcount 4 all" \ 139 ".*$trcpt1.s pass.* 4.*$trcpt2.s pass.* 4.*$trcpt3.s pass.* 4" \ 140 "4.20a: reset all three passcounts to four" 141 142gdb_test "info tracepoints" \ 143 "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*in gdb_recursion_test.*" \ 144 "4.20b: reset all three passcounts to four" 145 146# 4.5 Verify trace stops on first "satisfied" passcount 147# [deferred to dynamic test section] 148 149# 4.6 minimum passcount boundary condition 150 151gdb_test "passcount 0 $trcpt1" \ 152 "Setting tracepoint $trcpt1.s passcount to 0" \ 153 "4.6: set passcount to zero" 154 155gdb_test "info tracepoints" \ 156 "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+0\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*in gdb_recursion_test.*" \ 157 "4.6: set passcount to zero" 158 159# 4.7 (test a very large passcount) 160 161gdb_test "passcount 32767 $trcpt1" \ 162 "Setting tracepoint $trcpt1.s passcount to 32767" \ 163 "4.7: set passcount to large number (32767)" 164 165gdb_test "info tracepoints" \ 166 "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+32767\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*in gdb_recursion_test.*" \ 167 "4.7: set passcount to large number (32767)" 168 169# 4.8 set passcount for invalid tracepoint 170 171gdb_test "passcount 1 [expr $trcpt2 + $trcpt3]" \ 172 "No tracepoint number [expr $trcpt2 + $trcpt3]." \ 173 "4.8: invalid tracepoint number in passcount" 174 175# 4.9 help passcount 176gdb_test "help passcount" "Set the passcount for a tracepoint.*" \ 177 "4.9: help passcount" 178 179