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