1 # Copyright 1998-2025 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 3 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, see <http://www.gnu.org/licenses/>. 15 16 # This file was written by Michael Snyder (msnyder (at) cygnus.com) 17 18 load_lib "trace-support.exp" 19 20 standard_testfile actions.c 21 require gdb_trace_common_supports_arch 22 if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ 23 executable {debug nowarnings}] != "" } { 24 untested "failed to compile" 25 return -1 26 } 27 28 clean_restart 29 gdb_file_cmd $binfile 30 31 # define relative source line numbers: 32 # all subsequent line numbers are relative to this first one (baseline) 33 set baseline [gdb_find_recursion_test_baseline $srcfile] 34 if {$baseline == -1} { 35 fail "could not find gdb_recursion_test function" 36 return 37 } 38 39 set testline1 [expr $baseline + 3] 40 41 # 42 # test "passcount" command 43 # 44 45 gdb_delete_tracepoints 46 set trcpt1 [gdb_gettpnum gdb_c_test] 47 set trcpt2 [gdb_gettpnum gdb_asm_test] 48 set trcpt3 [gdb_gettpnum $testline1] 49 if {$trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0} { 50 fail "setting tracepoints" 51 return 52 } 53 54 # 4.1 passcount of specified tracepoint 55 56 gdb_test "info tracepoints" \ 57 "Num Type\[ \]+Disp Enb Address\[ \]+What.* 58 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. 59 \[\t \]+not installed on target. 60 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. 61 \[\t \]+not installed on target. 62 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. 63 \[\t \]+not installed on target" \ 64 "4.1a: set three tracepoints, passcounts all zero" 65 66 gdb_test "passcount 2 $trcpt1" \ 67 "Setting tracepoint $trcpt1.s passcount to 2" \ 68 "4.1b: set 1st tracepoint's passcount to two" 69 70 gdb_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 \]+pass count 2 . 74 \[\t \]+not installed on target. 75 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. 76 \[\t \]+not installed on target. 77 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. 78 \[\t \]+not installed on target" \ 79 "4.1c: verify 1st tracepoint's passcount set to two" 80 81 gdb_test "passcount 4 $trcpt2" \ 82 "Setting tracepoint $trcpt2.s passcount to 4" \ 83 "4.1d: set 2nd tracepoint's passcount to four" 84 85 gdb_test "info tracepoints" \ 86 "Num Type\[ \]+Disp Enb Address\[ \]+What.* 87 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. 88 \[\t \]+pass count 2 . 89 \[\t \]+not installed on target. 90 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. 91 \[\t \]+pass count 4 . 92 \[\t \]+not installed on target. 93 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. 94 \[\t \]+not installed on target" \ 95 "4.1c: verify 2nd tracepoint's passcount set to four" 96 97 # 4.2 passcount of last (default) tracepoint 98 99 gdb_test "passcount 6" \ 100 "Setting tracepoint $trcpt3.s passcount to 6" \ 101 "4.2b: set last (default) tp's passcount to six" 102 103 gdb_test "info tracepoints" \ 104 "Num Type\[ \]+Disp Enb Address\[ \]+What.* 105 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. 106 \[\t \]+pass count 2 .* 107 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. 108 \[\t \]+pass count 4 .* 109 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. 110 \[\t \]+pass count 6 .*" \ 111 "4.2b: verify last (default) tp's passcount set to six" 112 113 # 4.3 run until stopped explicitly by user 114 # [deferred to dynamic test section] 115 116 # 4.4 reset the previously set passcounts to new values 117 118 gdb_test "passcount 7" \ 119 "Setting tracepoint $trcpt3.s passcount to 7" \ 120 "4.4a: reset last (default) tp's passcount to seven" 121 122 gdb_test "info tracepoints" \ 123 "Num Type\[ \]+Disp Enb Address\[ \]+What.* 124 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. 125 \[\t \]+pass count 2 .* 126 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. 127 \[\t \]+pass count 4 .* 128 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. 129 \[\t \]+pass count 7 .*" \ 130 "4.4a: verify reset last (default) tp's passcount to seven" 131 132 gdb_test "passcount 5 $trcpt2" \ 133 "Setting tracepoint $trcpt2.s passcount to 5" \ 134 "4.4b: reset second tracepoint's passcount to five" 135 136 gdb_test "info tracepoints" \ 137 "Num Type\[ \]+Disp Enb Address\[ \]+What.* 138 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. 139 \[\t \]+pass count 2 .* 140 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. 141 \[\t \]+pass count 5 .* 142 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. 143 \[\t \]+pass count 7 .*" \ 144 "4.4c: verify reset second tracepoint's passcount to five" 145 146 # 4.20 <FIXME test number> passcount for "all" 147 148 gdb_test "passcount 3 all" \ 149 ".*$trcpt1.s pass.* 3.*$trcpt2.s pass.* 3.*$trcpt3.s pass.* 3" \ 150 "4.20a: set all three passcounts to three" 151 152 gdb_test "info tracepoints" \ 153 "Num Type\[ \]+Disp Enb Address\[ \]+What.* 154 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. 155 \[\t \]+pass count 3 .* 156 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. 157 \[\t \]+pass count 3 .* 158 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. 159 \[\t \]+pass count 3 .*" \ 160 "4.20a: verify all three passcounts to three" 161 162 gdb_test "passcount 4 all" \ 163 ".*$trcpt1.s pass.* 4.*$trcpt2.s pass.* 4.*$trcpt3.s pass.* 4" \ 164 "4.20a: reset all three passcounts to four" 165 166 gdb_test "info tracepoints" \ 167 "Num Type\[ \]+Disp Enb Address\[ \]+What.* 168 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. 169 \[\t \]+pass count 4 .* 170 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. 171 \[\t \]+pass count 4 .* 172 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. 173 \[\t \]+pass count 4 .*" \ 174 "4.20b: reset all three passcounts to four" 175 176 # 4.5 Verify trace stops on first "satisfied" passcount 177 # [deferred to dynamic test section] 178 179 # 4.6 minimum passcount boundary condition 180 181 gdb_test "passcount 0 $trcpt1" \ 182 "Setting tracepoint $trcpt1.s passcount to 0" \ 183 "4.6: set passcount to zero" 184 185 gdb_test "info tracepoints" \ 186 "Num Type\[ \]+Disp Enb Address\[ \]+What.* 187 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. 188 \[\t \]+not installed on target. 189 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. 190 \[\t \]+pass count 4 . 191 \[\t \]+not installed on target. 192 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. 193 \[\t \]+pass count 4 . 194 \[\t \]+not installed on target" \ 195 "4.6: verify passcount to zero" 196 197 # 4.7 (test a very large passcount) 198 199 gdb_test "passcount 32767 $trcpt1" \ 200 "Setting tracepoint $trcpt1.s passcount to 32767" \ 201 "4.7: set passcount to large number (32767)" 202 203 gdb_test "info tracepoints" \ 204 "Num Type\[ \]+Disp Enb Address\[ \]+What.* 205 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. 206 \[\t \]+pass count 32767 .* 207 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. 208 \[\t \]+pass count 4 .* 209 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. 210 \[\t \]+pass count 4 .*" \ 211 "4.7: verify passcount to large number (32767)" 212 213 # 4.8 set passcount for invalid tracepoint 214 215 gdb_test "passcount 1 [expr $trcpt2 + $trcpt3]" \ 216 "No tracepoint number [expr $trcpt2 + $trcpt3]." \ 217 "4.8: invalid tracepoint number in passcount" 218 219 # 4.9 help passcount 220 gdb_test "help passcount" "Set the passcount for a tracepoint.*" \ 221 "4.9: help passcount" 222