]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/sigall.exp
Copyright updates for 2007.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / sigall.exp
CommitLineData
6aba47ca 1# Copyright 1995, 1996, 1997, 1999, 2007 Free Software Foundation, Inc.
c906108c
SS
2
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.
7#
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.
12#
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.
16
17if [target_info exists gdb,nosignals] {
18 verbose "Skipping sigall.exp because of nosignals."
19 continue
20}
21
22if $tracelevel then {
23 strace $tracelevel
24}
25
26set prms_id 0
27set bug_id 0
28
29gdb_exit
30gdb_start
31gdb_reinitialize_dir $srcdir/$subdir
32
33set testfile sigall
34set srcfile ${testfile}.c
35set binfile ${objdir}/${subdir}/${testfile}
36if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
b60f0898
JB
37 untested sigall.exp
38 return -1
c906108c
SS
39}
40
41# Make the first signal SIGABRT because it is always supported.
42set sig_supported 1
43set thissig "ABRT"
44
45proc test_one_sig {nextsig} {
46 global sig_supported
47 global gdb_prompt
48 global thissig
49
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\]+ .*"
55
56 set need_another_continue 1
57 set missed_handler 0
58 if $this_sig_supported then {
59 send_gdb "continue\n"
60 if { $thissig == "IO" } {
61 setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
62 }
63 gdb_expect {
64 -re "Continuing.*Program received signal SIG$thissig.*$gdb_prompt $" {
65 pass "get signal $thissig"
66 }
67 -re ".*$gdb_prompt $" {
68 fail "get signal $thissig"
69 set need_another_continue 0
70 }
71 default {
72 fail "get signal $thissig (eof or timeout)"
73 }
74 }
75 }
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
85 }
86 }
87
88 if $need_another_continue then {
89 send_gdb "continue\n"
90 if { $thissig == "URG" } {
91 setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
92 }
93 # Either Lynx or GDB screws up on SIGPRIO
94 if { $thissig == "PRIO" } {
95 setup_xfail "*-*-*lynx*"
96 }
97 gdb_expect {
98 -re "Breakpoint.*handle_$thissig.*$gdb_prompt $" {
99 pass "send signal $thissig"
100 }
101 -re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" {
102 fail "missed breakpoint at handle_$thissig"
103 set missed_handler 1
104 }
105 }
106 }
107
108 if { $missed_handler == "0" } then {
109 send_gdb "signal 0\n"
110 gdb_expect {
111 -re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" {
112 pass "advance to $nextsig"
113 set sig_supported 1
114 }
115 -re "Breakpoint.*gen_$nextsig.*handle.*$gdb_prompt $" {
116 pass "advance to $nextsig"
117 set sig_supported 0
118 }
119 -re ".*$gdb_prompt $" { fail "advance to $nextsig" }
120 default { fail "advance to $nextsig (eof or timeout)" }
121 }
122 }
123 set thissig $nextsig
124}
125
126gdb_load $binfile
127
128runto gen_ABRT
129test_one_sig HUP
130test_one_sig QUIT
131test_one_sig ILL
132test_one_sig EMT
133test_one_sig FPE
134test_one_sig BUS
135test_one_sig SEGV
136test_one_sig SYS
137test_one_sig PIPE
138test_one_sig ALRM
139test_one_sig URG
140test_one_sig TSTP
141test_one_sig CONT
142test_one_sig CHLD
143test_one_sig TTIN
144test_one_sig TTOU
145test_one_sig IO
146test_one_sig XCPU
147test_one_sig XFSZ
148test_one_sig VTALRM
149test_one_sig PROF
150test_one_sig WINCH
151test_one_sig LOST
152test_one_sig USR1
153test_one_sig USR2
154test_one_sig PWR
155test_one_sig POLL
156test_one_sig WIND
157test_one_sig PHONE
158test_one_sig WAITING
159test_one_sig LWP
160test_one_sig DANGER
161test_one_sig GRANT
162test_one_sig RETRACT
163test_one_sig MSG
164test_one_sig SOUND
165test_one_sig SAK
166test_one_sig PRIO
167test_one_sig 33
168test_one_sig 34
169test_one_sig 35
170test_one_sig 36
171test_one_sig 37
172test_one_sig 38
173test_one_sig 39
174test_one_sig 40
175test_one_sig 41
176test_one_sig 42
177test_one_sig 43
178test_one_sig 44
179test_one_sig 45
180test_one_sig 46
181test_one_sig 47
182test_one_sig 48
183test_one_sig 49
184test_one_sig 50
185test_one_sig 51
186test_one_sig 52
187test_one_sig 53
188test_one_sig 54
189test_one_sig 55
190test_one_sig 56
191test_one_sig 57
192test_one_sig 58
193test_one_sig 59
194test_one_sig 60
195test_one_sig 61
196test_one_sig 62
197test_one_sig 63
198test_one_sig TERM
199
200# The last signal (SIGTERM) gets handled slightly differently because
201# we are not setting up for another test.
202gdb_test "handle SIGTERM stop print" \
203 "SIGTERM\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*"
204gdb_test "b handle_TERM" "Breakpoint \[0-9\]+ .*"
205gdb_test "continue" \
206 "Continuing.*Program received signal SIGTERM.*" \
207 "get signal TERM"
208gdb_test "continue" "Breakpoint.*handle_TERM.*" "send signal TERM"
7a292a7a 209gdb_continue_to_end "continue to sigall exit"
c906108c
SS
210
211return 0