testsuite: handle SIGLOST/SIGPWR conflict in sparc64-*-linux-gnu targets.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / sigall.exp
1 # Copyright 1995-2013 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 3 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, see <http://www.gnu.org/licenses/>.
15
16 if [target_info exists gdb,nosignals] {
17 verbose "Skipping sigall.exp because of nosignals."
18 continue
19 }
20
21 standard_testfile
22
23 if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
24 untested $testfile.exp
25 return -1
26 }
27
28 proc test_one_sig {nextsig} {
29 global sig_supported
30 global gdb_prompt
31 global thissig
32
33 set this_sig_supported $sig_supported
34 gdb_test "handle SIG$thissig stop print" \
35 "SIG$thissig\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*"
36 gdb_test "b handle_$thissig" "Breakpoint \[0-9\]+ .*"
37 gdb_test "b gen_$nextsig" "Breakpoint \[0-9\]+ .*"
38
39 set need_another_continue 1
40 set missed_handler 0
41 if $this_sig_supported then {
42 set esig $thissig
43
44 if { $thissig == "IO" } {
45 setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
46 }
47 # On Linux SPARC64 systems SIGLOST==SIGPWR and gdb identifies
48 # the raised signal as PWR.
49 if { $thissig == "LOST" && [ istarget "sparc64-*-linux*" ] } then {
50 set esig "PWR"
51 }
52
53 gdb_test "continue" \
54 "Continuing.*Program received signal SIG$esig.*" \
55 "get signal $esig"
56 }
57 if [ istarget "alpha-dec-osf3*" ] then {
58 # OSF/1-3.x is unable to continue with a job control stop signal.
59 # The inferior remains stopped without an event of interest
60 # and GDB waits forever for the inferior to stop on an event
61 # of interest. Work around the kernel bug.
62 if { $thissig == "TSTP" || $thissig == "TTIN" || $thissig == "TTOU" } {
63 setup_xfail "alpha-dec-osf3*"
64 fail "cannot continue from signal $thissig"
65 set need_another_continue 0
66 }
67 }
68
69 if $need_another_continue then {
70 if { $thissig == "URG" } {
71 setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
72 }
73 # Either Lynx or GDB screws up on SIGPRIO
74 if { $thissig == "PRIO" } {
75 setup_xfail "*-*-*lynx*"
76 }
77 gdb_test_multiple "continue" "send signal $thissig" {
78 -re "Breakpoint.*handle_$thissig.*$gdb_prompt $" {
79 pass "send signal $thissig"
80 }
81 -re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" {
82 fail "missed breakpoint at handle_$thissig"
83 set missed_handler 1
84 }
85 }
86 }
87
88 if { $missed_handler == "0" } then {
89 gdb_test_multiple "signal 0" "advance to $nextsig" {
90 -re "Breakpoint.*gen_$nextsig.*\r\n\[0-9\]+\[ \t\]+kill \\(.*\r\n$gdb_prompt $" {
91 pass "advance to $nextsig"
92 set sig_supported 1
93 }
94 -re "Breakpoint.*gen_$nextsig.*\r\n\[0-9\]+\[ \t\]+handle_.*\r\n$gdb_prompt $" {
95 pass "advance to $nextsig"
96 set sig_supported 0
97 }
98 }
99 }
100 set thissig $nextsig
101 }
102
103 # The list of signals that the program generates, in the order they
104 # are generated.
105 set signals {
106 ABRT
107 HUP
108 QUIT
109 ILL
110 EMT
111 FPE
112 BUS
113 SEGV
114 SYS
115 PIPE
116 ALRM
117 URG
118 TSTP
119 CONT
120 CHLD
121 TTIN
122 TTOU
123 IO
124 XCPU
125 XFSZ
126 VTALRM
127 PROF
128 WINCH
129 LOST
130 USR1
131 USR2
132 PWR
133 POLL
134 WIND
135 PHONE
136 WAITING
137 LWP
138 DANGER
139 GRANT
140 RETRACT
141 MSG
142 SOUND
143 SAK
144 PRIO
145 33
146 34
147 35
148 36
149 37
150 38
151 39
152 40
153 41
154 42
155 43
156 44
157 45
158 46
159 47
160 48
161 49
162 50
163 51
164 52
165 53
166 54
167 55
168 56
169 57
170 58
171 59
172 60
173 61
174 62
175 63
176 TERM
177 }
178
179 # Make the first signal SIGABRT because it is always supported.
180 set sig_supported 1
181 set thissig "ABRT"
182
183 runto gen_ABRT
184
185 foreach sig [lrange $signals 1 end] {
186 test_one_sig $sig
187 }
188
189 # The last signal (SIGTERM) gets handled slightly differently because
190 # we are not setting up for another test.
191 gdb_test "handle SIGTERM stop print" \
192 "SIGTERM\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*"
193 gdb_test "b handle_TERM" "Breakpoint \[0-9\]+ .*"
194 gdb_test "continue" \
195 "Continuing.*Program received signal SIGTERM.*" \
196 "get signal TERM"
197 gdb_test "continue" "Breakpoint.*handle_TERM.*" "send signal TERM"
198 gdb_continue_to_end "continue to sigall exit"
199
200 return 0
This page took 0.036423 seconds and 5 git commands to generate.