1 # Copyright 1995-1997, 1999, 2007-2012 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 3 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, see <http://www.gnu.org/licenses/>.
16 if [target_info exists gdb,nosignals] {
17 verbose "Skipping sigall.exp because of nosignals."
24 gdb_reinitialize_dir $srcdir/$subdir
27 set srcfile ${testfile}.c
28 set binfile ${objdir}/${subdir}/${testfile}
29 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
34 # Make the first signal SIGABRT because it is always supported.
38 proc test_one_sig {nextsig} {
43 set this_sig_supported $sig_supported
44 gdb_test "handle SIG$thissig stop print" \
45 "SIG$thissig\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*"
46 gdb_test "b handle_$thissig" "Breakpoint \[0-9\]+ .*"
47 gdb_test "b gen_$nextsig" "Breakpoint \[0-9\]+ .*"
49 set need_another_continue 1
51 if $this_sig_supported then {
52 if { $thissig == "IO" } {
53 setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
56 "Continuing.*Program received signal SIG$thissig.*" \
59 if [ istarget "alpha-dec-osf3*" ] then {
60 # OSF/1-3.x is unable to continue with a job control stop signal.
61 # The inferior remains stopped without an event of interest
62 # and GDB waits forever for the inferior to stop on an event
63 # of interest. Work around the kernel bug.
64 if { $thissig == "TSTP" || $thissig == "TTIN" || $thissig == "TTOU" } {
65 setup_xfail "alpha-dec-osf3*"
66 fail "cannot continue from signal $thissig"
67 set need_another_continue 0
71 if $need_another_continue then {
72 if { $thissig == "URG" } {
73 setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
75 # Either Lynx or GDB screws up on SIGPRIO
76 if { $thissig == "PRIO" } {
77 setup_xfail "*-*-*lynx*"
79 gdb_test_multiple "continue" "send signal $thissig" {
80 -re "Breakpoint.*handle_$thissig.*$gdb_prompt $" {
81 pass "send signal $thissig"
83 -re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" {
84 fail "missed breakpoint at handle_$thissig"
90 if { $missed_handler == "0" } then {
91 gdb_test_multiple "signal 0" "advance to $nextsig" {
92 -re "Breakpoint.*gen_$nextsig.*\r\n\[0-9\]+\[ \t\]+kill \\(.*\r\n$gdb_prompt $" {
93 pass "advance to $nextsig"
96 -re "Breakpoint.*gen_$nextsig.*\r\n\[0-9\]+\[ \t\]+handle_.*\r\n$gdb_prompt $" {
97 pass "advance to $nextsig"
179 # The last signal (SIGTERM) gets handled slightly differently because
180 # we are not setting up for another test.
181 gdb_test "handle SIGTERM stop print" \
182 "SIGTERM\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*"
183 gdb_test "b handle_TERM" "Breakpoint \[0-9\]+ .*"
184 gdb_test "continue" \
185 "Continuing.*Program received signal SIGTERM.*" \
187 gdb_test "continue" "Breakpoint.*handle_TERM.*" "send signal TERM"
188 gdb_continue_to_end "continue to sigall exit"