]>
Commit | Line | Data |
---|---|---|
1d506c26 | 1 | # Copyright 1998-2024 Free Software Foundation, Inc. |
c906108c SS |
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 | |
e22f8b7c | 5 | # the Free Software Foundation; either version 3 of the License, or |
c906108c | 6 | # (at your option) any later version. |
e22f8b7c | 7 | # |
c906108c SS |
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. | |
e22f8b7c | 12 | # |
c906108c | 13 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
c906108c | 15 | |
c906108c SS |
16 | # This file was written by Michael Snyder (msnyder@cygnus.com) |
17 | ||
4ec70201 | 18 | load_lib "trace-support.exp" |
c906108c | 19 | |
497a5eb0 | 20 | standard_testfile actions.c |
fbee47e0 | 21 | require gdb_trace_common_supports_arch |
f8b7eaf3 DJ |
22 | if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ |
23 | executable {debug nowarnings}] != "" } { | |
84c93cd5 | 24 | untested "failed to compile" |
f8b7eaf3 | 25 | return -1 |
c906108c | 26 | } |
c906108c | 27 | |
a7e727ae | 28 | clean_restart |
c906108c SS |
29 | gdb_file_cmd $binfile |
30 | ||
31 | # define relative source line numbers: | |
32 | # all subsequent line numbers are relative to this first one (baseline) | |
4ec70201 | 33 | set baseline [gdb_find_recursion_test_baseline $srcfile] |
89c6d320 | 34 | if {$baseline == -1} { |
bc6c7af4 | 35 | fail "could not find gdb_recursion_test function" |
4ec70201 | 36 | return |
c906108c SS |
37 | } |
38 | ||
39 | set testline1 [expr $baseline + 3] | |
40 | ||
41 | # | |
42 | # test "passcount" command | |
43 | # | |
44 | ||
45 | gdb_delete_tracepoints | |
4ec70201 PA |
46 | set trcpt1 [gdb_gettpnum gdb_c_test] |
47 | set trcpt2 [gdb_gettpnum gdb_asm_test] | |
48 | set trcpt3 [gdb_gettpnum $testline1] | |
89c6d320 | 49 | if {$trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0} { |
c906108c | 50 | fail "setting tracepoints" |
4ec70201 | 51 | return |
c906108c SS |
52 | } |
53 | ||
54 | # 4.1 passcount of specified tracepoint | |
55 | ||
56 | gdb_test "info tracepoints" \ | |
1042e4c0 SS |
57 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
58 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. | |
f2a8bc8a | 59 | \[\t \]+not installed on target. |
1042e4c0 | 60 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. |
f2a8bc8a YQ |
61 | \[\t \]+not installed on target. |
62 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. | |
e2f62013 | 63 | \[\t \]+not installed on target" \ |
c906108c SS |
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" \ | |
1042e4c0 SS |
71 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
72 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. | |
f2a8bc8a YQ |
73 | \[\t \]+pass count 2 . |
74 | \[\t \]+not installed on target. | |
1042e4c0 | 75 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. |
f2a8bc8a YQ |
76 | \[\t \]+not installed on target. |
77 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. | |
e2f62013 | 78 | \[\t \]+not installed on target" \ |
c906108c SS |
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" \ | |
1042e4c0 SS |
86 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
87 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. | |
f2a8bc8a YQ |
88 | \[\t \]+pass count 2 . |
89 | \[\t \]+not installed on target. | |
1042e4c0 | 90 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. |
f2a8bc8a YQ |
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\]+. | |
e2f62013 | 94 | \[\t \]+not installed on target" \ |
c906108c SS |
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" \ | |
1042e4c0 SS |
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 .*" \ | |
c906108c SS |
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" \ | |
1042e4c0 SS |
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 .*" \ | |
c906108c SS |
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" \ | |
1042e4c0 SS |
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 .*" \ | |
c906108c SS |
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" \ | |
1042e4c0 SS |
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 .*" \ | |
af2d5cd8 | 160 | "4.20a: verify all three passcounts to three" |
c906108c SS |
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" \ | |
1042e4c0 SS |
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 .*" \ | |
c906108c SS |
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" \ | |
1042e4c0 SS |
186 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
187 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. | |
f2a8bc8a | 188 | \[\t \]+not installed on target. |
1042e4c0 | 189 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. |
f2a8bc8a YQ |
190 | \[\t \]+pass count 4 . |
191 | \[\t \]+not installed on target. | |
1042e4c0 | 192 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. |
f2a8bc8a | 193 | \[\t \]+pass count 4 . |
e2f62013 | 194 | \[\t \]+not installed on target" \ |
af2d5cd8 | 195 | "4.6: verify passcount to zero" |
c906108c SS |
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" \ | |
1042e4c0 SS |
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 .*" \ | |
af2d5cd8 | 211 | "4.7: verify passcount to large number (32767)" |
c906108c SS |
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" |