Commit | Line | Data |
---|---|---|
8c8f4ebe | 1 | # Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software |
b475183b | 2 | # Foundation, Inc. |
a4cb37cb SS |
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 | ||
a4cb37cb SS |
18 | # This file was written by Elena Zannoni (ezannoni@cygnus.com) |
19 | ||
20 | if $tracelevel then { | |
21 | strace $tracelevel | |
22 | } | |
23 | ||
24 | ||
fc33412a DT |
25 | # are we on a target board? If so, don't run these tests. |
26 | # note: this is necessary because we cannot use runto_main (which would | |
27 | # work for remote targets too) because of the different prompt we get | |
28 | # when using annotation level 2. | |
29 | # | |
676a0442 | 30 | if [is_remote target] then { |
fc33412a DT |
31 | return 0 |
32 | } | |
33 | ||
34 | ||
a4cb37cb SS |
35 | # |
36 | # test running programs | |
37 | # | |
38 | set prms_id 0 | |
39 | set bug_id 0 | |
40 | ||
41 | set testfile "annota1" | |
42 | set srcfile ${testfile}.c | |
43 | set binfile ${objdir}/${subdir}/${testfile} | |
44 | ||
fc91c6c2 | 45 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } { |
b60f0898 JB |
46 | untested annota1.exp |
47 | return -1 | |
a4cb37cb SS |
48 | } |
49 | ||
50 | ||
a4cb37cb SS |
51 | gdb_exit |
52 | gdb_start | |
53 | gdb_reinitialize_dir $srcdir/$subdir | |
54 | gdb_load ${binfile} | |
55 | ||
56 | if [target_info exists gdb_stub] { | |
57 | gdb_step_for_stub; | |
58 | } | |
59 | ||
60 | # | |
61 | # the line at which break main will put the breakpoint | |
62 | # | |
085dd6e6 | 63 | set main_line 32 |
a4cb37cb SS |
64 | |
65 | # The commands we test here produce many lines of output; disable "press | |
66 | # <return> to continue" prompts. | |
67 | send_gdb "set height 0\n" | |
68 | gdb_expect -re "$gdb_prompt $" | |
69 | ||
70 | # | |
71 | # break at main | |
72 | # | |
73 | gdb_test "break main" \ | |
74 | "Breakpoint.*at.* file .*$srcfile, line.*" \ | |
75 | "breakpoint main" | |
76 | ||
77 | ||
78 | # | |
79 | # NOTE: this prompt is OK only when the annotation level is > 1 | |
80 | # NOTE: When this prompt is in use the gdb_test procedure cannot be used because | |
81 | # it assumes that the last char after the gdb_prompt is a white space. This is not | |
82 | # true with this annotated prompt. So we must use send_gdb and gdb_expect. | |
83 | # | |
84 | ||
85 | set old_gdb_prompt $gdb_prompt | |
86 | set gdb_prompt "\r\n\032\032pre-prompt\r\n$gdb_prompt \r\n\032\032prompt\r\n" | |
87 | ||
d99968dc EZ |
88 | # |
89 | # Escape all the characters in the path that need it. For instance | |
90 | # the directory name could contain '+'. | |
91 | # | |
92 | set escapedsrcfile [string_to_regexp ${srcdir}/${subdir}/${srcfile}] | |
a4cb37cb SS |
93 | |
94 | ||
95 | # | |
96 | # set the annotation level to 2 | |
97 | # | |
98 | # of course, this will test: | |
99 | # annotate-pre-prompt | |
100 | # annotate-prompt | |
101 | # annotate-post-prompt (in the next block) | |
102 | # | |
103 | send_gdb "set annotate 2\n" | |
104 | gdb_expect { | |
105 | -re "set annotate 2\r\n$gdb_prompt$" { pass "annotation set at level 2" } | |
106 | -re ".*$gdb_prompt$" { fail "annotation set at level 2" } | |
107 | timeout { fail "annotation set at level 2 (timeout)" } | |
108 | } | |
109 | ||
110 | ||
111 | # | |
112 | # info break will test: | |
113 | # annotate-breakpoints-headers | |
114 | # annotate-field | |
115 | # annotate-breakpoints-table | |
116 | # annotate-record | |
117 | # annotate-breakpoints-table-end | |
118 | # | |
119 | send_gdb "info break\n" | |
120 | gdb_expect { | |
d99968dc | 121 | -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 ${escapedsrcfile}:$main_line\r\n\r\n\032\032breakpoints-table-end\r\n$gdb_prompt$" \ |
a4cb37cb | 122 | {pass "breakpoint info"} |
d99968dc EZ |
123 | -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 .*${srcfile}:$main_line\r\n\r\n\032\032breakpoints-table-end\r\n$gdb_prompt$" \ |
124 | { setup_xfail "*-*-*" 1270 | |
125 | fail "breakpoint info"} | |
a4cb37cb SS |
126 | -re ".*$gdb_prompt$" { fail "breakpoint info" } |
127 | timeout { fail "breakpoint info (timeout)" } | |
128 | } | |
129 | ||
130 | ||
131 | # | |
132 | # run to a break point will test: | |
133 | # annotate-frames-invalid | |
134 | # annotate-breakpoints-invalid (a.k.a. breakpoints-changed) | |
135 | # annotate-starting | |
136 | # annotate-breakpoint | |
137 | # annotate-frame-begin | |
138 | # annotate-frame-function-name | |
139 | # annotate-frame-args | |
140 | # annotate-frame-source-begin | |
141 | # annotate-frame-source-file | |
142 | # annotate-frame-source-file-end | |
143 | # annotate-frame-source-line | |
144 | # annotate-frame-source-end | |
145 | # annotate-source | |
146 | # annotate-frame-end | |
147 | # annotate-stopped | |
148 | # | |
392a587b | 149 | #exp_internal 1 |
8c008720 | 150 | set binexp [string_to_regexp $binfile] |
a4cb37cb | 151 | send_gdb "run\n" |
7346e70f | 152 | gdb_expect { |
8c008720 | 153 | -re "\r\n\032\032post-prompt\r\nStarting program: $binexp \(\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$" { |
7346e70f MS |
154 | pass "run until main breakpoint" |
155 | } | |
156 | -re ".*$gdb_prompt$" { | |
157 | fail "run until main breakpoint" | |
158 | } | |
159 | timeout { | |
160 | fail "run until main breakpoint (timeout)" | |
161 | } | |
a4cb37cb | 162 | } |
392a587b JM |
163 | #exp_internal 0 |
164 | #exit 0 | |
a4cb37cb SS |
165 | |
166 | # | |
167 | # Let's do a next, to get to a point where the array is initialized | |
168 | # We don't care about the annotated output for this operation, it is the same as | |
169 | # the one produced by run above | |
170 | # | |
171 | send_gdb "next\n" | |
172 | gdb_expect { | |
173 | -re ".*$gdb_prompt$" { pass "go after array init line" } | |
174 | timeout { fail "go after array init line (timeout)" } | |
175 | } | |
176 | ||
177 | ||
178 | # | |
179 | # printing the array will test: | |
180 | # annotate-value-history-begin | |
181 | # annotate-value-history-value | |
182 | # annotate-array-section-begin | |
183 | # annotate-elt | |
184 | # FIXME: annotate-elt-rep and annotate-elt-rep-end not tested | |
185 | # annotate-array-section-end | |
186 | # annotate-value-history-end | |
187 | # FIXME: annotate-value-begin and annotate-value-end not tested (the gdb output | |
188 | # command would cause them to be used) | |
189 | # | |
190 | send_gdb "print my_array\n" | |
191 | gdb_expect { | |
192 | -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$" \ | |
193 | { pass "print array" } | |
194 | -re ".*$gdb_prompt$" { fail "print array" } | |
195 | timeout { fail "print array (timeout)" } | |
196 | } | |
197 | ||
198 | ||
199 | # | |
200 | # this should generate an error message, so to test: | |
201 | # annotate-error-begin | |
202 | # FIXME: annotate-error not tested | |
203 | # | |
204 | ||
205 | #exp_internal 1 | |
206 | send_gdb "print non_existent_value\n" | |
207 | gdb_expect { | |
208 | -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$" \ | |
209 | { pass "print non_existent_value" } | |
210 | -re ".*$gdb_prompt$" { fail "print non_existent_value" } | |
211 | timeout { fail "print non_existent_value (timeout)" } | |
212 | } | |
213 | ||
214 | ||
215 | # | |
216 | # break at signal handler. So that, once we are in the sig handler, if we do a bt | |
217 | # we can test annotate-signal-handler-caller | |
218 | # | |
219 | send_gdb "break handle_USR1\n" | |
220 | gdb_expect { | |
221 | -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\nBreakpoint.*at $hex: file.*$srcfile, line.*\r\n$gdb_prompt$" \ | |
222 | { pass "breakpoint handle_USR1" } | |
223 | -re ".*$gdb_prompt$" { fail "break at handle_USR1" } | |
224 | timeout { fail "break at handle_USR1 (timeout)" } | |
225 | } | |
226 | ||
227 | # | |
228 | # break at printf. When we are stopped at printf, we can test | |
229 | # | |
230 | send_gdb "break printf\n" | |
231 | gdb_expect { | |
232 | -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\nBreakpoint.*at $hex.*$gdb_prompt$" \ | |
233 | { pass "breakpoint printf" } | |
8c8f4ebe PG |
234 | -re "\r\n\032\032post-prompt\r\nwarning: Breakpoint address adjusted from $hex to $hex.\r\n\r\n\032\032breakpoints-invalid\r\nBreakpoint.*at $hex.*$gdb_prompt$" \ |
235 | { pass "breakpoint printf"} | |
a4cb37cb SS |
236 | -re ".*$gdb_prompt$" { fail "break printf" } |
237 | timeout { fail "break printf (timeout)" } | |
238 | } | |
239 | ||
240 | # | |
241 | # get to printf | |
242 | # | |
243 | send_gdb "continue\n" | |
244 | gdb_expect { | |
a0b3c4fd | 245 | -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$" \ |
a4cb37cb | 246 | { pass "continue to printf" } |
8c8f4ebe PG |
247 | -re "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\nwarning: Breakpoint 3 address previously adjusted from $hex to $hex.\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\n.printf\r\n\032\032frame-args\r\n.*\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \ |
248 | { pass "continue to printf" } | |
249 | ||
a4cb37cb SS |
250 | -re ".*$gdb_prompt$" { fail "continue to printf" } |
251 | timeout { fail "continue to printf (timeout)" } | |
252 | } | |
253 | ||
254 | # | |
255 | # test: | |
256 | # annotate-frame-where | |
257 | # annotate-frame-address | |
258 | # annotate-frame-address-end | |
259 | # | |
260 | send_gdb "backtrace\n" | |
261 | gdb_expect { | |
d99968dc | 262 | -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${escapedsrcfile}\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(\r\n\032\032frame-begin .*\r\n\r\n\032\032frame-end\r\n)*$gdb_prompt$" \ |
7148ab62 | 263 | { pass "backtrace from shlibrary" } |
d99968dc EZ |
264 | -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.*${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(\r\n\032\032frame-begin .*\r\n\r\n\032\032frame-end\r\n)*$gdb_prompt$" \ |
265 | { setup_xfail "*-*-*" 1270 | |
266 | fail "backtrace from shlibrary" } | |
a4cb37cb SS |
267 | -re ".*$gdb_prompt$" { fail "backtrace from shlibrary" } |
268 | timeout { fail "backtrace from shlibrary (timeout)" } | |
269 | } | |
270 | ||
271 | ||
272 | # | |
273 | # test printing a frame with some arguments: | |
274 | # annotate-arg-begin | |
275 | # annotate-arg-name-end | |
276 | # annotate-arg-value | |
277 | # annotate-arg-end | |
278 | # | |
a4cb37cb | 279 | |
ab618a02 MC |
280 | if [target_info exists gdb,nosignals] { |
281 | unsupported "send SIGUSR1" | |
282 | unsupported "backtrace @ signal handler" | |
283 | } else { | |
284 | send_gdb "signal SIGUSR1\n" | |
285 | gdb_expect { | |
286 | -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${escapedsrcfile}\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$" \ | |
287 | { pass "send SIGUSR1" } | |
288 | -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.*${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$" \ | |
289 | { setup_xfail "*-*-*" 1270 | |
290 | fail "send SIGUSR1" } | |
291 | -re ".*$gdb_prompt$" { fail "send SIGUSR1" } | |
292 | timeout { fail "send SIGUSR1 (timeout)" } | |
293 | } | |
a4cb37cb | 294 | |
ab618a02 MC |
295 | # |
296 | # test: | |
297 | # annotate-signal-handler-caller | |
298 | # | |
299 | verbose "match_max local is: [match_max]" | |
300 | verbose "match_max default is: [match_max -d]" | |
301 | # This is necessary because a 2000 buffer is not enought to get everything | |
302 | # up to the prompt ad the test gets a timeout. | |
303 | match_max 3000 | |
304 | verbose "match_max now is: [match_max]" | |
305 | send_gdb "backtrace\n" | |
306 | gdb_expect { | |
307 | -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$" { | |
308 | pass "backtrace @ signal handler" | |
309 | } | |
310 | -re ".*$gdb_prompt$" { fail "backtrace @ signal handler" } | |
311 | timeout { fail "backtrace @ signal handler (timeout)" } | |
0a791409 | 312 | } |
a4cb37cb SS |
313 | } |
314 | ||
315 | # | |
316 | # delete all the breakpoints | |
317 | # | |
318 | send_gdb "delete 1\n" | |
319 | gdb_expect { | |
320 | -re "\r\n\032\032post-prompt\r\n$gdb_prompt$" \ | |
321 | { pass "delete bp 1" } | |
322 | -re ".*$gdb_prompt$" { fail "delete bp 1" } | |
323 | timeout { fail "delete bp 1 (timeout)" } | |
324 | } | |
325 | ||
326 | send_gdb "delete 2\n" | |
327 | gdb_expect { | |
328 | -re "\r\n\032\032post-prompt\r\n$gdb_prompt$" \ | |
329 | { pass "delete bp 2" } | |
330 | -re ".*$gdb_prompt$" { fail "delete bp 2 " } | |
331 | timeout { fail "delete bp 2 (timeout)" } | |
332 | } | |
333 | ||
334 | send_gdb "delete 3\n" | |
335 | gdb_expect { | |
336 | -re "\r\n\032\032post-prompt\r\n$gdb_prompt$" \ | |
337 | { pass "delete bp 3" } | |
338 | -re ".*$gdb_prompt$" { fail "delete bp 3" } | |
339 | timeout { fail "delete bp 3 (timeout)" } | |
340 | } | |
341 | ||
342 | # | |
343 | # break at main, after value is initialized. This is in preparation | |
344 | # to test the annotate output for the display command. | |
345 | # | |
346 | send_gdb "break main\n" | |
347 | gdb_expect { | |
d99968dc | 348 | -re "post-prompt.*\032\032breakpoints-invalid.*Breakpoint 4 at $hex: file ${escapedsrcfile}, line $main_line.*$gdb_prompt$" \ |
a4cb37cb | 349 | { pass "break at 28" } |
d99968dc EZ |
350 | -re "post-prompt.*\032\032breakpoints-invalid.*Breakpoint 4 at $hex: file .*${srcfile}, line $main_line.*$gdb_prompt$" \ |
351 | { setup_xfail "*-*-*" 1270 | |
352 | fail "break at 28" } | |
a4cb37cb SS |
353 | -re ".*$gdb_prompt$" { fail "break at 28" } |
354 | timeout { fail "break at 28 (timeout)" } | |
355 | } | |
356 | ||
357 | # | |
358 | # display the value; test: | |
359 | # annotate-display-begin | |
360 | # annotate-display-number-end | |
361 | # annotate-display-format | |
362 | # annotate-display-expression | |
363 | # annotate-display-expression-end | |
364 | # annotate-display-end | |
365 | # FIXME: annotate-display-value not tested | |
366 | # | |
367 | send_gdb "display value\n" | |
368 | gdb_expect { | |
369 | -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$" \ | |
370 | { pass "set up display" } | |
371 | -re ".*$gdb_prompt$" { fail "set up display" } | |
372 | timeout { fail "set up display (timeout)" } | |
373 | } | |
374 | ||
375 | ||
376 | # should ask query. Test annotate-query. | |
377 | # we don't care about anything else here, only the query. | |
378 | ||
379 | send_gdb "run\n" | |
380 | gdb_expect { | |
381 | -re "pre-query.*already.*\\(y or n\\).*query\r\n" { | |
382 | send_gdb "y\n" | |
383 | gdb_expect { | |
384 | -re ".*post-query.*$gdb_prompt$" \ | |
385 | { pass "re-run" } | |
386 | -re ".*$gdb_prompt$" { fail "re-run" } | |
387 | timeout { fail "re-run (timeout)" } | |
388 | } | |
389 | } | |
390 | -re ".*$gdb_prompt$" { fail "re-run" } | |
391 | timeout { fail "re-run (timeout)" } | |
392 | } | |
393 | ||
5c44784c JM |
394 | # |
395 | # Test that breakpoints-invalid is issued once and only once for | |
396 | # breakpoint ignore count changes, after annotation stopped. | |
397 | # | |
398 | send_gdb "break 46\n" | |
399 | gdb_expect { | |
400 | -re "Breakpoint 5 at $hex: file .*$srcfile, line 46.*$gdb_prompt$" { | |
401 | pass "break at 46" | |
402 | } | |
403 | -re ".*$gdb_prompt$" { fail "break at 46" } | |
404 | timeout { fail "break at 46 (timeout)" } | |
405 | } | |
406 | ||
407 | send_gdb "ignore 5 4\n" | |
408 | gdb_expect { | |
409 | -re "Will ignore next 4 crossings of breakpoint 5.*$gdb_prompt$" { | |
410 | pass "ignore 5 4" | |
411 | } | |
412 | -re ".*$gdb_prompt$" { fail "ignore 5 4" } | |
413 | timeout { fail "ignore 5 4 (timeout)" } | |
414 | } | |
415 | ||
416 | send_gdb "continue\n" | |
417 | gdb_expect { | |
418 | -re ".*$srcfile:46:.*\032\032stopped\r\n\r\n\032\032breakpoints-invalid\r\n$gdb_prompt$" { | |
419 | pass "annotate ignore count change" | |
420 | } | |
421 | -re ".*$gdb_prompt$" { fail "annotate ignore count change" } | |
422 | timeout { fail "annotate ignore count change (timeout)" } | |
423 | } | |
424 | ||
425 | # check that ignore command is working, or the above can provide | |
426 | # misleading assurance ... | |
427 | ||
428 | send_gdb "next\n" | |
429 | gdb_expect { | |
430 | -re "$gdb_prompt$" {} | |
431 | timeout { fail "next to exit loop" } | |
432 | } | |
433 | ||
434 | send_gdb "next\n" | |
435 | gdb_expect { | |
436 | -re ".*$srcfile:49:.*$gdb_prompt$" { | |
437 | pass "breakpoint ignore count" | |
438 | } | |
439 | -re ".*$gdb_prompt$" { fail "breakpoint ignore count" } | |
440 | timeout { fail "breakpoint ignore count (timeout)" } | |
441 | } | |
a4cb37cb SS |
442 | |
443 | # | |
444 | # Send a signal that is not handled; test: | |
445 | # annotate-signalled | |
446 | # annotate-signal-name | |
447 | # annotate-signal-name-end | |
448 | # annotate-signal-string | |
449 | # annotate-signal-string-end | |
450 | # FIXME: annotate-signal not tested (requires that the inferior be | |
451 | # stopped by a "random" signal) | |
452 | # | |
8fb87725 JL |
453 | # SIGTRAP signals are dropped before they get to the inferior process |
454 | # on hpux11. In theory, this behaivor can be controlled by setting | |
455 | # TTEO_NORM_SIGTRAP in the inferior, but doing so did not cause | |
456 | # the signal to be properly delivered. | |
457 | # | |
458 | # It has been verified that other signals will be delivered. However, | |
459 | # rather than twiddle the test, I choose to leave it as-is as it | |
460 | # exposes an interesting failure on hpux11. | |
ab618a02 MC |
461 | |
462 | if [target_info exists gdb,nosignals] { | |
463 | unsupported "signal sent" | |
464 | } else { | |
465 | setup_xfail hppa*-*-hpux11* | |
466 | send_gdb "signal SIGTRAP\n" | |
467 | gdb_expect { | |
468 | -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$" \ | |
469 | { pass "signal sent" } | |
470 | -re ".*$gdb_prompt$" { fail "signal sent" } | |
471 | timeout { fail "signal sent (timeout)" } | |
472 | } | |
a4cb37cb SS |
473 | } |
474 | ||
475 | ||
419e626b | 476 | # Check for production of a core file and remove it! |
a4cb37cb SS |
477 | |
478 | set exec_output [remote_exec build "ls core"] | |
479 | ||
419e626b | 480 | set test "cleanup core file" |
a4cb37cb | 481 | if [ regexp "core not found" $exec_output] { |
419e626b | 482 | pass "$test (not dumped)" |
a4cb37cb | 483 | } else { |
419e626b AC |
484 | if [ regexp "No such file or directory" $exec_output] { |
485 | pass "$test (not dumped)" | |
486 | } else { | |
487 | remote_exec build "rm -f core" | |
488 | pass "$test (removed)" | |
489 | } | |
a4cb37cb SS |
490 | } |
491 | ||
a4cb37cb SS |
492 | # restore the original prompt for the rest of the testsuite |
493 | ||
494 | set gdb_prompt $old_gdb_prompt |