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.
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"
25 load_lib "trace-support.exp"
35 set srcfile ${testfile}.c
36 set binfile $objdir/$subdir/$testfile
38 if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
39 executable {debug additional_flags=-w}] != "" } {
40 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
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.
54 proc gdb_tracepoint_limit_test { } {
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" \
79 "tracepoint limit test: set limit to four"
81 # Now sending three tracepoints should succeed.
84 -re "$cr$gdb_prompt" {
85 pass "tracepoint limit test: send fewer than limit"
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" \
95 "tracepoint limit test: set limit to three"
97 # Now sending three tracepoints should still succeed.
100 -re "$cr$gdb_prompt" {
101 pass "tracepoint limit test: send equal to limit"
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" \
111 "tracepoint limit test: set limit to two"
113 # Now sending three tracepoints should fail.
116 "tracepoint limit test: send more than limit"
119 gdb_test "tstop" "" ""
120 gdb_test "maint packet QTLimit:tp:FFFFFFFF" "" ""
123 proc gdb_memrange_limit_test { } {
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" \
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" \
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" \
157 # Set secret artificial memrange limit to four
158 gdb_test "maint packet QTLimit:memrange:4" \
160 "memrange limit test: set limit to four"
162 # Now sending three memranges should still succeed.
165 -re "$cr$gdb_prompt" {
166 pass "memrange limit test: send fewer than limit"
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" \
176 "memrange limit test: set limit to three"
178 # Now sending three memranges should still succeed.
181 -re "$cr$gdb_prompt" {
182 pass "memrange limit test: send equal to limit"
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" \
192 "memrange limit test: set limit to two"
194 # Now sending three memranges should fail.
197 "memrange limit test: send more than limit"
200 gdb_test "tstop" "" ""
201 gdb_test "maint packet QTLimit:memrange:FFFFFFFF" "" ""
205 proc gdb_bytecode_limit_test { } {
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" \
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" \
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" \
239 # Set secret artificial bytecode limit to a large number
240 gdb_test "maint packet QTLimit:bytecode:400" \
242 "bytecode limit test: set limit to large"
244 # Now sending three bytecodes should still succeed.
247 -re "$cr$gdb_prompt" {
248 pass "bytecode limit test: send fewer than limit"
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" \
258 "bytecode limit test: set limit to small"
260 # Now sending three bytecodes should fail.
263 "bytecode limit test: send more than limit"
267 gdb_test "tstop" "" ""
268 gdb_test "maint packet QTLimit:bytecode:FFFFFFFF" "" ""
271 proc gdb_trace_limits_tests { } {
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"
282 if [gdb_test "maint packet QTLimit:tp:ffffffff" \
283 "received: .OK." ""] then {
284 pass "This test cannot be run on this target"
288 if [gdb_test "maint packet QTLimit:memrange:ffffffff" \
289 "received: .OK." ""] then {
290 pass "This test cannot be run on this target"
294 if [gdb_test "maint packet QTLimit:bytecode:ffffffff" \
295 "received: .OK." ""] then {
296 pass "This test cannot be run on this target"
300 gdb_tracepoint_limit_test
301 gdb_memrange_limit_test
302 gdb_bytecode_limit_test
305 # Start with a fresh gdb.
309 gdb_reinitialize_dir $srcdir/$subdir
312 if [target_info exists gdb_stub] {
315 # Body of test encased in a proc so we can return prematurely.
316 gdb_trace_limits_tests