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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gdb/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.base/] [ena-dis-br.exp] - Blame information for rev 25

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 25 jlechner
# This testcase is part of GDB, the GNU debugger.
2
 
3
# Copyright 1997, 1998, 1999, 2003, 2004, 2007, 2008
4
# Free Software Foundation, Inc.
5
 
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 3 of the License, or
9
# (at your option) any later version.
10
#
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
# GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License
17
# along with this program.  If not, see .
18
 
19
if $tracelevel then {
20
    strace $tracelevel
21
}
22
 
23
global usestubs
24
 
25
#
26
# test running programs
27
#
28
set prms_id 0
29
set bug_id 0
30
 
31
set testfile "break"
32
set srcfile ${testfile}.c
33
set srcfile1 ${testfile}1.c
34
set binfile ${objdir}/${subdir}/${testfile}
35
 
36
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug nowarnings}] != "" } {
37
     untested ena-dis-br.exp
38
     return -1
39
}
40
 
41
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug nowarnings}] != "" } {
42
     untested ena-dis-br.exp
43
     return -1
44
}
45
 
46
if  { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug nowarnings}] != "" } {
47
     untested ena-dis-br.exp
48
     return -1
49
}
50
 
51
gdb_exit
52
gdb_start
53
gdb_reinitialize_dir $srcdir/$subdir
54
gdb_load ${binfile}
55
 
56
set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
57
set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile1]
58
set bp_location9 [gdb_get_line_number "set breakpoint 9 here" $srcfile1]
59
set bp_location11 [gdb_get_line_number "set breakpoint 11 here"]
60
set bp_location13 [gdb_get_line_number "set breakpoint 13 here" $srcfile1]
61
set bp_location14 [gdb_get_line_number "set breakpoint 14 here" $srcfile1]
62
set bp_location15 [gdb_get_line_number "set breakpoint 15 here" $srcfile1]
63
set bp_location16 [gdb_get_line_number "set breakpoint 16 here" $srcfile1]
64
set bp_location17 [gdb_get_line_number "set breakpoint 17 here" $srcfile1]
65
set bp_location18 [gdb_get_line_number "set breakpoint 18 here" $srcfile1]
66
 
67
if ![runto_main] then { fail "enable/disable break tests suppressed" }
68
 
69
# Verify that we can set a breakpoint (the location is irrelevant),
70
# then enable it (yes, it's already enabled by default), then hit it.
71
 
72
proc break_at { breakpoint where } {
73
    global gdb_prompt
74
    global expect_out
75
 
76
    set test "break $breakpoint"
77
    set bp 0
78
    gdb_test_multiple "$test" "$test" {
79
        -re "Breakpoint (\[0-9\]*) at .*$where.*$gdb_prompt $" {
80
            set bp $expect_out(1,string)
81
            pass "$test"
82
        }
83
    }
84
    return $bp
85
}
86
 
87
set bp [break_at "marker1" " line ($bp_location15|$bp_location16)"]
88
 
89
gdb_test "enable $bp" "" "enable break marker1"
90
 
91
gdb_test "info break $bp" \
92
    "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y.*" \
93
    "info break marker1"
94
 
95
# See the comments in condbreak.exp for "run until breakpoint at
96
# marker1" for an explanation of the xfail below.
97
set test "continue to break marker1"
98
gdb_test_multiple "continue" "$test" {
99
    -re "Breakpoint \[0-9\]*, marker1.*$gdb_prompt $" {
100
        pass "$test"
101
    }
102
    -re "Breakpoint \[0-9\]*, $hex in marker1.*$gdb_prompt $" {
103
        xfail "$test"
104
    }
105
}
106
 
107
gdb_test "delete $bp" "" "delete break marker1"
108
 
109
# Verify that we can set a breakpoint to be self-disabling after the
110
# first time it triggers.
111
set bp [break_at "marker2" " line ($bp_location8|$bp_location9)"]
112
 
113
gdb_test "enable once $bp" "" "enable once break marker2"
114
 
115
gdb_test "info break $bp" \
116
    "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+dis\[ \t\]+y.*" \
117
    "info auto-disabled break marker2"
118
 
119
# See the comments in condbreak.exp for "run until breakpoint at
120
# marker1" for an explanation of the xfail below.
121
set test "continue to auto-disabled break marker2"
122
gdb_test_multiple "continue" "$test" {
123
    -re "Breakpoint \[0-9\]*, marker2.*$gdb_prompt $" {
124
        pass "$test"
125
    }
126
    -re "Breakpoint \[0-9\]*, $hex in marker2.*$gdb_prompt $" {
127
        xfail "$test"
128
    }
129
}
130
 
131
gdb_test "info break $bp" \
132
    "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+dis\[ \t\]+n.*" \
133
    "info auto-disabled break marker2"
134
 
135
# Verify that we don't stop at a disabled breakpoint.
136
gdb_continue_to_end "no stop"
137
rerun_to_main
138
gdb_continue_to_end "no stop at auto-disabled break marker2"
139
 
140
# Verify that we can set a breakpoint to be self-deleting after the
141
# first time it triggers.
142
if ![runto_main] then {
143
    fail "enable/disable break tests suppressed"
144
}
145
 
146
set bp [break_at "marker3" " line ($bp_location17|$bp_location18)"]
147
 
148
gdb_test "enable del $bp" "" "enable del break marker3"
149
 
150
gdb_test "info break $bp" \
151
    "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+del\[ \t\]+y.*" \
152
    "info auto-deleted break marker2"
153
 
154
gdb_test "continue" \
155
    ".*marker3 .*:($bp_location17|$bp_location18).*" \
156
    "continue to auto-deleted break marker3"
157
 
158
gdb_test "info break $bp" \
159
    ".*No breakpoint or watchpoint number.*" \
160
    "info auto-deleted break marker3"
161
 
162
# Verify that we can set a breakpoint and manually disable it (we've
163
# already proven that disabled bp's don't trigger).
164
 
165
set bp [break_at "marker4" " line ($bp_location14|$bp_location13).*"]
166
 
167
gdb_test "disable $bp" "" "disable break marker4"
168
 
169
gdb_test "info break $bp" \
170
    "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+n.*" \
171
    "info break marker4"
172
 
173
# Verify that we can set a breakpoint with an ignore count N, which
174
# should cause the next N triggers of the bp to be ignored.  (This is
175
# a flavor of enablement/disablement, after all.)
176
 
177
if ![runto_main] then {
178
    fail "enable/disable break tests suppressed"
179
}
180
 
181
set bp [break_at "marker1" " line ($bp_location15|$bp_location16).*"]
182
 
183
# Verify that an ignore of a non-existent breakpoint is gracefully
184
# handled.
185
 
186
gdb_test "ignore 999 2" \
187
    "No breakpoint number 999..*" \
188
    "ignore non-existent break"
189
 
190
# Verify that a missing ignore count is gracefully handled.
191
 
192
gdb_test "ignore $bp" \
193
    "Second argument .specified ignore-count. is missing..*" \
194
    "ignore break with missing ignore count"
195
 
196
# Verify that a negative or zero ignore count is handled gracefully
197
# (they both are treated the same).
198
 
199
gdb_test "ignore $bp -1" \
200
    "Will stop next time breakpoint \[0-9\]* is reached..*" \
201
    "ignore break marker1 -1"
202
 
203
gdb_test "ignore $bp 0" \
204
    "Will stop next time breakpoint \[0-9\]* is reached..*" \
205
    "ignore break marker1 0"
206
 
207
gdb_test "ignore $bp 1" \
208
    "Will ignore next crossing of breakpoint \[0-9\]*.*" \
209
    "ignore break marker1"
210
 
211
gdb_test "info break $bp" \
212
    "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y.*ignore next 1 hits.*" \
213
    "info ignored break marker1"
214
 
215
gdb_continue_to_end "no stop at ignored break marker1"
216
rerun_to_main
217
 
218
# See the comments in condbreak.exp for "run until breakpoint at marker1"
219
# for an explanation of the xfail below.
220
set test "continue to break marker1, 2nd time"
221
gdb_test_multiple "continue" "$test" {
222
    -re "Breakpoint \[0-9\]*, marker1.*$gdb_prompt $" {
223
        pass "continue to break marker1, 2nd time"
224
    }
225
    -re "Breakpoint \[0-9\]*, $hex in marker1.*$gdb_prompt $" {
226
        xfail "continue to break marker1, 2nd time"
227
    }
228
}
229
 
230
# Verify that we can specify both an ignore count and an auto-delete.
231
 
232
if ![runto_main] then {
233
    fail "enable/disable break tests suppressed"
234
}
235
 
236
set bp [break_at marker1 " line ($bp_location15|$bp_location16).*"]
237
 
238
gdb_test "ignore $bp 1" \
239
    "Will ignore next crossing of breakpoint \[0-9\]*.*" \
240
    "ignore break marker1"
241
 
242
gdb_test "enable del $bp" "" "enable del break marker1"
243
 
244
gdb_test "info break $bp" \
245
    "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+del\[ \t\]+y.*ignore next 1 hits.*" \
246
    "info break marker1"
247
 
248
gdb_continue_to_end "no stop at ignored & auto-deleted break marker1"
249
rerun_to_main
250
 
251
gdb_test "continue" \
252
    ".*marker1 .*:($bp_location15|$bp_location16).*" \
253
    "continue to ignored & auto-deleted break marker1"
254
 
255
# Verify that a disabled breakpoint's ignore count isn't updated when
256
# the bp is encountered.
257
 
258
if ![runto_main] then {
259
    fail "enable/disable break tests suppressed"
260
}
261
 
262
set bp [break_at marker1 " line ($bp_location15|$bp_location16)"]
263
 
264
gdb_test "ignore $bp 10" \
265
    "Will ignore next 10 crossings of breakpoint \[0-9\]*.*" \
266
    "ignore break marker1"
267
 
268
gdb_test "disable $bp" "" "disable break marker1"
269
 
270
gdb_continue_to_end "no stop at ignored & disabled break marker1"
271
rerun_to_main
272
 
273
gdb_test "info break $bp" \
274
    "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+n.*ignore next 10 hits.*" \
275
    "info ignored & disabled break marker1"
276
 
277
# Verify that GDB correctly handles the "continue" command with an argument,
278
# which is an ignore count to set on the currently stopped-at breakpoint.
279
# (Also verify that GDB gracefully handles the case where the inferior
280
# isn't stopped at a breakpoint.)
281
#
282
if ![runto_main] then { fail "enable/disable break tests suppressed" }
283
 
284
gdb_test "break $bp_location1" \
285
    "Breakpoint \[0-9\]*.*, line $bp_location1.*" \
286
    "prepare to continue with ignore count"
287
 
288
gdb_test "continue 2" \
289
    "Will ignore next crossing of breakpoint \[0-9\]*.  Continuing..*" \
290
    "continue with ignore count"
291
 
292
gdb_test "next" ".*$bp_location11\[ \t\]*marker1.*" \
293
    step after continue with ignore count"
294
 
295
set test "continue with ignore count, not stopped at bpt"
296
gdb_test_multiple "continue 2" "$test" {
297
    -re "Not stopped at any breakpoint; argument ignored.*$gdb_prompt $" {
298
        pass "$test"
299
    }
300
    -re "No breakpoint number -1.*$gdb_prompt $" {
301
        kfail gdb/1689 "$test"
302
    }
303
}
304
 
305
gdb_exit
306
return 0

powered by: WebSVN 2.1.0

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