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