1 # Copyright 1995, 1996, 1997, 1999, 2007, 2008, 2009
2 # Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
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}] != "" } {
41 # Make the first signal SIGABRT because it is always supported.
45 proc test_one_sig {nextsig} {
50 set this_sig_supported $sig_supported
51 gdb_test "handle SIG$thissig stop print" \
52 "SIG$thissig\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*"
53 gdb_test "b handle_$thissig" "Breakpoint \[0-9\]+ .*"
54 gdb_test "b gen_$nextsig" "Breakpoint \[0-9\]+ .*"
56 set need_another_continue 1
58 if $this_sig_supported then {
60 if { $thissig == "IO" } {
61 setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
64 -re "Continuing.*Program received signal SIG$thissig.*$gdb_prompt $" {
65 pass "get signal $thissig"
67 -re ".*$gdb_prompt $" {
68 fail "get signal $thissig"
69 set need_another_continue 0
72 fail "get signal $thissig (eof or timeout)"
76 if [ istarget "alpha-dec-osf3*" ] then {
77 # OSF/1-3.x is unable to continue with a job control stop signal.
78 # The inferior remains stopped without an event of interest
79 # and GDB waits forever for the inferior to stop on an event
80 # of interest. Work around the kernel bug.
81 if { $thissig == "TSTP" || $thissig == "TTIN" || $thissig == "TTOU" } {
82 setup_xfail "alpha-dec-osf3*"
83 fail "cannot continue from signal $thissig"
84 set need_another_continue 0
88 if $need_another_continue then {
90 if { $thissig == "URG" } {
91 setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
93 # Either Lynx or GDB screws up on SIGPRIO
94 if { $thissig == "PRIO" } {
95 setup_xfail "*-*-*lynx*"
98 -re "Breakpoint.*handle_$thissig.*$gdb_prompt $" {
99 pass "send signal $thissig"
101 -re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" {
102 fail "missed breakpoint at handle_$thissig"
108 if { $missed_handler == "0" } then {
109 send_gdb "signal 0\n"
111 -re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" {
112 pass "advance to $nextsig"
115 -re "Breakpoint.*gen_$nextsig.*handle.*$gdb_prompt $" {
116 pass "advance to $nextsig"
119 -re ".*$gdb_prompt $" { fail "advance to $nextsig" }
120 default { fail "advance to $nextsig (eof or timeout)" }
200 # The last signal (SIGTERM) gets handled slightly differently because
201 # we are not setting up for another test.
202 gdb_test "handle SIGTERM stop print" \
203 "SIGTERM\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*"
204 gdb_test "b handle_TERM" "Breakpoint \[0-9\]+ .*"
205 gdb_test "continue" \
206 "Continuing.*Program received signal SIGTERM.*" \
208 gdb_test "continue" "Breakpoint.*handle_TERM.*" "send signal TERM"
209 gdb_continue_to_end "continue to sigall exit"