* gdb.base/a1-selftest.exp (do_steps_and_nexts): New routine to
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / signals.exp
1 if $nosignals {
2 verbose "Skipping signals.exp because of nosignals."
3 continue
4 }
5
6 if $tracelevel then {
7 strace $tracelevel
8 }
9
10 set prms_id 0
11 set bug_id 0
12
13 set testfile signals
14 set srcfile ${testfile}.c
15 set binfile ${objdir}/${subdir}/${testfile}
16 if { [compile "${srcdir}/${subdir}/${srcfile} -g -o ${binfile}"] != "" } {
17 perror "Couldn't compile ${srcfile}"
18 return -1
19 }
20
21 # Create and source the file that provides information about the compiler
22 # used to compile the test case.
23 execute_anywhere "rm -f ${binfile}.ci"
24 if { [compile "-E ${srcdir}/${subdir}/compiler.c > ${binfile}.ci"] != "" } {
25 perror "Couldn't make ${binfile}.ci file"
26 return -1
27 }
28 source ${binfile}.ci
29
30 proc signal_tests_1 {} {
31 global prompt
32 if [runto_main] then {
33 gdb_test "next" "signal \\(SIGUSR1.*" \
34 "next over signal (SIGALRM, handler)"
35 gdb_test "next" "alarm \\(.*" \
36 "next over signal (SIGUSR1, handler)"
37 gdb_test "next" "\\+\\+count; /\\* first \\*/" \
38 "next over alarm (1)"
39 # An alarm has been signaled, give the signal time to get delivered.
40 exec sleep 2
41
42 # i386 BSD currently fails the next test with a SIGTRAP.
43 setup_xfail "i*86-*-bsd*"
44 # But Dynix has a DECR_PC_AFTER_BREAK of zero, so the failure
45 # is shadowed by hitting the through_sigtramp_breakpoint.
46 clear_xfail "i*86-sequent-bsd*"
47 # Univel SVR4 i386 continues instead of stepping.
48 setup_xfail "i*86-univel-sysv4*"
49 # lynx fails with "next" acting like "continue"
50 setup_xfail "*-*-*lynx*"
51 # linux (aout versions) also fails with "next" acting like "continue"
52 # this is probably more dependant on the kernel version than on the
53 # object file format or utils. (sigh)
54 setup_xfail "i*86-*-linuxaout" "i*86-*-linuxoldld"
55 send "next\n"
56 expect {
57 -re "alarm .*$prompt $" { pass "next to 2nd alarm (1)" }
58 -re "Program received signal SIGTRAP.*first.*$prompt $" {
59
60 # This can happen on machines that have a trace flag
61 # in their PS register.
62 # The trace flag in the PS register will be set due to
63 # the `next' command.
64 # Before calling the signal handler, the PS register
65 # is pushed along with the context on the user stack.
66 # When the signal handler has finished, it reenters the
67 # the kernel via a sigreturn syscall, which restores the
68 # PS register along with the context.
69 # If the kernel erroneously does not clear the trace flag
70 # in the pushed context, gdb will receive a SIGTRAP from
71 # the set trace flag in the restored context after the
72 # signal handler has finished.
73
74 # I do not yet understand why the SIGTRAP does not occur
75 # after stepping the instruction at the restored PC on
76 # i386 BSDI 1.0 systems.
77
78 # Note that the vax under Ultrix also exhibits
79 # this behaviour (it is uncovered by the `continue from
80 # a break in a signal handler' test below).
81 # With this test the failure is shadowed by hitting the
82 # through_sigtramp_breakpoint upon return from the signal
83 # handler.
84
85 fail "next to 2nd alarm (1) (probably kernel bug)"
86 gdb_test "next" "alarm.*" "next to 2nd alarm (1)"
87 }
88 -re "Program exited with code.*$prompt $" {
89
90 # This is apparently a bug in the UnixWare kernel (but
91 # has not been investigated beyond the
92 # resume/target_wait level, and has not been reported
93 # to Univel). If it steps when a signal is pending,
94 # it does a continue instead. I don't know whether
95 # there is a workaround.
96
97 # Perhaps this problem exists on other SVR4 systems;
98 # but (a) we have no reason to think so, and (b) if we
99 # put a wrong xfail here, we never get an XPASS to let
100 # us know that it was incorrect (and then if such a
101 # configuration regresses we have no way of knowing).
102 # Solaris is not a relevant data point either way
103 # because it lacks single stepping.
104
105 # fnf: I don't agree with the above philosophy. We
106 # can never be sure that any particular XFAIL is
107 # specified 100% correctly in that no systems with
108 # the bug are missed and all systems without the bug
109 # are excluded. If we include an XFAIL that isn't
110 # appropriate for a particular system, then when that
111 # system gets tested it will XPASS, and someone should
112 # investigate and fix the setup_xfail as appropriate,
113 # or more preferably, the actual bug. Each such case
114 # adds more data to narrowing down the scope of the
115 # problem and ultimately fixing it.
116
117 setup_xfail "i*86-*-sysv4*"
118 fail "'next' behaved as 'continue (known SVR4 bug)'"
119 return 0
120 }
121 -re ".*$prompt $" { fail "next to 2nd alarm (1)" }
122 timeout { fail "next to 2nd alarm (1); (timeout)" }
123 eof { fail "next to 2nd alarm (1); (eof)" }
124 }
125
126 gdb_test "break handler" "Breakpoint \[0-9\]+ .*"
127 gdb_test "next" "\\+\\+count; /\\* second \\*/" \
128 "next to 2nd ++count in signals_tests_1"
129 # An alarm has been signaled, give the signal time to get delivered.
130 exec sleep 2
131
132 set bash_bug 0
133 send "next\n"
134 setup_xfail "i*86-*-linux"
135 expect {
136 -re "Breakpoint.*handler.*$prompt $" {
137 pass "next to handler in signals_tests_1"
138 }
139 -re "Program received signal SIGEMT.*$prompt $" {
140 # Bash versions before 1.13.5 cause this behaviour
141 # by blocking SIGTRAP.
142 fail "next to handler in signals_tests_1 (known problem with bash versions before 1.13.5)"
143 set bash_bug 1
144 gdb_test "signal 0" "Breakpoint.*handler.*"
145 }
146 -re ".*$prompt $" { fail "next to handler in signals_tests_1" }
147 timeout { fail "next to handler in signals_tests_1 (timeout)" }
148 eof { fail "next to handler in signals_tests_1 (eof)" }
149 }
150
151 # This doesn't test that main is frame #2, just that main is frame
152 # #2, #3, or higher. At some point this should be fixed (but
153 # it quite possibly would introduce new FAILs on some systems).
154 setup_xfail "i*86-*-linux" "i*86-*-bsdi2.0"
155 gdb_test "backtrace" "#0.*handler.*#1.*#2.*main.*" \
156 "backtrace in signals_tests_1"
157
158 gdb_test "break func1" "Breakpoint \[0-9\]+ .*"
159 gdb_test "break func2" "Breakpoint \[0-9\]+ .*"
160
161 # Vax Ultrix and i386 BSD currently fail the next test with
162 # a SIGTRAP, but with different symptoms.
163 setup_xfail "vax-*-ultrix*"
164 setup_xfail "i*86-*-bsd*"
165 setup_xfail "i*86-*-linux"
166 send "continue\n"
167 expect {
168 -re "Breakpoint.*func1.*$prompt $" { pass "continue to func1" }
169 -re "Program received signal SIGTRAP.*second.*$prompt $" {
170
171 # See explanation for `next to 2nd alarm (1)' fail above.
172 # We did step into the signal handler, hit a breakpoint
173 # in the handler and continued from the breakpoint.
174 # The set trace flag in the restored context is causing
175 # the SIGTRAP, without stepping an instruction.
176
177 fail "continue to func1 (probably kernel bug)"
178 gdb_test "continue" "Breakpoint.*func1.*" \
179 "extra continue to func1"
180 }
181 -re "Program received signal SIGTRAP.*func1 ..;.*$prompt $" {
182
183 # On the vax under Ultrix the set trace flag in the restored
184 # context is causing the SIGTRAP, but after stepping one
185 # instruction, as expected.
186
187 fail "continue to func1 (probably kernel bug)"
188 gdb_test "continue" "Breakpoint.*func1.*" \
189 "extra continue to func1"
190 }
191 -re ".*$prompt $" { fail "continue to func1" }
192 default { fail "continue to func1" }
193 }
194
195 setup_xfail "*-*-irix*"
196 setup_xfail "i*86-*-linux"
197 send "signal SIGUSR1\n"
198 expect {
199 -re "Breakpoint.*handler.*$prompt $" { pass "signal SIGUSR1" }
200 -re "Program received signal SIGUSR1.*$prompt $" {
201 # This is what irix4 and irix5 do.
202 # It would appear to be a kernel bug.
203 fail "signal SIGUSR1"
204 gdb_test "continue" "Breakpoint.*handler.*" "pass it SIGUSR1"
205 }
206 -re ".*$prompt $" { fail "signal SIGUSR1" }
207 default { fail "signal SIGUSR1" }
208 }
209
210 # Will tend to wrongly require an extra continue.
211
212 # The problem here is that the breakpoint at func1 will be
213 # inserted, and when the system finishes with the signal
214 # handler it will try to execute there. For GDB to try to
215 # remember that it was going to step over a breakpoint when a
216 # signal happened, distinguish this case from the case where
217 # func1 is called from the signal handler, etc., seems
218 # exceedingly difficult. So don't expect this to get fixed
219 # anytime soon.
220
221 setup_xfail "*-*-*"
222 send "continue\n"
223 expect {
224 -re "Breakpoint.*func2.*$prompt $" { pass "continue to func2" }
225 -re "Breakpoint.*func1.*$prompt $" {
226 fail "continue to func2"
227 gdb_test "continue" "Breakpoint.*func2.*" \
228 "extra continue to func2"
229 }
230 -re ".*$prompt $" { fail "continue to func2" }
231 default { fail "continue to func2" }
232 }
233
234 exec sleep 2
235
236 # GDB yanks out the breakpoints to step over the breakpoint it
237 # stopped at, which means the breakpoint at handler is yanked.
238 # But if NO_SINGLE_STEP, we won't get another chance to reinsert
239 # them (at least not with procfs, where we tell the kernel not
240 # to tell gdb about `pass' signals). So the fix would appear to
241 # be to just yank that one breakpoint when we step over it.
242
243 setup_xfail "sparc*-*-*"
244 setup_xfail "rs6000-*-*"
245 setup_xfail "powerpc-*-*"
246
247 # A faulty bash will not step the inferior into sigtramp on sun3.
248 if {$bash_bug} then {
249 setup_xfail "m68*-*-sunos4*"
250 }
251
252 setup_xfail "i*86-*-linux"
253 gdb_test "continue" "Breakpoint.*handler.*" "continue to handler"
254
255 # If the NO_SINGLE_STEP failure happened, we have already exited.
256 # If we succeeded a continue will return from the handler to func2.
257 # GDB now has `forgotten' that it intended to step over the
258 # breakpoint at func2 and will stop at func2.
259 setup_xfail "*-*-*"
260 # The sun3 with a faulty bash will also be `forgetful' but it
261 # already got the spurious stop at func2 and this continue will work.
262 if {$bash_bug} then {
263 clear_xfail "m68*-*-sunos4*"
264 }
265 gdb_test "continue" "Program exited with code 010\\." \
266 "continue to exit in signals_tests_1 "
267 }
268 }
269
270 # On a few losing systems, ptrace (PT_CONTINUE) or ptrace (PT_STEP)
271 # causes pending signals to be cleared, which causes these tests to
272 # get nowhere fast. This is totally losing behavior (perhaps there
273 # are cases in which is it useful but the user needs more control,
274 # which they mostly have in GDB), but some people apparently think it
275 # is a feature. It is documented in the ptrace manpage on Motorola
276 # Delta Series sysV68 R3V7.1 and on HPUX 9.0. Even the non-HPUX PA
277 # OSes (BSD and OSF/1) seem to have figured they had to copy this
278 # braindamage.
279
280 if {[ istarget "m68*-motorola-*" ] || [ istarget "hppa*-*-bsd*" ] ||
281 [ istarget "*-*-hpux*" ] || [ istarget "hppa*-*-osf*" ]} then {
282 setup_xfail "*-*-*"
283 fail "ptrace loses on signals on this target"
284 return 0
285 }
286
287 # lynx2.2.2 doesn't lose signals, instead it screws up the stack pointer
288 # in some of these tests leading to massive problems. I've
289 # reported this to lynx, hopefully it'll be fixed in lynx2.3.
290 # Severe braindamage.
291 if [ istarget "*-*-*lynx*" ] then {
292 setup_xfail "*-*-*"
293 fail "kernel scroggs stack pointer in signal tests on this target"
294 return 0
295 }
296
297 gdb_exit
298 gdb_start
299
300 # This will need to be updated as the exact list of signals changes,
301 # but I want to test that TARGET_SIGNAL_0, TARGET_SIGNAL_DEFAULT, and
302 # TARGET_SIGNAL_UNKNOWN are skipped.
303 # Increase expect input buffer for large output from gdb.
304 # Allow blank or TAB as whitespace characters and test individually for
305 # each specific signal.
306
307 proc test_handle_all_print {} {
308 match_max 10000
309 gdb_test "handle all print" \
310 "Signal\[ \t\]+Stop\[ \t\]+Print\[ \t\]+Pass to program\[ \t\]+Description\r\n.*" \
311 "handle all print - Output headers"
312 gdb_test "handle all print" \
313 ".*SIGHUP\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Hangup\r\n.*" \
314 "handle all print - Hangup"
315 gdb_test "handle all print" \
316 ".*SIGQUIT\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Quit\r\n.*" \
317 "handle all print - Quit"
318 gdb_test "handle all print" \
319 ".*SIGILL\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Illegal instruction\r\n.*" \
320 "handle all print - Illegal instruction"
321 gdb_test "handle all print" \
322 ".*SIGABRT\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Aborted\r\n.*" \
323 "handle all print - Aborted"
324 gdb_test "handle all print" \
325 ".*SIGEMT\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Emulation trap\r\n.*" \
326 "handle all print - Emulation trap"
327 gdb_test "handle all print" \
328 ".*SIGFPE\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Arithmetic exception\r\n.*" \
329 "handle all print - Arithmetic exception"
330 gdb_test "handle all print" \
331 ".*SIGKILL\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Killed\r\n.*" \
332 "handle all print - Killed"
333 gdb_test "handle all print" \
334 ".*SIGBUS\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Bus error\r\n.*" \
335 "handle all print - Bus error"
336 gdb_test "handle all print" \
337 ".*SIGSEGV\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Segmentation fault\r\n.*" \
338 "handle all print - Segmentation fault"
339 gdb_test "handle all print" \
340 ".*SIGSYS\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Bad system call\r\n.*" \
341 "handle all print - Bad system call"
342 gdb_test "handle all print" \
343 ".*SIGPIPE\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Broken pipe\r\n.*" \
344 "handle all print - Broken pipe"
345 gdb_test "handle all print" \
346 ".*SIGALRM\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Alarm clock\r\n.*" \
347 "handle all print - Alarm clock"
348 gdb_test "handle all print" \
349 ".*SIGTERM\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Terminated\r\n.*" \
350 "handle all print - Terminated"
351 gdb_test "handle all print" \
352 ".*SIGURG\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Urgent I/O condition\r\n.*" \
353 "handle all print - Urgent I/O condition"
354 gdb_test "handle all print" \
355 ".*SIGSTOP\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Stopped \\(signal\\)\r\n.*" \
356 "handle all print - Stopped (signal)"
357 gdb_test "handle all print" \
358 ".*SIGTSTP\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Stopped \\(user\\)\r\n.*" \
359 "handle all print - Stopped (user)"
360 gdb_test "handle all print" \
361 ".*SIGCONT\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Continued\r\n.*" \
362 "handle all print - Continued"
363 gdb_test "handle all print" \
364 ".*SIGCHLD\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Child status changed\r\n.*" \
365 "handle all print - Child status changed"
366 gdb_test "handle all print" \
367 ".*SIGTTIN\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Stopped \\(tty input\\)\r\n.*" \
368 "handle all print - Stopped (tty input)"
369 gdb_test "handle all print" \
370 ".*SIGTTOU\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Stopped \\(tty output\\)\r\n.*" \
371 "handle all print - Stopped (tty output)"
372 gdb_test "handle all print" \
373 ".*SIGIO\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+I/O possible\r\n.*" \
374 "handle all print - I/O possible"
375 gdb_test "handle all print" \
376 ".*SIGXCPU\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+CPU time limit exceeded\r\n.*" \
377 "handle all print - CPU time limit exceeded"
378 gdb_test "handle all print" \
379 ".*SIGXFSZ\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+File size limit exceeded\r\n.*" \
380 "handle all print - File size limit exceeded"
381 gdb_test "handle all print" \
382 ".*SIGVTALRM\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Virtual timer expired\r\n.*" \
383 "handle all print - Virtual timer expired"
384 gdb_test "handle all print" \
385 ".*SIGPROF\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Profiling timer expired\r\n.*" \
386 "handle all print - Profiling timer expired"
387 gdb_test "handle all print" \
388 ".*SIGWINCH\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Window size changed\r\n.*" \
389 "handle all print - Window size changed"
390 gdb_test "handle all print" \
391 ".*SIGLOST\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Resource lost\r\n.*" \
392 "handle all print - Resource lost"
393 gdb_test "handle all print" \
394 ".*SIGUSR1\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+User defined signal 1\r\n.*" \
395 "handle all print - User defined signal 1"
396 gdb_test "handle all print" \
397 ".*SIGUSR2\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+User defined signal 2\r\n.*" \
398 "handle all print - User defined signal 2"
399 gdb_test "handle all print" \
400 ".*SIGPWR\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Power fail/restart\r\n.*" \
401 "handle all print - Power fail/restart"
402 gdb_test "handle all print" \
403 ".*SIGPOLL\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Pollable event occurred\r\n.*" \
404 "handle all print - Pollable event occurred"
405 gdb_test "handle all print" \
406 ".*SIGWIND\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+SIGWIND\r\n.*" \
407 "handle all print - SIGWIND"
408 gdb_test "handle all print" \
409 ".*SIGPHONE\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+SIGPHONE\r\n.*" \
410 "handle all print - SIGPHONE"
411 gdb_test "handle all print" \
412 ".*SIGWAITING\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Process's LWPs are blocked\r\n.*" \
413 "handle all print - Process's LWPs are blocked"
414 gdb_test "handle all print" \
415 ".*SIGLWP\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Signal LWP\r\n.*" \
416 "handle all print - Signal LWP"
417 gdb_test "handle all print" \
418 ".*SIGDANGER\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Swap space dangerously low\r\n.*" \
419 "handle all print - Swap space dangerously low"
420 gdb_test "handle all print" \
421 ".*SIGGRANT\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Monitor mode granted\r\n.*" \
422 "handle all print - Monitor mode granted"
423 gdb_test "handle all print" \
424 ".*SIGRETRACT\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Need to relinguish monitor mode\r\n.*" \
425 "handle all print - Need to relinguish monitor mode"
426 gdb_test "handle all print" \
427 ".*SIGMSG\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Monitor mode data available\r\n.*" \
428 "handle all print - Monitor mode data available"
429 gdb_test "handle all print" \
430 ".*SIGSOUND\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Sound completed\r\n.*" \
431 "handle all print - Sound completed"
432 gdb_test "handle all print" \
433 ".*SIGSAK\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Secure attention\r\n.*" \
434 "handle all print - Secure attention"
435 gdb_test "handle all print" \
436 ".*SIGPRIO\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+SIGPRIO\r\n.*" \
437 "handle all print - SIGPRIO"
438 gdb_test "handle all print" \
439 ".*SIG33\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 33\r\n.*" \
440 "handle all print - Real-time event 33"
441 gdb_test "handle all print" \
442 ".*SIG34\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 34\r\n.*" \
443 "handle all print - Real-time event 34"
444 gdb_test "handle all print" \
445 ".*SIG35\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 35\r\n.*" \
446 "handle all print - Real-time event 35"
447 gdb_test "handle all print" \
448 ".*SIG36\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 36\r\n.*" \
449 "handle all print - Real-time event 36"
450 gdb_test "handle all print" \
451 ".*SIG37\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 37\r\n.*" \
452 "handle all print - Real-time event 37"
453 gdb_test "handle all print" \
454 ".*SIG38\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 38\r\n.*" \
455 "handle all print - Real-time event 38"
456 gdb_test "handle all print" \
457 ".*SIG39\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 39\r\n.*" \
458 "handle all print - Real-time event 39"
459 gdb_test "handle all print" \
460 ".*SIG40\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 40\r\n.*" \
461 "handle all print - Real-time event 40"
462 gdb_test "handle all print" \
463 ".*SIG41\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 41\r\n.*" \
464 "handle all print - Real-time event 41"
465 gdb_test "handle all print" \
466 ".*SIG42\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 42\r\n.*" \
467 "handle all print - Real-time event 42"
468 gdb_test "handle all print" \
469 ".*SIG43\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 43\r\n.*" \
470 "handle all print - Real-time event 43"
471 gdb_test "handle all print" \
472 ".*SIG44\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 44\r\n.*" \
473 "handle all print - Real-time event 44"
474 gdb_test "handle all print" \
475 ".*SIG45\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 45\r\n.*" \
476 "handle all print - Real-time event 45"
477 gdb_test "handle all print" \
478 ".*SIG46\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 46\r\n.*" \
479 "handle all print - Real-time event 46"
480 gdb_test "handle all print" \
481 ".*SIG47\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 47\r\n.*" \
482 "handle all print - Real-time event 47"
483 gdb_test "handle all print" \
484 ".*SIG48\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 48\r\n.*" \
485 "handle all print - Real-time event 48"
486 gdb_test "handle all print" \
487 ".*SIG49\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 49\r\n.*" \
488 "handle all print - Real-time event 49"
489 gdb_test "handle all print" \
490 ".*SIG50\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 50\r\n.*" \
491 "handle all print - Real-time event 50"
492 gdb_test "handle all print" \
493 ".*SIG51\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 51\r\n.*" \
494 "handle all print - Real-time event 51"
495 gdb_test "handle all print" \
496 ".*SIG52\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 52\r\n.*" \
497 "handle all print - Real-time event 52"
498 gdb_test "handle all print" \
499 ".*SIG53\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 53\r\n.*" \
500 "handle all print - Real-time event 53"
501 gdb_test "handle all print" \
502 ".*SIG54\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 54\r\n.*" \
503 "handle all print - Real-time event 54"
504 gdb_test "handle all print" \
505 ".*SIG55\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 55\r\n.*" \
506 "handle all print - Real-time event 55"
507 gdb_test "handle all print" \
508 ".*SIG56\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 56\r\n.*" \
509 "handle all print - Real-time event 56"
510 gdb_test "handle all print" \
511 ".*SIG57\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 57\r\n.*" \
512 "handle all print - Real-time event 57"
513 gdb_test "handle all print" \
514 ".*SIG58\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 58\r\n.*" \
515 "handle all print - Real-time event 58"
516 gdb_test "handle all print" \
517 ".*SIG59\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 59\r\n.*" \
518 "handle all print - Real-time event 59"
519 gdb_test "handle all print" \
520 ".*SIG60\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 60\r\n.*" \
521 "handle all print - Real-time event 60"
522 gdb_test "handle all print" \
523 ".*SIG61\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 61\r\n.*" \
524 "handle all print - Real-time event 61"
525 gdb_test "handle all print" \
526 ".*SIG62\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 62\r\n.*" \
527 "handle all print - Real-time event 62"
528 gdb_test "handle all print" \
529 ".*SIG63\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 63\r\n.*" \
530 "handle all print - Real-time event 63"
531 gdb_test "handle all print" \
532 ".*EXC_BAD_ACCESS\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Could not access memory\r\n.*" \
533 "handle all print - Could not access memory"
534 gdb_test "handle all print" \
535 ".*EXC_BAD_INSTRUCTION\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Illegal instruction/operand\r\n.*" \
536 "handle all print - Illegal instruction/operand"
537 gdb_test "handle all print" \
538 ".*EXC_ARITHMETIC\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Arithmetic exception\r\n.*" \
539 "handle all print - Arithmetic exception"
540 gdb_test "handle all print" \
541 ".*EXC_EMULATION\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Emulation instruction\r\n.*" \
542 "handle all print - Emulation instruction"
543 gdb_test "handle all print" \
544 ".*EXC_SOFTWARE\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Software generated exception\r\n.*" \
545 "handle all print - Software generated exception"
546 gdb_test "handle all print" \
547 ".*EXC_BREAKPOINT\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Breakpoint.*" \
548 "handle all print - Breakpoint"
549 }
550 test_handle_all_print
551
552 gdb_exit
553 gdb_start
554 gdb_reinitialize_dir $srcdir/$subdir
555 gdb_load $binfile
556 signal_tests_1
557
558 # Force a resync, so we're looking at the right prompt. On SCO we
559 # were getting out of sync (I don't understand why).
560 send "p 1+1\n"
561 expect {
562 -re "= 2.*$prompt $" {}
563 -re ".*$prompt $" { perror "sync trouble in signals.exp" }
564 default { perror "sync trouble in signals.exp" }
565 }
566
567 if [runto_main] then {
568 gdb_test "break handler if 0" "Breakpoint \[0-9\]+ .*"
569 gdb_test "set \$handler_breakpoint_number = \$bpnum" ""
570
571 # Get to the point where a signal is waiting to be delivered
572 gdb_test "next" "signal \\(SIGUSR1.*" "next to signal in signals.exp"
573 gdb_test "next" "alarm \\(.*" "next to alarm #1 in signals.exp"
574 gdb_test "next" "\\+\\+count; /\\* first \\*/" \
575 "next to ++count #1 in signals.exp"
576 # Give the signal time to get delivered
577 exec sleep 2
578
579 # Now call a function. When GDB tries to run the stack dummy,
580 # it will hit the breakpoint at handler. Provided it doesn't
581 # lose its cool, this is not a problem, it just has to note
582 # that the breakpoint condition is false and keep going.
583
584 gdb_test "p func1 ()" "^p func1 \\(\\)\r\n.\[0-9\]* = void" \
585 "p func1 () #1 in signals.exp"
586
587 # Make sure the count got incremented.
588
589 # Haven't investigated this xfail
590 setup_xfail "rs6000-*-*"
591 setup_xfail "powerpc-*-*"
592 gdb_test "p count" "= 2" "p count #1 in signals.exp"
593 if { [istarget "rs6000-*-*"] || [istarget "powerpc-*-*"] } { return 0 }
594
595 gdb_test "condition \$handler_breakpoint_number" "now unconditional\\."
596 gdb_test "next" "alarm \\(.*" "next to alarm #2 in signals.exp"
597 gdb_test "next" "\\+\\+count; /\\* second \\*/" \
598 "next to ++count #2 in signals.exp"
599 exec sleep 2
600
601 # This time we stop when GDB tries to run the stack dummy.
602 # So it is OK that we do not print the return value from the function.
603 gdb_test "p func1 ()" \
604 "Breakpoint \[0-9\]*, handler.*
605 The program being debugged stopped while in a function called from GDB.*" \
606 "p func1 () #2 in signals.exp"
607 # But we should be able to backtrace...
608 # On alpha-*-osf2.0 this test works when run manually but sometime fails when
609 # run under dejagnu, making it very hard to debug the problem. Weird...
610 gdb_test "bt" "#0.*handler.*#1.*#2.*main.*" "bt in signals.exp"
611 # ...and continue...
612 gdb_test "continue" "Continuing\\." "continue in signals.exp"
613 # ...and then count should have been incremented
614 gdb_test "p count" "= 5" "p count #2 in signals.exp"
615 }
616
617 return 0
This page took 0.043616 seconds and 5 git commands to generate.