OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [testsuite/] [gdb.trace/] [limits.exp] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
# Copyright (C) 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
if [istarget "m68k-*-elf"] then {
21
    pass "Test not supported on this target"
22
    return;
23
}
24
 
25
load_lib "trace-support.exp"
26
 
27
if $tracelevel then {
28
        strace $tracelevel
29
}
30
 
31
set prms_id 0
32
set bug_id 0
33
 
34
set testfile "limits"
35
set srcfile ${testfile}.c
36
set binfile $objdir/$subdir/$testfile
37
 
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."
41
}
42
 
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.
51
 
52
set cr "\[\r\n\]+"
53
 
54
proc gdb_tracepoint_limit_test { } {
55
    global gdb_prompt
56
    global cr
57
 
58
    # Make sure we're in a sane starting state.
59
    gdb_test "tstop" "" ""
60
    gdb_test "tfind none" "" ""
61
    gdb_delete_tracepoints
62
 
63
    # Set three tracepoints
64
    gdb_test "trace foo" \
65
            "Tracepoint \[0-9\]+ at .*" \
66
            "tracepoint limit test: set first tracepoint"
67
 
68
    gdb_test "trace bar" \
69
            "Tracepoint \[0-9\]+ at .*" \
70
            "tracepoint limit test: set second tracepoint"
71
 
72
    gdb_test "trace baz" \
73
            "Tracepoint \[0-9\]+ at .*" \
74
            "tracepoint limit test: set third tracepoint"
75
 
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"
80
 
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"
86
        }
87
        default {
88
            fail "tracepoint limit test: send fewer than limit"
89
        }
90
    }
91
 
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"
96
 
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"
102
        }
103
        default {
104
            fail "tracepoint limit test: send equal to limit"
105
        }
106
    }
107
 
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"
112
 
113
    # Now sending three tracepoints should fail.
114
    gdb_test "tstart" \
115
            ".*\[Ee\]rror.*" \
116
            "tracepoint limit test: send more than limit"
117
 
118
    # Clean up:
119
    gdb_test "tstop" "" ""
120
    gdb_test "maint packet QTLimit:tp:FFFFFFFF" "" ""
121
}
122
 
123
proc gdb_memrange_limit_test { } {
124
    global gdb_prompt
125
    global cr
126
 
127
    # Make sure we're in a sane starting state.
128
    gdb_test "tstop" "" ""
129
    gdb_test "tfind none" "" ""
130
    gdb_delete_tracepoints
131
 
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"
136
 
137
    gdb_trace_setactions "memrange limit test: set first actions" \
138
            "" \
139
            "collect \$arg" "^$"
140
 
141
    gdb_test "trace bar" \
142
            "Tracepoint \[0-9\]+ at .*" \
143
            "memrange limit test: set second tracepoint"
144
 
145
    gdb_trace_setactions "memrange limit test: set second actions" \
146
            "" \
147
            "collect \$arg" "^$"
148
 
149
    gdb_test "trace baz" \
150
            "Tracepoint \[0-9\]+ at .*" \
151
            "memrange limit test: set third tracepoint"
152
 
153
    gdb_trace_setactions "memrange limit test: set third actions" \
154
            "" \
155
            "collect \$arg" "^$"
156
 
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"
161
 
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"
167
        }
168
        default {
169
            fail "memrange limit test: send fewer than limit"
170
        }
171
    }
172
 
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"
177
 
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"
183
        }
184
        default {
185
            fail "memrange limit test: send equal to limit"
186
        }
187
    }
188
 
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"
193
 
194
    # Now sending three memranges should fail.
195
    gdb_test "tstart" \
196
            ".*\[Ee\]rror.*" \
197
            "memrange limit test: send more than limit"
198
 
199
    # Clean up:
200
    gdb_test "tstop" "" ""
201
    gdb_test "maint packet QTLimit:memrange:FFFFFFFF" "" ""
202
}
203
 
204
 
205
proc gdb_bytecode_limit_test { } {
206
    global gdb_prompt
207
    global cr
208
 
209
    # Make sure we're in a sane starting state.
210
    gdb_test "tstop" "" ""
211
    gdb_test "tfind none" "" ""
212
    gdb_delete_tracepoints
213
 
214
    # Set three tracepoints
215
    gdb_test "trace foo" \
216
            "Tracepoint \[0-9\]+ at .*" \
217
            "bytecode limit test: set first tracepoint"
218
 
219
    gdb_trace_setactions "bytecode limit test: set first actions" \
220
            "" \
221
            "collect x + n" "^$"
222
 
223
    gdb_test "trace bar" \
224
            "Tracepoint \[0-9\]+ at .*" \
225
            "bytecode limit test: set second tracepoint"
226
 
227
    gdb_trace_setactions "bytecode limit test: set second actions" \
228
            "" \
229
            "collect y + n" "^$"
230
 
231
    gdb_test "trace baz" \
232
            "Tracepoint \[0-9\]+ at .*" \
233
            "bytecode limit test: set third tracepoint"
234
 
235
    gdb_trace_setactions "bytecode limit test: set third actions" \
236
            "" \
237
            "collect z + n" "^$"
238
 
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"
243
 
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"
249
        }
250
        default {
251
            fail "bytecode limit test: send fewer than limit"
252
        }
253
    }
254
 
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"
259
 
260
    # Now sending three bytecodes should fail.
261
    gdb_test "tstart" \
262
            ".*\[Ee\]rror.*" \
263
            "bytecode limit test: send more than limit"
264
 
265
 
266
    # Clean up:
267
    gdb_test "tstop" "" ""
268
    gdb_test "maint packet QTLimit:bytecode:FFFFFFFF" "" ""
269
}
270
 
271
proc gdb_trace_limits_tests { } {
272
    global gdb_prompt
273
 
274
    # We generously give ourselves one "pass" if we successfully
275
    # detect that this test cannot be run on this target!
276
 
277
    if { ![gdb_target_supports_trace] } then {
278
        pass "Current target does not supporst trace"
279
        return 1;
280
    }
281
 
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;
286
    }
287
 
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;
292
    }
293
 
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;
298
    }
299
 
300
    gdb_tracepoint_limit_test
301
    gdb_memrange_limit_test
302
    gdb_bytecode_limit_test
303
}
304
 
305
# Start with a fresh gdb.
306
 
307
gdb_exit
308
gdb_start
309
gdb_reinitialize_dir $srcdir/$subdir
310
gdb_load $binfile
311
 
312
if [target_info exists gdb_stub] {
313
    gdb_step_for_stub;
314
}
315
# Body of test encased in a proc so we can return prematurely.
316
gdb_trace_limits_tests

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.