]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/sigall.exp
update copyright year range in GDB files
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / sigall.exp
CommitLineData
61baf725 1# Copyright 1995-2017 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
e22f8b7c 5# the Free Software Foundation; either version 3 of the License, or
c906108c 6# (at your option) any later version.
e22f8b7c 7#
c906108c
SS
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.
e22f8b7c 12#
c906108c 13# You should have received a copy of the GNU General Public License
e22f8b7c 14# along with this program. If not, see <http://www.gnu.org/licenses/>.
c906108c
SS
15
16if [target_info exists gdb,nosignals] {
17 verbose "Skipping sigall.exp because of nosignals."
18 continue
19}
20
0ab77f5f 21standard_testfile
c906108c 22
5b362f04 23if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
0ab77f5f 24 return -1
c906108c
SS
25}
26
c906108c
SS
27proc test_one_sig {nextsig} {
28 global sig_supported
29 global gdb_prompt
30 global thissig
31
32 set this_sig_supported $sig_supported
33 gdb_test "handle SIG$thissig stop print" \
34 "SIG$thissig\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*"
35 gdb_test "b handle_$thissig" "Breakpoint \[0-9\]+ .*"
36 gdb_test "b gen_$nextsig" "Breakpoint \[0-9\]+ .*"
37
38 set need_another_continue 1
39 set missed_handler 0
40 if $this_sig_supported then {
f1300300
JM
41 set esig $thissig
42
c906108c
SS
43 if { $thissig == "IO" } {
44 setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
45 }
f1300300
JM
46 # On Linux SPARC64 systems SIGLOST==SIGPWR and gdb identifies
47 # the raised signal as PWR.
48 if { $thissig == "LOST" && [ istarget "sparc64-*-linux*" ] } then {
49 set esig "PWR"
50 }
51
02746bbc 52 gdb_test "continue" \
f1300300
JM
53 "Continuing.*Program received signal SIG$esig.*" \
54 "get signal $esig"
c906108c 55 }
c906108c
SS
56
57 if $need_another_continue then {
c906108c
SS
58 if { $thissig == "URG" } {
59 setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
60 }
61 # Either Lynx or GDB screws up on SIGPRIO
62 if { $thissig == "PRIO" } {
63 setup_xfail "*-*-*lynx*"
64 }
02746bbc 65 gdb_test_multiple "continue" "send signal $thissig" {
c906108c
SS
66 -re "Breakpoint.*handle_$thissig.*$gdb_prompt $" {
67 pass "send signal $thissig"
68 }
69 -re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" {
70 fail "missed breakpoint at handle_$thissig"
71 set missed_handler 1
72 }
73 }
74 }
75
76 if { $missed_handler == "0" } then {
02746bbc 77 gdb_test_multiple "signal 0" "advance to $nextsig" {
dbd492a3 78 -re "Breakpoint.*gen_$nextsig.*\r\n\[0-9\]+\[ \t\]+kill \\(.*\r\n$gdb_prompt $" {
c906108c
SS
79 pass "advance to $nextsig"
80 set sig_supported 1
81 }
dbd492a3 82 -re "Breakpoint.*gen_$nextsig.*\r\n\[0-9\]+\[ \t\]+handle_.*\r\n$gdb_prompt $" {
c906108c
SS
83 pass "advance to $nextsig"
84 set sig_supported 0
85 }
c906108c
SS
86 }
87 }
88 set thissig $nextsig
89}
90
b1e0c0fa
PA
91# The list of signals that the program generates, in the order they
92# are generated.
93set signals {
94 ABRT
95 HUP
96 QUIT
97 ILL
98 EMT
99 FPE
100 BUS
101 SEGV
102 SYS
103 PIPE
104 ALRM
105 URG
106 TSTP
107 CONT
108 CHLD
109 TTIN
110 TTOU
111 IO
112 XCPU
113 XFSZ
114 VTALRM
115 PROF
116 WINCH
117 LOST
118 USR1
119 USR2
120 PWR
121 POLL
122 WIND
123 PHONE
124 WAITING
125 LWP
126 DANGER
127 GRANT
128 RETRACT
129 MSG
130 SOUND
131 SAK
132 PRIO
133 33
134 34
135 35
136 36
137 37
138 38
139 39
140 40
141 41
142 42
143 43
144 44
145 45
146 46
147 47
148 48
149 49
150 50
151 51
152 52
153 53
154 54
155 55
156 56
157 57
158 58
159 59
160 60
161 61
162 62
163 63
164 TERM
165}
166
167# Make the first signal SIGABRT because it is always supported.
168set sig_supported 1
169set thissig "ABRT"
170
c906108c 171runto gen_ABRT
b1e0c0fa 172
13e4e967 173foreach sig [lrange $signals 1 end] {
b1e0c0fa
PA
174 test_one_sig $sig
175}
c906108c
SS
176
177# The last signal (SIGTERM) gets handled slightly differently because
178# we are not setting up for another test.
179gdb_test "handle SIGTERM stop print" \
180 "SIGTERM\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*"
181gdb_test "b handle_TERM" "Breakpoint \[0-9\]+ .*"
182gdb_test "continue" \
183 "Continuing.*Program received signal SIGTERM.*" \
184 "get signal TERM"
185gdb_test "continue" "Breakpoint.*handle_TERM.*" "send signal TERM"
7a292a7a 186gdb_continue_to_end "continue to sigall exit"
c906108c
SS
187
188return 0