Commit | Line | Data |
---|---|---|
4c38e0a4 | 1 | # Copyright 2009, 2010 Free Software Foundation, Inc. |
b43b923a MS |
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 <http://www.gnu.org/licenses/>. | |
15 | ||
16 | if [target_info exists gdb,nosignals] { | |
17 | verbose "Skipping sigall-reverse.exp because of nosignals." | |
18 | return | |
19 | } | |
20 | ||
21 | if ![target_info exists gdb,can_reverse] { | |
22 | return | |
23 | } | |
24 | ||
25 | if $tracelevel then { | |
26 | strace $tracelevel | |
27 | } | |
28 | ||
b43b923a MS |
29 | |
30 | gdb_exit | |
31 | gdb_start | |
32 | gdb_reinitialize_dir $srcdir/$subdir | |
33 | ||
34 | set testfile sigall-reverse | |
35 | set srcfile ${testfile}.c | |
36 | set binfile ${objdir}/${subdir}/${testfile} | |
37 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { | |
38 | untested sigall.exp | |
39 | return -1 | |
40 | } | |
41 | ||
42 | # Make the first signal SIGABRT because it is always supported. | |
43 | set sig_supported 1 | |
44 | set thissig "ABRT" | |
45 | ||
46 | proc test_one_sig {nextsig} { | |
47 | global sig_supported | |
48 | global gdb_prompt | |
49 | global thissig | |
50 | ||
51 | set this_sig_supported $sig_supported | |
52 | gdb_test "handle SIG$thissig stop print" \ | |
53 | "SIG$thissig\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*" | |
54 | gdb_test "b handle_$thissig" "Breakpoint \[0-9\]+ .*" | |
55 | gdb_test "b gen_$nextsig" "Breakpoint \[0-9\]+ .*" | |
56 | ||
57 | set need_another_continue 1 | |
58 | set missed_handler 0 | |
59 | if $this_sig_supported then { | |
60 | if { $thissig == "IO" } { | |
61 | setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu" | |
62 | } | |
63 | set testmsg "get signal $thissig" | |
64 | gdb_test_multiple "continue" $testmsg { | |
65 | -re "Program received signal SIG$thissig.*handle_$thissig.*$gdb_prompt $" { | |
66 | fail "$testmsg (wrong location)" | |
67 | } | |
68 | -re "Program received signal SIG$thissig.*$gdb_prompt $" { | |
69 | pass $testmsg | |
70 | } | |
71 | -re "Breakpoint.* handle_$thissig.*$gdb_prompt $" { | |
72 | xfail $testmsg | |
73 | set need_another_continue 0 | |
74 | } | |
75 | } | |
76 | } | |
77 | if [ istarget "alpha-dec-osf3*" ] then { | |
78 | # OSF/1-3.x is unable to continue with a job control stop signal. | |
79 | # The inferior remains stopped without an event of interest | |
80 | # and GDB waits forever for the inferior to stop on an event | |
81 | # of interest. Work around the kernel bug. | |
82 | if { $thissig == "TSTP" || $thissig == "TTIN" || $thissig == "TTOU" } { | |
83 | setup_xfail "alpha-dec-osf3*" | |
84 | fail "cannot continue from signal $thissig" | |
85 | set need_another_continue 0 | |
86 | } | |
87 | } | |
88 | ||
89 | if $need_another_continue then { | |
90 | if { $thissig == "URG" } { | |
91 | setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu" | |
92 | } | |
93 | # Either Lynx or GDB screws up on SIGPRIO | |
94 | if { $thissig == "PRIO" } { | |
95 | setup_xfail "*-*-*lynx*" | |
96 | } | |
97 | set testmsg "send signal $thissig" | |
98 | gdb_test_multiple "continue" $testmsg { | |
99 | -re "Breakpoint.*handle_$thissig.*$gdb_prompt $" { | |
100 | pass $testmsg | |
101 | } | |
102 | -re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" { | |
103 | fail "missed breakpoint at handle_$thissig" | |
104 | set missed_handler 1 | |
105 | } | |
106 | } | |
107 | } | |
108 | ||
109 | if { $missed_handler == "0" } then { | |
110 | set testmsg "advance to $nextsig" | |
111 | gdb_test_multiple "signal 0" $testmsg { | |
112 | -re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" { | |
113 | pass $testmsg | |
114 | set sig_supported 1 | |
115 | } | |
116 | -re "Breakpoint.*gen_$nextsig.*handle.*$gdb_prompt $" { | |
117 | pass $testmsg | |
118 | set sig_supported 0 | |
119 | } | |
120 | } | |
121 | } | |
122 | set thissig $nextsig | |
123 | } | |
124 | ||
125 | proc test_one_sig_reverse {prevsig} { | |
126 | global gdb_prompt | |
127 | ||
128 | gdb_test "reverse-continue" "Breakpoint .* handle_$prevsig.*" \ | |
129 | "reverse to handler of $prevsig" | |
130 | ||
131 | set saw_signal 0 | |
132 | set testmsg "reverse to gen_$prevsig" | |
133 | gdb_test_multiple "reverse-continue" $testmsg { | |
134 | -re "Breakpoint.*handle_.*$gdb_prompt " { | |
135 | pass "$testmsg (un-handled)" | |
136 | } | |
137 | -re "Program received signal SIG$prevsig.*$gdb_prompt " { | |
138 | pass "reverse to signal event, $prevsig" | |
139 | ||
140 | set nested_testmsg "reverse signal delivered" | |
141 | gdb_test_multiple "frame" $nested_testmsg { | |
142 | -re ".*handle_$prevsig.*$gdb_prompt " { | |
143 | fail "$nested_testmsg (wrong location)" | |
144 | } | |
145 | -re ".*$gdb_prompt " { | |
146 | pass $nested_testmsg | |
147 | } | |
148 | } | |
149 | ||
150 | set saw_signal 1 | |
151 | send_gdb "reverse-continue\n" | |
152 | exp_continue | |
153 | } | |
154 | -re "Breakpoint.*kill.*$gdb_prompt " { | |
155 | if { $saw_signal } then { | |
156 | pass "$testmsg (handled)" | |
157 | } else { | |
158 | xfail "$testmsg (handled)" | |
159 | } | |
160 | } | |
161 | -re "No more reverse-execution history.*kill.*$gdb_prompt " { | |
162 | if { $saw_signal } then { | |
163 | pass "$testmsg (handled)" | |
164 | } else { | |
165 | xfail "$testmsg (handled)" | |
166 | } | |
167 | } | |
168 | } | |
169 | } | |
170 | ||
171 | gdb_load $binfile | |
172 | ||
173 | runto gen_ABRT | |
174 | ||
175 | if [target_info exists gdb,use_precord] { | |
176 | # Activate process record/replay | |
bcd2dc50 | 177 | gdb_test_no_output "record" "Turn on process record" |
b43b923a MS |
178 | } |
179 | ||
180 | test_one_sig HUP | |
181 | test_one_sig QUIT | |
182 | test_one_sig ILL | |
183 | test_one_sig EMT | |
184 | test_one_sig FPE | |
185 | test_one_sig BUS | |
186 | test_one_sig SEGV | |
187 | test_one_sig SYS | |
188 | test_one_sig PIPE | |
189 | test_one_sig ALRM | |
190 | test_one_sig URG | |
191 | test_one_sig TSTP | |
192 | test_one_sig CONT | |
193 | test_one_sig CHLD | |
194 | test_one_sig TTIN | |
195 | test_one_sig TTOU | |
196 | test_one_sig IO | |
197 | test_one_sig XCPU | |
198 | test_one_sig XFSZ | |
199 | test_one_sig VTALRM | |
200 | test_one_sig PROF | |
201 | test_one_sig WINCH | |
202 | test_one_sig LOST | |
203 | test_one_sig USR1 | |
204 | test_one_sig USR2 | |
205 | test_one_sig PWR | |
206 | test_one_sig POLL | |
207 | test_one_sig WIND | |
208 | test_one_sig PHONE | |
209 | test_one_sig WAITING | |
210 | test_one_sig LWP | |
211 | test_one_sig DANGER | |
212 | test_one_sig GRANT | |
213 | test_one_sig RETRACT | |
214 | test_one_sig MSG | |
215 | test_one_sig SOUND | |
216 | test_one_sig SAK | |
217 | test_one_sig PRIO | |
218 | test_one_sig 33 | |
219 | test_one_sig 34 | |
220 | test_one_sig 35 | |
221 | test_one_sig 36 | |
222 | test_one_sig 37 | |
223 | test_one_sig 38 | |
224 | test_one_sig 39 | |
225 | test_one_sig 40 | |
226 | test_one_sig 41 | |
227 | test_one_sig 42 | |
228 | test_one_sig 43 | |
229 | test_one_sig 44 | |
230 | test_one_sig 45 | |
231 | test_one_sig 46 | |
232 | test_one_sig 47 | |
233 | test_one_sig 48 | |
234 | test_one_sig 49 | |
235 | test_one_sig 50 | |
236 | test_one_sig 51 | |
237 | test_one_sig 52 | |
238 | test_one_sig 53 | |
239 | test_one_sig 54 | |
240 | test_one_sig 55 | |
241 | test_one_sig 56 | |
242 | test_one_sig 57 | |
243 | test_one_sig 58 | |
244 | test_one_sig 59 | |
245 | test_one_sig 60 | |
246 | test_one_sig 61 | |
247 | test_one_sig 62 | |
248 | test_one_sig 63 | |
249 | test_one_sig TERM | |
250 | ||
251 | # The last signal (SIGTERM) gets handled slightly differently because | |
252 | # we are not setting up for another test. | |
253 | gdb_test "handle SIGTERM stop print" \ | |
254 | "SIGTERM\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*" | |
255 | gdb_test "b handle_TERM" "Breakpoint \[0-9\]+ .*" | |
256 | gdb_test "continue" \ | |
257 | "Continuing.*Program received signal SIGTERM.*" \ | |
258 | "get signal TERM" | |
259 | gdb_test "continue" "Breakpoint.*handle_TERM.*" "send signal TERM" | |
260 | ||
e6a386cd | 261 | gdb_test "continue" "\[process \[0-9\]+ .*" "continue to sigal exit" \ |
4cf866a3 MS |
262 | "The next instruction is syscall exit_group.* program...y. or n. " \ |
263 | "yes" | |
b43b923a MS |
264 | |
265 | test_one_sig_reverse TERM | |
266 | test_one_sig_reverse 63 | |
267 | test_one_sig_reverse 62 | |
268 | test_one_sig_reverse 61 | |
269 | test_one_sig_reverse 60 | |
270 | test_one_sig_reverse 59 | |
271 | test_one_sig_reverse 58 | |
272 | test_one_sig_reverse 57 | |
273 | test_one_sig_reverse 56 | |
274 | test_one_sig_reverse 55 | |
275 | test_one_sig_reverse 54 | |
276 | test_one_sig_reverse 53 | |
277 | test_one_sig_reverse 52 | |
278 | test_one_sig_reverse 51 | |
279 | test_one_sig_reverse 50 | |
280 | test_one_sig_reverse 49 | |
281 | test_one_sig_reverse 48 | |
282 | test_one_sig_reverse 47 | |
283 | test_one_sig_reverse 46 | |
284 | test_one_sig_reverse 45 | |
285 | test_one_sig_reverse 44 | |
286 | test_one_sig_reverse 43 | |
287 | test_one_sig_reverse 42 | |
288 | test_one_sig_reverse 41 | |
289 | test_one_sig_reverse 40 | |
290 | test_one_sig_reverse 39 | |
291 | test_one_sig_reverse 38 | |
292 | test_one_sig_reverse 37 | |
293 | test_one_sig_reverse 36 | |
294 | test_one_sig_reverse 35 | |
295 | test_one_sig_reverse 34 | |
296 | test_one_sig_reverse 33 | |
297 | test_one_sig_reverse PRIO | |
298 | test_one_sig_reverse SAK | |
299 | test_one_sig_reverse SOUND | |
300 | test_one_sig_reverse MSG | |
301 | test_one_sig_reverse RETRACT | |
302 | test_one_sig_reverse GRANT | |
303 | test_one_sig_reverse DANGER | |
304 | test_one_sig_reverse LWP | |
305 | test_one_sig_reverse WAITING | |
306 | test_one_sig_reverse PHONE | |
307 | test_one_sig_reverse WIND | |
308 | test_one_sig_reverse POLL | |
309 | test_one_sig_reverse PWR | |
310 | test_one_sig_reverse USR2 | |
311 | test_one_sig_reverse USR1 | |
312 | test_one_sig_reverse LOST | |
313 | test_one_sig_reverse WINCH | |
314 | test_one_sig_reverse PROF | |
315 | test_one_sig_reverse VTALRM | |
316 | test_one_sig_reverse XFSZ | |
317 | test_one_sig_reverse XCPU | |
318 | test_one_sig_reverse IO | |
319 | test_one_sig_reverse TTOU | |
320 | test_one_sig_reverse TTIN | |
321 | test_one_sig_reverse CHLD | |
322 | test_one_sig_reverse CONT | |
323 | test_one_sig_reverse TSTP | |
324 | test_one_sig_reverse URG | |
325 | test_one_sig_reverse ALRM | |
326 | test_one_sig_reverse PIPE | |
327 | test_one_sig_reverse SYS | |
328 | test_one_sig_reverse SEGV | |
329 | test_one_sig_reverse BUS | |
330 | test_one_sig_reverse FPE | |
331 | test_one_sig_reverse EMT | |
332 | test_one_sig_reverse ILL | |
333 | test_one_sig_reverse QUIT | |
334 | test_one_sig_reverse HUP | |
335 | test_one_sig_reverse ABRT | |
336 | ||
337 | # Make the first signal SIGABRT because it is always supported. | |
338 | set sig_supported 1 | |
339 | set thissig "ABRT" | |
340 | ||
341 | test_one_sig HUP | |
342 | test_one_sig QUIT | |
343 | test_one_sig ILL | |
344 | test_one_sig EMT | |
345 | test_one_sig FPE | |
346 | test_one_sig BUS | |
347 | test_one_sig SEGV | |
348 | test_one_sig SYS | |
349 | test_one_sig PIPE | |
350 | test_one_sig ALRM | |
351 | test_one_sig URG | |
352 | test_one_sig TSTP | |
353 | test_one_sig CONT | |
354 | test_one_sig CHLD | |
355 | test_one_sig TTIN | |
356 | test_one_sig TTOU | |
357 | test_one_sig IO | |
358 | test_one_sig XCPU | |
359 | test_one_sig XFSZ | |
360 | test_one_sig VTALRM | |
361 | test_one_sig PROF | |
362 | test_one_sig WINCH | |
363 | test_one_sig LOST | |
364 | test_one_sig USR1 | |
365 | test_one_sig USR2 | |
366 | test_one_sig PWR | |
367 | test_one_sig POLL | |
368 | test_one_sig WIND | |
369 | test_one_sig PHONE | |
370 | test_one_sig WAITING | |
371 | test_one_sig LWP | |
372 | test_one_sig DANGER | |
373 | test_one_sig GRANT | |
374 | test_one_sig RETRACT | |
375 | test_one_sig MSG | |
376 | test_one_sig SOUND | |
377 | test_one_sig SAK | |
378 | test_one_sig PRIO | |
379 | test_one_sig 33 | |
380 | test_one_sig 34 | |
381 | test_one_sig 35 | |
382 | test_one_sig 36 | |
383 | test_one_sig 37 | |
384 | test_one_sig 38 | |
385 | test_one_sig 39 | |
386 | test_one_sig 40 | |
387 | test_one_sig 41 | |
388 | test_one_sig 42 | |
389 | test_one_sig 43 | |
390 | test_one_sig 44 | |
391 | test_one_sig 45 | |
392 | test_one_sig 46 | |
393 | test_one_sig 47 | |
394 | test_one_sig 48 | |
395 | test_one_sig 49 | |
396 | test_one_sig 50 | |
397 | test_one_sig 51 | |
398 | test_one_sig 52 | |
399 | test_one_sig 53 | |
400 | test_one_sig 54 | |
401 | test_one_sig 55 | |
402 | test_one_sig 56 | |
403 | test_one_sig 57 | |
404 | test_one_sig 58 | |
405 | test_one_sig 59 | |
406 | test_one_sig 60 | |
407 | test_one_sig 61 | |
408 | test_one_sig 62 | |
409 | test_one_sig 63 | |
410 | test_one_sig TERM |