]> Git Repo - binutils.git/blob - gdb/testsuite/gdb.base/signals.exp
* gdb.base/signals.exp (test_handle_all_print): Test separately for
[binutils.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 timeout and 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     global timeout
309
310     set oldtimeout $timeout
311     set timeout [expr "$timeout + 15"]
312     verbose "Timeout is now $timeout seconds" 2
313     match_max 10000
314     gdb_test "handle all print" \
315          "Signal\[ \t\]+Stop\[ \t\]+Print\[ \t\]+Pass to program\[ \t\]+Description\r\n.*" \
316          "handle all print - Output headers"
317     gdb_test "handle all print" \
318          ".*SIGHUP\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Hangup\r\n.*" \
319          "handle all print - Hangup"
320     gdb_test "handle all print" \
321          ".*SIGQUIT\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Quit\r\n.*" \
322          "handle all print - Quit"
323     gdb_test "handle all print" \
324          ".*SIGILL\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Illegal instruction\r\n.*" \
325          "handle all print - Illegal instruction"
326     gdb_test "handle all print" \
327          ".*SIGABRT\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Aborted\r\n.*" \
328          "handle all print - Aborted"
329     gdb_test "handle all print" \
330          ".*SIGEMT\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Emulation trap\r\n.*" \
331          "handle all print - Emulation trap"
332     gdb_test "handle all print" \
333          ".*SIGFPE\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Arithmetic exception\r\n.*" \
334          "handle all print - Arithmetic exception"
335     gdb_test "handle all print" \
336          ".*SIGKILL\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Killed\r\n.*" \
337          "handle all print - Killed"
338     gdb_test "handle all print" \
339          ".*SIGBUS\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Bus error\r\n.*" \
340          "handle all print - Bus error"
341     gdb_test "handle all print" \
342          ".*SIGSEGV\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Segmentation fault\r\n.*" \
343          "handle all print - Segmentation fault"
344     gdb_test "handle all print" \
345          ".*SIGSYS\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Bad system call\r\n.*" \
346          "handle all print - Bad system call"
347     gdb_test "handle all print" \
348          ".*SIGPIPE\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Broken pipe\r\n.*" \
349          "handle all print - Broken pipe"
350     gdb_test "handle all print" \
351          ".*SIGALRM\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Alarm clock\r\n.*" \
352          "handle all print - Alarm clock"
353     gdb_test "handle all print" \
354          ".*SIGTERM\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Terminated\r\n.*" \
355          "handle all print - Terminated"
356     gdb_test "handle all print" \
357          ".*SIGURG\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Urgent I/O condition\r\n.*" \
358          "handle all print - Urgent I/O condition"
359     gdb_test "handle all print" \
360          ".*SIGSTOP\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Stopped \\(signal\\)\r\n.*" \
361          "handle all print - Stopped (signal)"
362     gdb_test "handle all print" \
363          ".*SIGTSTP\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Stopped \\(user\\)\r\n.*" \
364          "handle all print - Stopped (user)"
365     gdb_test "handle all print" \
366          ".*SIGCONT\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Continued\r\n.*" \
367          "handle all print - Continued"
368     gdb_test "handle all print" \
369          ".*SIGCHLD\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Child status changed\r\n.*" \
370          "handle all print - Child status changed"
371     gdb_test "handle all print" \
372          ".*SIGTTIN\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Stopped \\(tty input\\)\r\n.*" \
373          "handle all print - Stopped (tty input)"
374     gdb_test "handle all print" \
375          ".*SIGTTOU\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Stopped \\(tty output\\)\r\n.*" \
376          "handle all print - Stopped (tty output)"
377     gdb_test "handle all print" \
378          ".*SIGIO\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+I/O possible\r\n.*" \
379          "handle all print - I/O possible"
380     gdb_test "handle all print" \
381          ".*SIGXCPU\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+CPU time limit exceeded\r\n.*" \
382          "handle all print - CPU time limit exceeded"
383     gdb_test "handle all print" \
384          ".*SIGXFSZ\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+File size limit exceeded\r\n.*" \
385          "handle all print - File size limit exceeded"
386     gdb_test "handle all print" \
387          ".*SIGVTALRM\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Virtual timer expired\r\n.*" \
388          "handle all print - Virtual timer expired"
389     gdb_test "handle all print" \
390          ".*SIGPROF\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Profiling timer expired\r\n.*" \
391          "handle all print - Profiling timer expired"
392     gdb_test "handle all print" \
393          ".*SIGWINCH\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Window size changed\r\n.*" \
394          "handle all print - Window size changed"
395     gdb_test "handle all print" \
396          ".*SIGLOST\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Resource lost\r\n.*" \
397          "handle all print - Resource lost"
398     gdb_test "handle all print" \
399          ".*SIGUSR1\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+User defined signal 1\r\n.*" \
400          "handle all print - User defined signal 1"
401     gdb_test "handle all print" \
402          ".*SIGUSR2\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+User defined signal 2\r\n.*" \
403          "handle all print - User defined signal 2"
404     gdb_test "handle all print" \
405          ".*SIGPWR\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Power fail/restart\r\n.*" \
406          "handle all print - Power fail/restart"
407     gdb_test "handle all print" \
408          ".*SIGPOLL\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Pollable event occurred\r\n.*" \
409          "handle all print - Pollable event occurred"
410     gdb_test "handle all print" \
411          ".*SIGWIND\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+SIGWIND\r\n.*" \
412          "handle all print - SIGWIND"
413     gdb_test "handle all print" \
414          ".*SIGPHONE\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+SIGPHONE\r\n.*" \
415          "handle all print - SIGPHONE"
416     gdb_test "handle all print" \
417          ".*SIGWAITING\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Process's LWPs are blocked\r\n.*" \
418          "handle all print - Process's LWPs are blocked"
419     gdb_test "handle all print" \
420          ".*SIGLWP\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Signal LWP\r\n.*" \
421          "handle all print - Signal LWP"
422     gdb_test "handle all print" \
423          ".*SIGDANGER\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Swap space dangerously low\r\n.*" \
424          "handle all print - Swap space dangerously low"
425     gdb_test "handle all print" \
426          ".*SIGGRANT\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Monitor mode granted\r\n.*" \
427          "handle all print - Monitor mode granted"
428     gdb_test "handle all print" \
429          ".*SIGRETRACT\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Need to relinguish monitor mode\r\n.*" \
430          "handle all print - Need to relinguish monitor mode"
431     gdb_test "handle all print" \
432          ".*SIGMSG\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Monitor mode data available\r\n.*" \
433          "handle all print - Monitor mode data available"
434     gdb_test "handle all print" \
435          ".*SIGSOUND\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Sound completed\r\n.*" \
436          "handle all print - Sound completed"
437     gdb_test "handle all print" \
438          ".*SIGSAK\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Secure attention\r\n.*" \
439          "handle all print - Secure attention"
440     gdb_test "handle all print" \
441          ".*SIGPRIO\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+SIGPRIO\r\n.*" \
442          "handle all print - SIGPRIO"
443     gdb_test "handle all print" \
444          ".*SIG33\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 33\r\n.*" \
445          "handle all print - Real-time event 33"
446     gdb_test "handle all print" \
447          ".*SIG34\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 34\r\n.*" \
448          "handle all print - Real-time event 34"
449     gdb_test "handle all print" \
450          ".*SIG35\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 35\r\n.*" \
451          "handle all print - Real-time event 35"
452     gdb_test "handle all print" \
453          ".*SIG36\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 36\r\n.*" \
454          "handle all print - Real-time event 36"
455     gdb_test "handle all print" \
456          ".*SIG37\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 37\r\n.*" \
457          "handle all print - Real-time event 37"
458     gdb_test "handle all print" \
459          ".*SIG38\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 38\r\n.*" \
460          "handle all print - Real-time event 38"
461     gdb_test "handle all print" \
462          ".*SIG39\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 39\r\n.*" \
463          "handle all print - Real-time event 39"
464     gdb_test "handle all print" \
465          ".*SIG40\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 40\r\n.*" \
466          "handle all print - Real-time event 40"
467     gdb_test "handle all print" \
468          ".*SIG41\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 41\r\n.*" \
469          "handle all print - Real-time event 41"
470     gdb_test "handle all print" \
471          ".*SIG42\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 42\r\n.*" \
472          "handle all print - Real-time event 42"
473     gdb_test "handle all print" \
474          ".*SIG43\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 43\r\n.*" \
475          "handle all print - Real-time event 43"
476     gdb_test "handle all print" \
477          ".*SIG44\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 44\r\n.*" \
478          "handle all print - Real-time event 44"
479     gdb_test "handle all print" \
480          ".*SIG45\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 45\r\n.*" \
481          "handle all print - Real-time event 45"
482     gdb_test "handle all print" \
483          ".*SIG46\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 46\r\n.*" \
484          "handle all print - Real-time event 46"
485     gdb_test "handle all print" \
486          ".*SIG47\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 47\r\n.*" \
487          "handle all print - Real-time event 47"
488     gdb_test "handle all print" \
489          ".*SIG48\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 48\r\n.*" \
490          "handle all print - Real-time event 48"
491     gdb_test "handle all print" \
492          ".*SIG49\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 49\r\n.*" \
493          "handle all print - Real-time event 49"
494     gdb_test "handle all print" \
495          ".*SIG50\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 50\r\n.*" \
496          "handle all print - Real-time event 50"
497     gdb_test "handle all print" \
498          ".*SIG51\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 51\r\n.*" \
499          "handle all print - Real-time event 51"
500     gdb_test "handle all print" \
501          ".*SIG52\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 52\r\n.*" \
502          "handle all print - Real-time event 52"
503     gdb_test "handle all print" \
504          ".*SIG53\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 53\r\n.*" \
505          "handle all print - Real-time event 53"
506     gdb_test "handle all print" \
507          ".*SIG54\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 54\r\n.*" \
508          "handle all print - Real-time event 54"
509     gdb_test "handle all print" \
510          ".*SIG55\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 55\r\n.*" \
511          "handle all print - Real-time event 55"
512     gdb_test "handle all print" \
513          ".*SIG56\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 56\r\n.*" \
514          "handle all print - Real-time event 56"
515     gdb_test "handle all print" \
516          ".*SIG57\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 57\r\n.*" \
517          "handle all print - Real-time event 57"
518     gdb_test "handle all print" \
519          ".*SIG58\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 58\r\n.*" \
520          "handle all print - Real-time event 58"
521     gdb_test "handle all print" \
522          ".*SIG59\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 59\r\n.*" \
523          "handle all print - Real-time event 59"
524     gdb_test "handle all print" \
525          ".*SIG60\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 60\r\n.*" \
526          "handle all print - Real-time event 60"
527     gdb_test "handle all print" \
528          ".*SIG61\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 61\r\n.*" \
529          "handle all print - Real-time event 61"
530     gdb_test "handle all print" \
531          ".*SIG62\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 62\r\n.*" \
532          "handle all print - Real-time event 62"
533     gdb_test "handle all print" \
534          ".*SIG63\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 63\r\n.*" \
535          "handle all print - Real-time event 63"
536     gdb_test "handle all print" \
537          ".*EXC_BAD_ACCESS\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Could not access memory\r\n.*" \
538          "handle all print - Could not access memory"
539     gdb_test "handle all print" \
540          ".*EXC_BAD_INSTRUCTION\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Illegal instruction/operand\r\n.*" \
541          "handle all print - Illegal instruction/operand"
542     gdb_test "handle all print" \
543          ".*EXC_ARITHMETIC\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Arithmetic exception\r\n.*" \
544          "handle all print - Arithmetic exception"
545     gdb_test "handle all print" \
546          ".*EXC_EMULATION\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Emulation instruction\r\n.*" \
547          "handle all print - Emulation instruction"
548     gdb_test "handle all print" \
549          ".*EXC_SOFTWARE\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Software generated exception\r\n.*" \
550          "handle all print - Software generated exception"
551     gdb_test "handle all print" \
552          ".*EXC_BREAKPOINT\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Breakpoint.*" \
553          "handle all print - Breakpoint"
554     set timeout $oldtimeout
555     verbose "Timeout restored to $timeout seconds" 2
556 }
557 test_handle_all_print
558
559 gdb_exit
560 gdb_start
561 gdb_reinitialize_dir $srcdir/$subdir
562 gdb_load $binfile
563 signal_tests_1
564
565 # Force a resync, so we're looking at the right prompt.  On SCO we
566 # were getting out of sync (I don't understand why).
567 send "p 1+1\n"
568 expect {
569     -re "= 2.*$prompt $" {}
570     -re ".*$prompt $" { perror "sync trouble in signals.exp" }
571     default { perror "sync trouble in signals.exp" }
572 }
573
574 if [runto_main] then {
575     gdb_test "break handler if 0" "Breakpoint \[0-9\]+ .*"
576     gdb_test "set \$handler_breakpoint_number = \$bpnum" ""
577
578     # Get to the point where a signal is waiting to be delivered
579     gdb_test "next" "signal \\(SIGUSR1.*" "next to signal in signals.exp"
580     gdb_test "next" "alarm \\(.*" "next to alarm #1 in signals.exp"
581     gdb_test "next" "\\+\\+count; /\\* first \\*/" \
582         "next to ++count #1 in signals.exp"
583     # Give the signal time to get delivered
584     exec sleep 2
585
586     # Now call a function.  When GDB tries to run the stack dummy,
587     # it will hit the breakpoint at handler.  Provided it doesn't
588     # lose its cool, this is not a problem, it just has to note
589     # that the breakpoint condition is false and keep going.
590
591     gdb_test "p func1 ()" "^p func1 \\(\\)\r\n.\[0-9\]* = void" \
592         "p func1 () #1 in signals.exp"
593
594     # Make sure the count got incremented.
595
596     # Haven't investigated this xfail
597     setup_xfail "rs6000-*-*"
598     setup_xfail "powerpc-*-*"
599     gdb_test "p count" "= 2" "p count #1 in signals.exp"
600     if { [istarget "rs6000-*-*"] || [istarget "powerpc-*-*"] } { return 0 }
601
602     gdb_test "condition \$handler_breakpoint_number" "now unconditional\\."
603     gdb_test "next" "alarm \\(.*" "next to alarm #2 in signals.exp"
604     gdb_test "next" "\\+\\+count; /\\* second \\*/" \
605         "next to ++count #2 in signals.exp"
606     exec sleep 2
607
608     # This time we stop when GDB tries to run the stack dummy.
609     # So it is OK that we do not print the return value from the function.
610     gdb_test "p func1 ()" \
611 "Breakpoint \[0-9\]*, handler.*
612 The program being debugged stopped while in a function called from GDB.*" \
613         "p func1 () #2 in signals.exp"
614     # But we should be able to backtrace...
615     # On alpha-*-osf2.0 this test works when run manually but sometime fails when
616     # run under dejagnu, making it very hard to debug the problem.  Weird...
617     gdb_test "bt" "#0.*handler.*#1.*#2.*main.*" "bt in signals.exp"
618     # ...and continue...
619     gdb_test "continue" "Continuing\\." "continue in signals.exp"
620     # ...and then count should have been incremented
621     gdb_test "p count" "= 5" "p count #2 in signals.exp"
622 }
623
624 return 0
This page took 0.063288 seconds and 4 git commands to generate.