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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.trace/] [limits.exp] - Blame information for rev 833

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
# Copyright 1998, 2007, 2008, 2009, 2010 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 .
15
 
16
load_lib "trace-support.exp"
17
 
18
if $tracelevel then {
19
        strace $tracelevel
20
}
21
 
22
set prms_id 0
23
set bug_id 0
24
 
25
set testfile "limits"
26
set srcfile ${testfile}.c
27
set binfile $objdir/$subdir/$testfile
28
 
29
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
30
        executable {debug nowarnings}] != "" } {
31
    untested limits.exp
32
    return -1
33
}
34
 
35
# Tests:
36
# 1) Meet and exceed artificial limit on number of tracepoints
37
# 2) Meet and exceed artificial limit on number of memranges
38
# 3) Meet and exceed artificial limit on bytes  of bytecode data
39
# [NOTE: number four is moved out into its own separate test module.]
40
# 4) Meet and exceed artificial limit on bytes  of trace buffer storage
41
#    (circular and non-circular modes).  However note that a more
42
#    thorough test of the circular mode can be made separately.
43
 
44
set cr "\[\r\n\]+"
45
 
46
proc gdb_tracepoint_limit_test { } {
47
    global gdb_prompt
48
    global cr
49
 
50
    # Make sure we're in a sane starting state.
51
    gdb_test "tstop" "" ""
52
    gdb_test "tfind none" "" ""
53
    gdb_delete_tracepoints
54
 
55
    # Set three tracepoints
56
    gdb_test "trace foo" \
57
            "Tracepoint \[0-9\]+ at .*" \
58
            "tracepoint limit test: set first tracepoint"
59
 
60
    gdb_test "trace bar" \
61
            "Tracepoint \[0-9\]+ at .*" \
62
            "tracepoint limit test: set second tracepoint"
63
 
64
    gdb_test "trace baz" \
65
            "Tracepoint \[0-9\]+ at .*" \
66
            "tracepoint limit test: set third tracepoint"
67
 
68
    # Set secret artificial tracepoint limit to four
69
    gdb_test "maint packet QTLimit:tp:4" \
70
            "received: .OK." \
71
            "tracepoint limit test: set limit to four"
72
 
73
    # Now sending three tracepoints should succeed.
74
    send_gdb "tstart\n"
75
    gdb_expect {
76
        -re "$cr$gdb_prompt" {
77
            pass "tracepoint limit test: send fewer than limit"
78
        }
79
        default {
80
            fail "tracepoint limit test: send fewer than limit"
81
        }
82
    }
83
 
84
    # Set secret artificial tracepoint limit to three
85
    gdb_test "maint packet QTLimit:tp:3" \
86
            "received: .OK." \
87
            "tracepoint limit test: set limit to three"
88
 
89
    # Now sending three tracepoints should still succeed.
90
    send_gdb "tstart\n"
91
    gdb_expect {
92
        -re "$cr$gdb_prompt" {
93
            pass "tracepoint limit test: send equal to limit"
94
        }
95
        default {
96
            fail "tracepoint limit test: send equal to limit"
97
        }
98
    }
99
 
100
    # Set secret artificial tracepoint limit to two
101
    gdb_test "maint packet QTLimit:tp:2" \
102
            "received: .OK." \
103
            "tracepoint limit test: set limit to two"
104
 
105
    # Now sending three tracepoints should fail.
106
    gdb_test "tstart" \
107
            ".*\[Ee\]rror.*" \
108
            "tracepoint limit test: send more than limit"
109
 
110
    # Clean up:
111
    gdb_test "tstop" "" ""
112
    gdb_test "maint packet QTLimit:tp:FFFFFFFF" "" ""
113
}
114
 
115
proc gdb_memrange_limit_test { } {
116
    global gdb_prompt
117
    global cr
118
 
119
    # Make sure we're in a sane starting state.
120
    gdb_test "tstop" "" ""
121
    gdb_test "tfind none" "" ""
122
    gdb_delete_tracepoints
123
 
124
    # Set three tracepoints, and make 'em collect memranges
125
    gdb_test "trace foo" \
126
            "Tracepoint \[0-9\]+ at .*" \
127
            "memrange limit test: set first tracepoint"
128
 
129
    gdb_trace_setactions "memrange limit test: set first actions" \
130
            "" \
131
            "collect \$arg" "^$"
132
 
133
    gdb_test "trace bar" \
134
            "Tracepoint \[0-9\]+ at .*" \
135
            "memrange limit test: set second tracepoint"
136
 
137
    gdb_trace_setactions "memrange limit test: set second actions" \
138
            "" \
139
            "collect \$arg" "^$"
140
 
141
    gdb_test "trace baz" \
142
            "Tracepoint \[0-9\]+ at .*" \
143
            "memrange limit test: set third tracepoint"
144
 
145
    gdb_trace_setactions "memrange limit test: set third actions" \
146
            "" \
147
            "collect \$arg" "^$"
148
 
149
    # Set secret artificial memrange limit to four
150
    gdb_test "maint packet QTLimit:memrange:4" \
151
            "received: .OK." \
152
            "memrange limit test: set limit to four"
153
 
154
    # Now sending three memranges should still succeed.
155
    send_gdb "tstart\n"
156
    gdb_expect {
157
        -re "$cr$gdb_prompt" {
158
            pass "memrange limit test: send fewer than limit"
159
        }
160
        default {
161
            fail "memrange limit test: send fewer than limit"
162
        }
163
    }
164
 
165
    # Set secret artificial memrange limit to three
166
    gdb_test "maint packet QTLimit:memrange:3" \
167
            "received: .OK." \
168
            "memrange limit test: set limit to three"
169
 
170
    # Now sending three memranges should still succeed.
171
    send_gdb "tstart\n"
172
    gdb_expect {
173
        -re "$cr$gdb_prompt" {
174
            pass "memrange limit test: send equal to limit"
175
        }
176
        default {
177
            fail "memrange limit test: send equal to limit"
178
        }
179
    }
180
 
181
    # Set secret artificial memrange limit to two
182
    gdb_test "maint packet QTLimit:memrange:2" \
183
            "received: .OK." \
184
            "memrange limit test: set limit to two"
185
 
186
    # Now sending three memranges should fail.
187
    gdb_test "tstart" \
188
            ".*\[Ee\]rror.*" \
189
            "memrange limit test: send more than limit"
190
 
191
    # Clean up:
192
    gdb_test "tstop" "" ""
193
    gdb_test "maint packet QTLimit:memrange:FFFFFFFF" "" ""
194
}
195
 
196
 
197
proc gdb_bytecode_limit_test { } {
198
    global gdb_prompt
199
    global cr
200
 
201
    # Make sure we're in a sane starting state.
202
    gdb_test "tstop" "" ""
203
    gdb_test "tfind none" "" ""
204
    gdb_delete_tracepoints
205
 
206
    # Set three tracepoints
207
    gdb_test "trace foo" \
208
            "Tracepoint \[0-9\]+ at .*" \
209
            "bytecode limit test: set first tracepoint"
210
 
211
    gdb_trace_setactions "bytecode limit test: set first actions" \
212
            "" \
213
            "collect x + n" "^$"
214
 
215
    gdb_test "trace bar" \
216
            "Tracepoint \[0-9\]+ at .*" \
217
            "bytecode limit test: set second tracepoint"
218
 
219
    gdb_trace_setactions "bytecode limit test: set second actions" \
220
            "" \
221
            "collect y + n" "^$"
222
 
223
    gdb_test "trace baz" \
224
            "Tracepoint \[0-9\]+ at .*" \
225
            "bytecode limit test: set third tracepoint"
226
 
227
    gdb_trace_setactions "bytecode limit test: set third actions" \
228
            "" \
229
            "collect z + n" "^$"
230
 
231
    # Set secret artificial bytecode limit to a large number
232
    gdb_test "maint packet QTLimit:bytecode:400" \
233
            "received: .OK." \
234
            "bytecode limit test: set limit to large"
235
 
236
    # Now sending three bytecodes should still succeed.
237
    send_gdb "tstart\n"
238
    gdb_expect {
239
        -re "$cr$gdb_prompt" {
240
            pass "bytecode limit test: send fewer than limit"
241
        }
242
        default {
243
            fail "bytecode limit test: send fewer than limit"
244
        }
245
    }
246
 
247
    # Set secret artificial bytecode limit to a small number
248
    gdb_test "maint packet QTLimit:bytecode:40" \
249
            "received: .OK." \
250
            "bytecode limit test: set limit to small"
251
 
252
    # Now sending three bytecodes should fail.
253
    gdb_test "tstart" \
254
            ".*\[Ee\]rror.*" \
255
            "bytecode limit test: send more than limit"
256
 
257
 
258
    # Clean up:
259
    gdb_test "tstop" "" ""
260
    gdb_test "maint packet QTLimit:bytecode:FFFFFFFF" "" ""
261
}
262
 
263
proc gdb_trace_limits_tests { } {
264
    global gdb_prompt
265
 
266
    # We generously give ourselves one "pass" if we successfully
267
    # detect that this test cannot be run on this target!
268
 
269
    if { ![gdb_target_supports_trace] } then {
270
        pass "Current target does not support trace"
271
        return 1;
272
    }
273
 
274
    if [gdb_test "maint packet QTLimit:tp:ffffffff" \
275
            "received: .OK." ""] then {
276
        pass "This test cannot be run on this target"
277
        return 1;
278
    }
279
 
280
    if [gdb_test "maint packet QTLimit:memrange:ffffffff" \
281
            "received: .OK." ""] then {
282
        pass "This test cannot be run on this target"
283
        return 1;
284
    }
285
 
286
    if [gdb_test "maint packet QTLimit:bytecode:ffffffff" \
287
            "received: .OK." ""] then {
288
        pass "This test cannot be run on this target"
289
        return;
290
    }
291
 
292
    gdb_tracepoint_limit_test
293
    gdb_memrange_limit_test
294
    gdb_bytecode_limit_test
295
}
296
 
297
# Start with a fresh gdb.
298
 
299
gdb_exit
300
gdb_start
301
gdb_reinitialize_dir $srcdir/$subdir
302
gdb_load $binfile
303
 
304
if [target_info exists gdb_stub] {
305
    gdb_step_for_stub;
306
}
307
# Body of test encased in a proc so we can return prematurely.
308
gdb_trace_limits_tests

powered by: WebSVN 2.1.0

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