1 # Copyright 1995, 1996, 1997, 1999, 2007, 2008, 2009, 2010
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."
29 gdb_reinitialize_dir $srcdir/$subdir
32 set srcfile ${testfile}.c
33 set binfile ${objdir}/${subdir}/${testfile}
34 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
39 # Make the first signal SIGABRT because it is always supported.
43 proc test_one_sig {nextsig} {
48 set this_sig_supported $sig_supported
49 gdb_test "handle SIG$thissig stop print" \
50 "SIG$thissig\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*"
51 gdb_test "b handle_$thissig" "Breakpoint \[0-9\]+ .*"
52 gdb_test "b gen_$nextsig" "Breakpoint \[0-9\]+ .*"
54 set need_another_continue 1
56 if $this_sig_supported then {
57 if { $thissig == "IO" } {
58 setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
61 "Continuing.*Program received signal SIG$thissig.*" \
64 if [ istarget "alpha-dec-osf3*" ] then {
65 # OSF/1-3.x is unable to continue with a job control stop signal.
66 # The inferior remains stopped without an event of interest
67 # and GDB waits forever for the inferior to stop on an event
68 # of interest. Work around the kernel bug.
69 if { $thissig == "TSTP" || $thissig == "TTIN" || $thissig == "TTOU" } {
70 setup_xfail "alpha-dec-osf3*"
71 fail "cannot continue from signal $thissig"
72 set need_another_continue 0
76 if $need_another_continue then {
77 if { $thissig == "URG" } {
78 setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
80 # Either Lynx or GDB screws up on SIGPRIO
81 if { $thissig == "PRIO" } {
82 setup_xfail "*-*-*lynx*"
84 gdb_test_multiple "continue" "send signal $thissig" {
85 -re "Breakpoint.*handle_$thissig.*$gdb_prompt $" {
86 pass "send signal $thissig"
88 -re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" {
89 fail "missed breakpoint at handle_$thissig"
95 if { $missed_handler == "0" } then {
96 gdb_test_multiple "signal 0" "advance to $nextsig" {
97 -re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" {
98 pass "advance to $nextsig"
101 -re "Breakpoint.*gen_$nextsig.*handle.*$gdb_prompt $" {
102 pass "advance to $nextsig"
184 # The last signal (SIGTERM) gets handled slightly differently because
185 # we are not setting up for another test.
186 gdb_test "handle SIGTERM stop print" \
187 "SIGTERM\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*"
188 gdb_test "b handle_TERM" "Breakpoint \[0-9\]+ .*"
189 gdb_test "continue" \
190 "Continuing.*Program received signal SIGTERM.*" \
192 gdb_test "continue" "Breakpoint.*handle_TERM.*" "send signal TERM"
193 gdb_continue_to_end "continue to sigall exit"