No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gdb6 / gdb / testsuite / gdb.trace / limits.exp
blob4022d6d59a5a8d9eafaae6df184edc4934f1df6a
1 # Copyright 1998 Free Software Foundation, Inc.
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.
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.
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
20 if [istarget "m68k-*-elf"] then {
21 pass "Test not supported on this target"
22 return;
25 load_lib "trace-support.exp"
27 if $tracelevel then {
28 strace $tracelevel
31 set prms_id 0
32 set bug_id 0
34 set testfile "limits"
35 set srcfile ${testfile}.c
36 set binfile $objdir/$subdir/$testfile
38 if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
39 executable {debug nowarnings}] != "" } {
40 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
43 # Tests:
44 # 1) Meet and exceed artificial limit on number of tracepoints
45 # 2) Meet and exceed artificial limit on number of memranges
46 # 3) Meet and exceed artificial limit on bytes of bytecode data
47 # [NOTE: number four is moved out into its own separate test module.]
48 # 4) Meet and exceed artificial limit on bytes of trace buffer storage
49 # (circular and non-circular modes). However note that a more
50 # thorough test of the circular mode can be made separately.
52 set cr "\[\r\n\]+"
54 proc gdb_tracepoint_limit_test { } {
55 global gdb_prompt
56 global cr
58 # Make sure we're in a sane starting state.
59 gdb_test "tstop" "" ""
60 gdb_test "tfind none" "" ""
61 gdb_delete_tracepoints
63 # Set three tracepoints
64 gdb_test "trace foo" \
65 "Tracepoint \[0-9\]+ at .*" \
66 "tracepoint limit test: set first tracepoint"
68 gdb_test "trace bar" \
69 "Tracepoint \[0-9\]+ at .*" \
70 "tracepoint limit test: set second tracepoint"
72 gdb_test "trace baz" \
73 "Tracepoint \[0-9\]+ at .*" \
74 "tracepoint limit test: set third tracepoint"
76 # Set secret artificial tracepoint limit to four
77 gdb_test "maint packet QTLimit:tp:4" \
78 "received: .OK." \
79 "tracepoint limit test: set limit to four"
81 # Now sending three tracepoints should succeed.
82 send_gdb "tstart\n"
83 gdb_expect {
84 -re "$cr$gdb_prompt" {
85 pass "tracepoint limit test: send fewer than limit"
87 default {
88 fail "tracepoint limit test: send fewer than limit"
92 # Set secret artificial tracepoint limit to three
93 gdb_test "maint packet QTLimit:tp:3" \
94 "received: .OK." \
95 "tracepoint limit test: set limit to three"
97 # Now sending three tracepoints should still succeed.
98 send_gdb "tstart\n"
99 gdb_expect {
100 -re "$cr$gdb_prompt" {
101 pass "tracepoint limit test: send equal to limit"
103 default {
104 fail "tracepoint limit test: send equal to limit"
108 # Set secret artificial tracepoint limit to two
109 gdb_test "maint packet QTLimit:tp:2" \
110 "received: .OK." \
111 "tracepoint limit test: set limit to two"
113 # Now sending three tracepoints should fail.
114 gdb_test "tstart" \
115 ".*\[Ee\]rror.*" \
116 "tracepoint limit test: send more than limit"
118 # Clean up:
119 gdb_test "tstop" "" ""
120 gdb_test "maint packet QTLimit:tp:FFFFFFFF" "" ""
123 proc gdb_memrange_limit_test { } {
124 global gdb_prompt
125 global cr
127 # Make sure we're in a sane starting state.
128 gdb_test "tstop" "" ""
129 gdb_test "tfind none" "" ""
130 gdb_delete_tracepoints
132 # Set three tracepoints, and make 'em collect memranges
133 gdb_test "trace foo" \
134 "Tracepoint \[0-9\]+ at .*" \
135 "memrange limit test: set first tracepoint"
137 gdb_trace_setactions "memrange limit test: set first actions" \
138 "" \
139 "collect \$arg" "^$"
141 gdb_test "trace bar" \
142 "Tracepoint \[0-9\]+ at .*" \
143 "memrange limit test: set second tracepoint"
145 gdb_trace_setactions "memrange limit test: set second actions" \
146 "" \
147 "collect \$arg" "^$"
149 gdb_test "trace baz" \
150 "Tracepoint \[0-9\]+ at .*" \
151 "memrange limit test: set third tracepoint"
153 gdb_trace_setactions "memrange limit test: set third actions" \
154 "" \
155 "collect \$arg" "^$"
157 # Set secret artificial memrange limit to four
158 gdb_test "maint packet QTLimit:memrange:4" \
159 "received: .OK." \
160 "memrange limit test: set limit to four"
162 # Now sending three memranges should still succeed.
163 send_gdb "tstart\n"
164 gdb_expect {
165 -re "$cr$gdb_prompt" {
166 pass "memrange limit test: send fewer than limit"
168 default {
169 fail "memrange limit test: send fewer than limit"
173 # Set secret artificial memrange limit to three
174 gdb_test "maint packet QTLimit:memrange:3" \
175 "received: .OK." \
176 "memrange limit test: set limit to three"
178 # Now sending three memranges should still succeed.
179 send_gdb "tstart\n"
180 gdb_expect {
181 -re "$cr$gdb_prompt" {
182 pass "memrange limit test: send equal to limit"
184 default {
185 fail "memrange limit test: send equal to limit"
189 # Set secret artificial memrange limit to two
190 gdb_test "maint packet QTLimit:memrange:2" \
191 "received: .OK." \
192 "memrange limit test: set limit to two"
194 # Now sending three memranges should fail.
195 gdb_test "tstart" \
196 ".*\[Ee\]rror.*" \
197 "memrange limit test: send more than limit"
199 # Clean up:
200 gdb_test "tstop" "" ""
201 gdb_test "maint packet QTLimit:memrange:FFFFFFFF" "" ""
205 proc gdb_bytecode_limit_test { } {
206 global gdb_prompt
207 global cr
209 # Make sure we're in a sane starting state.
210 gdb_test "tstop" "" ""
211 gdb_test "tfind none" "" ""
212 gdb_delete_tracepoints
214 # Set three tracepoints
215 gdb_test "trace foo" \
216 "Tracepoint \[0-9\]+ at .*" \
217 "bytecode limit test: set first tracepoint"
219 gdb_trace_setactions "bytecode limit test: set first actions" \
220 "" \
221 "collect x + n" "^$"
223 gdb_test "trace bar" \
224 "Tracepoint \[0-9\]+ at .*" \
225 "bytecode limit test: set second tracepoint"
227 gdb_trace_setactions "bytecode limit test: set second actions" \
228 "" \
229 "collect y + n" "^$"
231 gdb_test "trace baz" \
232 "Tracepoint \[0-9\]+ at .*" \
233 "bytecode limit test: set third tracepoint"
235 gdb_trace_setactions "bytecode limit test: set third actions" \
236 "" \
237 "collect z + n" "^$"
239 # Set secret artificial bytecode limit to a large number
240 gdb_test "maint packet QTLimit:bytecode:400" \
241 "received: .OK." \
242 "bytecode limit test: set limit to large"
244 # Now sending three bytecodes should still succeed.
245 send_gdb "tstart\n"
246 gdb_expect {
247 -re "$cr$gdb_prompt" {
248 pass "bytecode limit test: send fewer than limit"
250 default {
251 fail "bytecode limit test: send fewer than limit"
255 # Set secret artificial bytecode limit to a small number
256 gdb_test "maint packet QTLimit:bytecode:40" \
257 "received: .OK." \
258 "bytecode limit test: set limit to small"
260 # Now sending three bytecodes should fail.
261 gdb_test "tstart" \
262 ".*\[Ee\]rror.*" \
263 "bytecode limit test: send more than limit"
266 # Clean up:
267 gdb_test "tstop" "" ""
268 gdb_test "maint packet QTLimit:bytecode:FFFFFFFF" "" ""
271 proc gdb_trace_limits_tests { } {
272 global gdb_prompt
274 # We generously give ourselves one "pass" if we successfully
275 # detect that this test cannot be run on this target!
277 if { ![gdb_target_supports_trace] } then {
278 pass "Current target does not supporst trace"
279 return 1;
282 if [gdb_test "maint packet QTLimit:tp:ffffffff" \
283 "received: .OK." ""] then {
284 pass "This test cannot be run on this target"
285 return 1;
288 if [gdb_test "maint packet QTLimit:memrange:ffffffff" \
289 "received: .OK." ""] then {
290 pass "This test cannot be run on this target"
291 return 1;
294 if [gdb_test "maint packet QTLimit:bytecode:ffffffff" \
295 "received: .OK." ""] then {
296 pass "This test cannot be run on this target"
297 return;
300 gdb_tracepoint_limit_test
301 gdb_memrange_limit_test
302 gdb_bytecode_limit_test
305 # Start with a fresh gdb.
307 gdb_exit
308 gdb_start
309 gdb_reinitialize_dir $srcdir/$subdir
310 gdb_load $binfile
312 if [target_info exists gdb_stub] {
313 gdb_step_for_stub;
315 # Body of test encased in a proc so we can return prematurely.
316 gdb_trace_limits_tests