Update copyright year in gdb/gdbserver/gdbreplay version output.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / sigall.exp
CommitLineData
0b302171 1# Copyright 1995-1997, 1999, 2007-2012 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
c906108c
SS
21
22gdb_exit
23gdb_start
24gdb_reinitialize_dir $srcdir/$subdir
25
26set testfile sigall
27set srcfile ${testfile}.c
28set binfile ${objdir}/${subdir}/${testfile}
29if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
b60f0898
JB
30 untested sigall.exp
31 return -1
c906108c
SS
32}
33
c906108c
SS
34proc test_one_sig {nextsig} {
35 global sig_supported
36 global gdb_prompt
37 global thissig
38
39 set this_sig_supported $sig_supported
40 gdb_test "handle SIG$thissig stop print" \
41 "SIG$thissig\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*"
42 gdb_test "b handle_$thissig" "Breakpoint \[0-9\]+ .*"
43 gdb_test "b gen_$nextsig" "Breakpoint \[0-9\]+ .*"
44
45 set need_another_continue 1
46 set missed_handler 0
47 if $this_sig_supported then {
c906108c
SS
48 if { $thissig == "IO" } {
49 setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
50 }
02746bbc
MS
51 gdb_test "continue" \
52 "Continuing.*Program received signal SIG$thissig.*" \
53 "get signal $thissig"
c906108c
SS
54 }
55 if [ istarget "alpha-dec-osf3*" ] then {
56 # OSF/1-3.x is unable to continue with a job control stop signal.
57 # The inferior remains stopped without an event of interest
58 # and GDB waits forever for the inferior to stop on an event
59 # of interest. Work around the kernel bug.
60 if { $thissig == "TSTP" || $thissig == "TTIN" || $thissig == "TTOU" } {
61 setup_xfail "alpha-dec-osf3*"
62 fail "cannot continue from signal $thissig"
63 set need_another_continue 0
64 }
65 }
66
67 if $need_another_continue then {
c906108c
SS
68 if { $thissig == "URG" } {
69 setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
70 }
71 # Either Lynx or GDB screws up on SIGPRIO
72 if { $thissig == "PRIO" } {
73 setup_xfail "*-*-*lynx*"
74 }
02746bbc 75 gdb_test_multiple "continue" "send signal $thissig" {
c906108c
SS
76 -re "Breakpoint.*handle_$thissig.*$gdb_prompt $" {
77 pass "send signal $thissig"
78 }
79 -re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" {
80 fail "missed breakpoint at handle_$thissig"
81 set missed_handler 1
82 }
83 }
84 }
85
86 if { $missed_handler == "0" } then {
02746bbc 87 gdb_test_multiple "signal 0" "advance to $nextsig" {
dbd492a3 88 -re "Breakpoint.*gen_$nextsig.*\r\n\[0-9\]+\[ \t\]+kill \\(.*\r\n$gdb_prompt $" {
c906108c
SS
89 pass "advance to $nextsig"
90 set sig_supported 1
91 }
dbd492a3 92 -re "Breakpoint.*gen_$nextsig.*\r\n\[0-9\]+\[ \t\]+handle_.*\r\n$gdb_prompt $" {
c906108c
SS
93 pass "advance to $nextsig"
94 set sig_supported 0
95 }
c906108c
SS
96 }
97 }
98 set thissig $nextsig
99}
100
101gdb_load $binfile
102
b1e0c0fa
PA
103# The list of signals that the program generates, in the order they
104# are generated.
105set 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.
180set sig_supported 1
181set thissig "ABRT"
182
c906108c 183runto gen_ABRT
b1e0c0fa 184
13e4e967 185foreach sig [lrange $signals 1 end] {
b1e0c0fa
PA
186 test_one_sig $sig
187}
c906108c
SS
188
189# The last signal (SIGTERM) gets handled slightly differently because
190# we are not setting up for another test.
191gdb_test "handle SIGTERM stop print" \
192 "SIGTERM\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*"
193gdb_test "b handle_TERM" "Breakpoint \[0-9\]+ .*"
194gdb_test "continue" \
195 "Continuing.*Program received signal SIGTERM.*" \
196 "get signal TERM"
197gdb_test "continue" "Breakpoint.*handle_TERM.*" "send signal TERM"
7a292a7a 198gdb_continue_to_end "continue to sigall exit"
c906108c
SS
199
200return 0
This page took 1.263693 seconds and 4 git commands to generate.