1 # Copyright (C) 1995, 1997 Free Software Foundation, Inc.
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 2 of the License, or
6 # (at your option) any later version.
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.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 if [target_info exists gdb,nosignals] {
18 verbose "Skipping sigall.exp because of nosignals."
31 gdb_reinitialize_dir $srcdir/$subdir
34 set srcfile ${testfile}.c
35 set binfile ${objdir}/${subdir}/${testfile}
36 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
37 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
40 # Make the first signal SIGABRT because it is always supported.
44 proc test_one_sig {nextsig} {
49 set this_sig_supported $sig_supported
50 gdb_test "handle SIG$thissig stop print" \
51 "SIG$thissig\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*"
52 gdb_test "b handle_$thissig" "Breakpoint \[0-9\]+ .*"
53 gdb_test "b gen_$nextsig" "Breakpoint \[0-9\]+ .*"
55 set need_another_continue 1
57 if $this_sig_supported then {
59 if { $thissig == "IO" } {
60 setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
63 -re "Continuing.*Program received signal SIG$thissig.*$gdb_prompt $" {
64 pass "get signal $thissig"
66 -re ".*$gdb_prompt $" {
67 fail "get signal $thissig"
68 set need_another_continue 0
71 fail "get signal $thissig (eof or timeout)"
75 if [ istarget "alpha-dec-osf3*" ] then {
76 # OSF/1-3.x is unable to continue with a job control stop signal.
77 # The inferior remains stopped without an event of interest
78 # and GDB waits forever for the inferior to stop on an event
79 # of interest. Work around the kernel bug.
80 if { $thissig == "TSTP" || $thissig == "TTIN" || $thissig == "TTOU" } {
81 setup_xfail "alpha-dec-osf3*"
82 fail "cannot continue from signal $thissig"
83 set need_another_continue 0
87 if $need_another_continue then {
89 if { $thissig == "URG" } {
90 setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
92 # Either Lynx or GDB screws up on SIGPRIO
93 if { $thissig == "PRIO" } {
94 setup_xfail "*-*-*lynx*"
97 -re "Breakpoint.*handle_$thissig.*$gdb_prompt $" {
98 pass "send signal $thissig"
100 -re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" {
101 fail "missed breakpoint at handle_$thissig"
107 if { $missed_handler == "0" } then {
108 send_gdb "signal 0\n"
110 -re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" {
111 pass "advance to $nextsig"
114 -re "Breakpoint.*gen_$nextsig.*handle.*$gdb_prompt $" {
115 pass "advance to $nextsig"
118 -re ".*$gdb_prompt $" { fail "advance to $nextsig" }
119 default { fail "advance to $nextsig (eof or timeout)" }
199 # The last signal (SIGTERM) gets handled slightly differently because
200 # we are not setting up for another test.
201 gdb_test "handle SIGTERM stop print" \
202 "SIGTERM\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*"
203 gdb_test "b handle_TERM" "Breakpoint \[0-9\]+ .*"
204 gdb_test "continue" \
205 "Continuing.*Program received signal SIGTERM.*" \
207 gdb_test "continue" "Breakpoint.*handle_TERM.*" "send signal TERM"
208 gdb_continue_to_end "continue to sigall exit"