1 |
578 |
markom |
# Copyright 1999, 2000, 2001
|
2 |
|
|
# Free Software Foundation, Inc.
|
3 |
|
|
|
4 |
|
|
# This program is free software; you can redistribute it and/or modify
|
5 |
|
|
# it under the terms of the GNU General Public License as published by
|
6 |
|
|
# the Free Software Foundation; either version 2 of the License, or
|
7 |
|
|
# (at your option) any later version.
|
8 |
|
|
#
|
9 |
|
|
# This program is distributed in the hope that it will be useful,
|
10 |
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
|
|
# GNU General Public License for more details.
|
13 |
|
|
#
|
14 |
|
|
# You should have received a copy of the GNU General Public License
|
15 |
|
|
# along with this program; if not, write to the Free Software
|
16 |
|
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
17 |
|
|
|
18 |
|
|
# Please email any bugs, comments, and/or additions to this file to:
|
19 |
|
|
# bug-gdb@prep.ai.mit.edu
|
20 |
|
|
|
21 |
|
|
# This file was written by Elena Zannoni (ezannoni@cygnus.com)
|
22 |
|
|
|
23 |
|
|
if $tracelevel then {
|
24 |
|
|
strace $tracelevel
|
25 |
|
|
}
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
# are we on a target board? If so, don't run these tests.
|
29 |
|
|
# note: this is necessary because we cannot use runto_main (which would
|
30 |
|
|
# work for remote targets too) because of the different prompt we get
|
31 |
|
|
# when using annotation level 2.
|
32 |
|
|
#
|
33 |
|
|
if ![isnative] then {
|
34 |
|
|
return 0
|
35 |
|
|
}
|
36 |
|
|
|
37 |
|
|
|
38 |
|
|
#
|
39 |
|
|
# test running programs
|
40 |
|
|
#
|
41 |
|
|
set prms_id 0
|
42 |
|
|
set bug_id 0
|
43 |
|
|
|
44 |
|
|
set testfile "annota1"
|
45 |
|
|
set srcfile ${testfile}.c
|
46 |
|
|
set binfile ${objdir}/${subdir}/${testfile}
|
47 |
|
|
|
48 |
|
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
|
49 |
|
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
50 |
|
|
}
|
51 |
|
|
|
52 |
|
|
|
53 |
|
|
gdb_exit
|
54 |
|
|
gdb_start
|
55 |
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
56 |
|
|
gdb_load ${binfile}
|
57 |
|
|
|
58 |
|
|
if [target_info exists gdb_stub] {
|
59 |
|
|
gdb_step_for_stub;
|
60 |
|
|
}
|
61 |
|
|
|
62 |
|
|
#
|
63 |
|
|
# the line at which break main will put the breakpoint
|
64 |
|
|
#
|
65 |
|
|
set main_line 32
|
66 |
|
|
|
67 |
|
|
# The commands we test here produce many lines of output; disable "press
|
68 |
|
|
# to continue" prompts.
|
69 |
|
|
send_gdb "set height 0\n"
|
70 |
|
|
gdb_expect -re "$gdb_prompt $"
|
71 |
|
|
|
72 |
|
|
#
|
73 |
|
|
# break at main
|
74 |
|
|
#
|
75 |
|
|
gdb_test "break main" \
|
76 |
|
|
"Breakpoint.*at.* file .*$srcfile, line.*" \
|
77 |
|
|
"breakpoint main"
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
#
|
81 |
|
|
# NOTE: this prompt is OK only when the annotation level is > 1
|
82 |
|
|
# NOTE: When this prompt is in use the gdb_test procedure cannot be used because
|
83 |
|
|
# it assumes that the last char after the gdb_prompt is a white space. This is not
|
84 |
|
|
# true with this annotated prompt. So we must use send_gdb and gdb_expect.
|
85 |
|
|
#
|
86 |
|
|
|
87 |
|
|
set old_gdb_prompt $gdb_prompt
|
88 |
|
|
set gdb_prompt "\r\n\032\032pre-prompt\r\n$gdb_prompt \r\n\032\032prompt\r\n"
|
89 |
|
|
|
90 |
|
|
|
91 |
|
|
|
92 |
|
|
#
|
93 |
|
|
# set the annotation level to 2
|
94 |
|
|
#
|
95 |
|
|
# of course, this will test:
|
96 |
|
|
# annotate-pre-prompt
|
97 |
|
|
# annotate-prompt
|
98 |
|
|
# annotate-post-prompt (in the next block)
|
99 |
|
|
#
|
100 |
|
|
send_gdb "set annotate 2\n"
|
101 |
|
|
gdb_expect {
|
102 |
|
|
-re "set annotate 2\r\n$gdb_prompt$" { pass "annotation set at level 2" }
|
103 |
|
|
-re ".*$gdb_prompt$" { fail "annotation set at level 2" }
|
104 |
|
|
timeout { fail "annotation set at level 2 (timeout)" }
|
105 |
|
|
}
|
106 |
|
|
|
107 |
|
|
|
108 |
|
|
#
|
109 |
|
|
# info break will test:
|
110 |
|
|
# annotate-breakpoints-headers
|
111 |
|
|
# annotate-field
|
112 |
|
|
# annotate-breakpoints-table
|
113 |
|
|
# annotate-record
|
114 |
|
|
# annotate-breakpoints-table-end
|
115 |
|
|
#
|
116 |
|
|
send_gdb "info break\n"
|
117 |
|
|
gdb_expect {
|
118 |
|
|
-re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-headers\r\n\r\n\032\032field 0\r\nNum \r\n\032\032field 1\r\nType \r\n\032\032field 2\r\nDisp \r\n\032\032field 3\r\nEnb \r\n\032\032field 4\r\nAddress +\r\n\032\032field 5\r\nWhat\r\n\r\n\032\032breakpoints-table\r\n\r\n\032\032record\r\n\r\n\032\032field 0\r\n1 \r\n\032\032field 1\r\nbreakpoint \r\n\032\032field 2\r\nkeep \r\n\032\032field 3\r\ny \r\n\032\032field 4\r\n$hex \r\n\032\032field 5\r\nin main at ${srcdir}/${subdir}/${srcfile}:$main_line\r\n\r\n\032\032breakpoints-table-end\r\n$gdb_prompt$" \
|
119 |
|
|
{pass "breakpoint info"}
|
120 |
|
|
-re ".*$gdb_prompt$" { fail "breakpoint info" }
|
121 |
|
|
timeout { fail "breakpoint info (timeout)" }
|
122 |
|
|
}
|
123 |
|
|
|
124 |
|
|
|
125 |
|
|
#
|
126 |
|
|
# run to a break point will test:
|
127 |
|
|
# annotate-frames-invalid
|
128 |
|
|
# annotate-breakpoints-invalid (a.k.a. breakpoints-changed)
|
129 |
|
|
# annotate-starting
|
130 |
|
|
# annotate-breakpoint
|
131 |
|
|
# annotate-frame-begin
|
132 |
|
|
# annotate-frame-function-name
|
133 |
|
|
# annotate-frame-args
|
134 |
|
|
# annotate-frame-source-begin
|
135 |
|
|
# annotate-frame-source-file
|
136 |
|
|
# annotate-frame-source-file-end
|
137 |
|
|
# annotate-frame-source-line
|
138 |
|
|
# annotate-frame-source-end
|
139 |
|
|
# annotate-source
|
140 |
|
|
# annotate-frame-end
|
141 |
|
|
# annotate-stopped
|
142 |
|
|
#
|
143 |
|
|
#exp_internal 1
|
144 |
|
|
send_gdb "run\n"
|
145 |
|
|
gdb_expect {
|
146 |
|
|
-re "\r\n\032\032post-prompt\r\nStarting program: $binfile \(\r\n\r\n\032\032frames-invalid\)+\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)+\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n\032\032breakpoint 1\r\n\r\nBreakpoint 1, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*annota1.c\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$main_line\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped.*$gdb_prompt$" {
|
147 |
|
|
pass "run until main breakpoint"
|
148 |
|
|
}
|
149 |
|
|
-re ".*$gdb_prompt$" {
|
150 |
|
|
fail "run until main breakpoint"
|
151 |
|
|
}
|
152 |
|
|
timeout {
|
153 |
|
|
fail "run until main breakpoint (timeout)"
|
154 |
|
|
}
|
155 |
|
|
}
|
156 |
|
|
#exp_internal 0
|
157 |
|
|
#exit 0
|
158 |
|
|
|
159 |
|
|
#
|
160 |
|
|
# Let's do a next, to get to a point where the array is initialized
|
161 |
|
|
# We don't care about the annotated output for this operation, it is the same as
|
162 |
|
|
# the one produced by run above
|
163 |
|
|
#
|
164 |
|
|
send_gdb "next\n"
|
165 |
|
|
gdb_expect {
|
166 |
|
|
-re ".*$gdb_prompt$" { pass "go after array init line" }
|
167 |
|
|
timeout { fail "go after array init line (timeout)" }
|
168 |
|
|
}
|
169 |
|
|
|
170 |
|
|
|
171 |
|
|
#
|
172 |
|
|
# printing the array will test:
|
173 |
|
|
# annotate-value-history-begin
|
174 |
|
|
# annotate-value-history-value
|
175 |
|
|
# annotate-array-section-begin
|
176 |
|
|
# annotate-elt
|
177 |
|
|
# FIXME: annotate-elt-rep and annotate-elt-rep-end not tested
|
178 |
|
|
# annotate-array-section-end
|
179 |
|
|
# annotate-value-history-end
|
180 |
|
|
# FIXME: annotate-value-begin and annotate-value-end not tested (the gdb output
|
181 |
|
|
# command would cause them to be used)
|
182 |
|
|
#
|
183 |
|
|
send_gdb "print my_array\n"
|
184 |
|
|
gdb_expect {
|
185 |
|
|
-re "\r\n\032\032post-prompt\r\n\r\n\032\032value-history-begin 1 -\r\n.*= \r\n\032\032value-history-value\r\n.\r\n\032\032array-section-begin 0 -\r\n1\r\n\032\032elt\r\n, 2\r\n\032\032elt\r\n, 3\r\n\032\032elt\r\n\r\n\032\032array-section-end\r\n.\r\n\r\n\032\032value-history-end\r\n$gdb_prompt$" \
|
186 |
|
|
{ pass "print array" }
|
187 |
|
|
-re ".*$gdb_prompt$" { fail "print array" }
|
188 |
|
|
timeout { fail "print array (timeout)" }
|
189 |
|
|
}
|
190 |
|
|
|
191 |
|
|
|
192 |
|
|
#
|
193 |
|
|
# this should generate an error message, so to test:
|
194 |
|
|
# annotate-error-begin
|
195 |
|
|
# FIXME: annotate-error not tested
|
196 |
|
|
#
|
197 |
|
|
|
198 |
|
|
#exp_internal 1
|
199 |
|
|
send_gdb "print non_existent_value\n"
|
200 |
|
|
gdb_expect {
|
201 |
|
|
-re "\r\n\032\032post-prompt\r\n\r\n\032\032error-begin\r\nNo symbol \"non_existent_value\" in current context.\r\n\r\n\032\032error\r\n$gdb_prompt$" \
|
202 |
|
|
{ pass "print non_existent_value" }
|
203 |
|
|
-re ".*$gdb_prompt$" { fail "print non_existent_value" }
|
204 |
|
|
timeout { fail "print non_existent_value (timeout)" }
|
205 |
|
|
}
|
206 |
|
|
|
207 |
|
|
|
208 |
|
|
#
|
209 |
|
|
# break at signal handler. So that, once we are in the sig handler, if we do a bt
|
210 |
|
|
# we can test annotate-signal-handler-caller
|
211 |
|
|
#
|
212 |
|
|
send_gdb "break handle_USR1\n"
|
213 |
|
|
gdb_expect {
|
214 |
|
|
-re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\nBreakpoint.*at $hex: file.*$srcfile, line.*\r\n$gdb_prompt$" \
|
215 |
|
|
{ pass "breakpoint handle_USR1" }
|
216 |
|
|
-re ".*$gdb_prompt$" { fail "break at handle_USR1" }
|
217 |
|
|
timeout { fail "break at handle_USR1 (timeout)" }
|
218 |
|
|
}
|
219 |
|
|
|
220 |
|
|
#
|
221 |
|
|
# break at printf. When we are stopped at printf, we can test
|
222 |
|
|
#
|
223 |
|
|
send_gdb "break printf\n"
|
224 |
|
|
gdb_expect {
|
225 |
|
|
-re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\nBreakpoint.*at $hex.*$gdb_prompt$" \
|
226 |
|
|
{ pass "breakpoint printf" }
|
227 |
|
|
-re ".*$gdb_prompt$" { fail "break printf" }
|
228 |
|
|
timeout { fail "break printf (timeout)" }
|
229 |
|
|
}
|
230 |
|
|
|
231 |
|
|
#
|
232 |
|
|
# get to printf
|
233 |
|
|
#
|
234 |
|
|
send_gdb "continue\n"
|
235 |
|
|
gdb_expect {
|
236 |
|
|
-re "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032breakpoint 3\r\n\r\nBreakpoint 3, \r\n\032\032frame-begin 0 $hex\r\n\r\n(\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n)*\032\032frame-function-name\r\nprintf\r\n\032\032frame-args\r\n.*\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \
|
237 |
|
|
{ pass "continue to printf" }
|
238 |
|
|
-re ".*$gdb_prompt$" { fail "continue to printf" }
|
239 |
|
|
timeout { fail "continue to printf (timeout)" }
|
240 |
|
|
}
|
241 |
|
|
|
242 |
|
|
#
|
243 |
|
|
# test:
|
244 |
|
|
# annotate-frame-where
|
245 |
|
|
# annotate-frame-address
|
246 |
|
|
# annotate-frame-address-end
|
247 |
|
|
#
|
248 |
|
|
send_gdb "backtrace\n"
|
249 |
|
|
gdb_expect {
|
250 |
|
|
-re "\r\n\032\032post-prompt\r\n\r\n\032\032frame-begin 0 $hex\r\n.0 \r\n(\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n)*\032\032frame-function-name\r\nprintf\r\n\032\032frame-args\r\n \\(.*frame-end\r\n\r\n\032\032frame-begin 1 $hex\r\n.1 \r\n\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n${srcdir}/${subdir}/${srcfile}\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032frame-end\r\n$gdb_prompt$" \
|
251 |
|
|
{ pass "bactrace from shlibrary" }
|
252 |
|
|
-re ".*$gdb_prompt$" { fail "backtrace from shlibrary" }
|
253 |
|
|
timeout { fail "backtrace from shlibrary (timeout)" }
|
254 |
|
|
}
|
255 |
|
|
|
256 |
|
|
|
257 |
|
|
#
|
258 |
|
|
# test printing a frame with some arguments:
|
259 |
|
|
# annotate-arg-begin
|
260 |
|
|
# annotate-arg-name-end
|
261 |
|
|
# annotate-arg-value
|
262 |
|
|
# annotate-arg-end
|
263 |
|
|
#
|
264 |
|
|
send_gdb "signal SIGUSR1\n"
|
265 |
|
|
gdb_expect {
|
266 |
|
|
-re "\r\n\032\032post-prompt\r\nContinuing with signal SIGUSR1.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032breakpoint 2\r\n\r\nBreakpoint 2, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nhandle_USR1\r\n\032\032frame-args\r\n \\(\r\n\032\032arg-begin\r\nsig\r\n\032\032arg-name-end\r\n=\r\n\032\032arg-value -\r\n$decimal\r\n\032\032arg-end\r\n\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n${srcdir}/${subdir}/${srcfile}\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*annota1.c:.*:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \
|
267 |
|
|
{ pass "send SIGUSR1" }
|
268 |
|
|
-re ".*$gdb_prompt$" { fail "send SIGUSR1" }
|
269 |
|
|
timeout { fail "send SIGUSR1 (timeout)" }
|
270 |
|
|
}
|
271 |
|
|
|
272 |
|
|
|
273 |
|
|
#
|
274 |
|
|
# test:
|
275 |
|
|
# annotate-signal-handler-caller
|
276 |
|
|
#
|
277 |
|
|
verbose "match_max local is: [match_max]"
|
278 |
|
|
verbose "match_max default is: [match_max -d]"
|
279 |
|
|
# This is necessary because a 2000 buffer is not enought to get everything
|
280 |
|
|
# up to the prompt ad the test gets a timeout.
|
281 |
|
|
match_max 3000
|
282 |
|
|
verbose "match_max now is: [match_max]"
|
283 |
|
|
send_gdb "backtrace\n"
|
284 |
|
|
gdb_expect {
|
285 |
|
|
-re "frame-begin 0 $hex\r\n#0.*frame-end.*frame-begin 1 $hex\r\n#1.*(\032\032signal-handler-caller\r\n.signal handler called.\r\n\r\n)*\032\032frame-end\r\n\r\n\032\032frame-begin 2 $hex\r\n#2.*(frame-begin 3 $hex\r\n#3.*)*frame-end.*$gdb_prompt$" {
|
286 |
|
|
pass "backtrace @ signal handler"
|
287 |
|
|
}
|
288 |
|
|
-re ".*$gdb_prompt$" { fail "backtrace @ signal handler" }
|
289 |
|
|
timeout { fail "backtrace @ signal handler (timeout)" }
|
290 |
|
|
}
|
291 |
|
|
|
292 |
|
|
#
|
293 |
|
|
# delete all the breakpoints
|
294 |
|
|
#
|
295 |
|
|
send_gdb "delete 1\n"
|
296 |
|
|
gdb_expect {
|
297 |
|
|
-re "\r\n\032\032post-prompt\r\n$gdb_prompt$" \
|
298 |
|
|
{ pass "delete bp 1" }
|
299 |
|
|
-re ".*$gdb_prompt$" { fail "delete bp 1" }
|
300 |
|
|
timeout { fail "delete bp 1 (timeout)" }
|
301 |
|
|
}
|
302 |
|
|
|
303 |
|
|
send_gdb "delete 2\n"
|
304 |
|
|
gdb_expect {
|
305 |
|
|
-re "\r\n\032\032post-prompt\r\n$gdb_prompt$" \
|
306 |
|
|
{ pass "delete bp 2" }
|
307 |
|
|
-re ".*$gdb_prompt$" { fail "delete bp 2 " }
|
308 |
|
|
timeout { fail "delete bp 2 (timeout)" }
|
309 |
|
|
}
|
310 |
|
|
|
311 |
|
|
send_gdb "delete 3\n"
|
312 |
|
|
gdb_expect {
|
313 |
|
|
-re "\r\n\032\032post-prompt\r\n$gdb_prompt$" \
|
314 |
|
|
{ pass "delete bp 3" }
|
315 |
|
|
-re ".*$gdb_prompt$" { fail "delete bp 3" }
|
316 |
|
|
timeout { fail "delete bp 3 (timeout)" }
|
317 |
|
|
}
|
318 |
|
|
|
319 |
|
|
#
|
320 |
|
|
# break at main, after value is initialized. This is in preparation
|
321 |
|
|
# to test the annotate output for the display command.
|
322 |
|
|
#
|
323 |
|
|
send_gdb "break main\n"
|
324 |
|
|
gdb_expect {
|
325 |
|
|
-re "post-prompt.*\032\032breakpoints-invalid.*Breakpoint 4 at $hex: file ${srcdir}/${subdir}/${srcfile}, line $main_line.*$gdb_prompt$" \
|
326 |
|
|
{ pass "break at 28" }
|
327 |
|
|
-re ".*$gdb_prompt$" { fail "break at 28" }
|
328 |
|
|
timeout { fail "break at 28 (timeout)" }
|
329 |
|
|
}
|
330 |
|
|
|
331 |
|
|
#
|
332 |
|
|
# display the value; test:
|
333 |
|
|
# annotate-display-begin
|
334 |
|
|
# annotate-display-number-end
|
335 |
|
|
# annotate-display-format
|
336 |
|
|
# annotate-display-expression
|
337 |
|
|
# annotate-display-expression-end
|
338 |
|
|
# annotate-display-end
|
339 |
|
|
# FIXME: annotate-display-value not tested
|
340 |
|
|
#
|
341 |
|
|
send_gdb "display value\n"
|
342 |
|
|
gdb_expect {
|
343 |
|
|
-re "post-prompt\r\n\r\n\032\032display-begin\r\n1\r\n\032\032display-number-end\r\n: \r\n\032\032display-format\r\n\r\n\032\032display-expression\r\nvalue\r\n\032\032display-expression-end\r\n = \r\n\032\032display-expression\r\n7\r\n\r\n\032\032display-end\r\n$gdb_prompt$" \
|
344 |
|
|
{ pass "set up display" }
|
345 |
|
|
-re ".*$gdb_prompt$" { fail "set up display" }
|
346 |
|
|
timeout { fail "set up display (timeout)" }
|
347 |
|
|
}
|
348 |
|
|
|
349 |
|
|
|
350 |
|
|
# should ask query. Test annotate-query.
|
351 |
|
|
# we don't care about anything else here, only the query.
|
352 |
|
|
|
353 |
|
|
send_gdb "run\n"
|
354 |
|
|
gdb_expect {
|
355 |
|
|
-re "pre-query.*already.*\\(y or n\\).*query\r\n" {
|
356 |
|
|
send_gdb "y\n"
|
357 |
|
|
gdb_expect {
|
358 |
|
|
-re ".*post-query.*$gdb_prompt$" \
|
359 |
|
|
{ pass "re-run" }
|
360 |
|
|
-re ".*$gdb_prompt$" { fail "re-run" }
|
361 |
|
|
timeout { fail "re-run (timeout)" }
|
362 |
|
|
}
|
363 |
|
|
}
|
364 |
|
|
-re ".*$gdb_prompt$" { fail "re-run" }
|
365 |
|
|
timeout { fail "re-run (timeout)" }
|
366 |
|
|
}
|
367 |
|
|
|
368 |
|
|
#
|
369 |
|
|
# Test that breakpoints-invalid is issued once and only once for
|
370 |
|
|
# breakpoint ignore count changes, after annotation stopped.
|
371 |
|
|
#
|
372 |
|
|
send_gdb "break 46\n"
|
373 |
|
|
gdb_expect {
|
374 |
|
|
-re "Breakpoint 5 at $hex: file .*$srcfile, line 46.*$gdb_prompt$" {
|
375 |
|
|
pass "break at 46"
|
376 |
|
|
}
|
377 |
|
|
-re ".*$gdb_prompt$" { fail "break at 46" }
|
378 |
|
|
timeout { fail "break at 46 (timeout)" }
|
379 |
|
|
}
|
380 |
|
|
|
381 |
|
|
send_gdb "ignore 5 4\n"
|
382 |
|
|
gdb_expect {
|
383 |
|
|
-re "Will ignore next 4 crossings of breakpoint 5.*$gdb_prompt$" {
|
384 |
|
|
pass "ignore 5 4"
|
385 |
|
|
}
|
386 |
|
|
-re ".*$gdb_prompt$" { fail "ignore 5 4" }
|
387 |
|
|
timeout { fail "ignore 5 4 (timeout)" }
|
388 |
|
|
}
|
389 |
|
|
|
390 |
|
|
send_gdb "continue\n"
|
391 |
|
|
gdb_expect {
|
392 |
|
|
-re ".*$srcfile:46:.*\032\032stopped\r\n\r\n\032\032breakpoints-invalid\r\n$gdb_prompt$" {
|
393 |
|
|
pass "annotate ignore count change"
|
394 |
|
|
}
|
395 |
|
|
-re ".*$gdb_prompt$" { fail "annotate ignore count change" }
|
396 |
|
|
timeout { fail "annotate ignore count change (timeout)" }
|
397 |
|
|
}
|
398 |
|
|
|
399 |
|
|
# check that ignore command is working, or the above can provide
|
400 |
|
|
# misleading assurance ...
|
401 |
|
|
|
402 |
|
|
send_gdb "next\n"
|
403 |
|
|
gdb_expect {
|
404 |
|
|
-re "$gdb_prompt$" {}
|
405 |
|
|
timeout { fail "next to exit loop" }
|
406 |
|
|
}
|
407 |
|
|
|
408 |
|
|
send_gdb "next\n"
|
409 |
|
|
gdb_expect {
|
410 |
|
|
-re ".*$srcfile:49:.*$gdb_prompt$" {
|
411 |
|
|
pass "breakpoint ignore count"
|
412 |
|
|
}
|
413 |
|
|
-re ".*$gdb_prompt$" { fail "breakpoint ignore count" }
|
414 |
|
|
timeout { fail "breakpoint ignore count (timeout)" }
|
415 |
|
|
}
|
416 |
|
|
|
417 |
|
|
#
|
418 |
|
|
# Send a signal that is not handled; test:
|
419 |
|
|
# annotate-signalled
|
420 |
|
|
# annotate-signal-name
|
421 |
|
|
# annotate-signal-name-end
|
422 |
|
|
# annotate-signal-string
|
423 |
|
|
# annotate-signal-string-end
|
424 |
|
|
# FIXME: annotate-signal not tested (requires that the inferior be
|
425 |
|
|
# stopped by a "random" signal)
|
426 |
|
|
#
|
427 |
|
|
send_gdb "signal SIGTRAP\n"
|
428 |
|
|
gdb_expect {
|
429 |
|
|
-re ".*\032\032post-prompt\r\nContinuing with signal SIGTRAP.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032signalled\r\n\r\nProgram terminated with signal \r\n\032\032signal-name\r\nSIGTRAP\r\n\032\032signal-name-end\r\n, \r\n\032\032signal-string\r\nTrace.breakpoint trap\r\n\032\032signal-string-end\r\n.\r\nThe program no longer exists.\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \
|
430 |
|
|
{ pass "signal sent" }
|
431 |
|
|
-re ".*$gdb_prompt$" { fail "signal sent" }
|
432 |
|
|
timeout { fail "signal sent (timeout)" }
|
433 |
|
|
}
|
434 |
|
|
|
435 |
|
|
|
436 |
|
|
# Check for production of a core file
|
437 |
|
|
# and remove it!
|
438 |
|
|
|
439 |
|
|
set exec_output [remote_exec build "ls core"]
|
440 |
|
|
|
441 |
|
|
if [ regexp "core not found" $exec_output] {
|
442 |
|
|
pass "No core dumped"
|
443 |
|
|
} else {
|
444 |
|
|
if [ regexp "No such file or directory" $exec_output] {
|
445 |
|
|
pass "No core dumped"
|
446 |
|
|
} else {
|
447 |
|
|
remote_exec build "rm -f core"
|
448 |
|
|
pass "Core dumped and removed"
|
449 |
|
|
}
|
450 |
|
|
}
|
451 |
|
|
|
452 |
|
|
# restore the original prompt for the rest of the testsuite
|
453 |
|
|
|
454 |
|
|
set gdb_prompt $old_gdb_prompt
|