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