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