Commit | Line | Data |
---|---|---|
7b6bb8da | 1 | # Copyright 1995, 1996, 1997, 1999, 2007, 2008, 2009, 2010, 2011 |
9b254dd1 | 2 | # Free Software Foundation, Inc. |
c906108c SS |
3 | |
4 | # This program is free software; you can redistribute it and/or modify | |
5 | # it under the terms of the GNU General Public License as published by | |
e22f8b7c | 6 | # the Free Software Foundation; either version 3 of the License, or |
c906108c | 7 | # (at your option) any later version. |
e22f8b7c | 8 | # |
c906108c SS |
9 | # This program is distributed in the hope that it will be useful, |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. | |
e22f8b7c | 13 | # |
c906108c | 14 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
c906108c SS |
16 | |
17 | if [target_info exists gdb,nosignals] { | |
18 | verbose "Skipping sigall.exp because of nosignals." | |
19 | continue | |
20 | } | |
21 | ||
22 | if $tracelevel then { | |
23 | strace $tracelevel | |
24 | } | |
25 | ||
c906108c SS |
26 | |
27 | gdb_exit | |
28 | gdb_start | |
29 | gdb_reinitialize_dir $srcdir/$subdir | |
30 | ||
31 | set testfile sigall | |
32 | set srcfile ${testfile}.c | |
33 | set binfile ${objdir}/${subdir}/${testfile} | |
34 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { | |
b60f0898 JB |
35 | untested sigall.exp |
36 | return -1 | |
c906108c SS |
37 | } |
38 | ||
39 | # Make the first signal SIGABRT because it is always supported. | |
40 | set sig_supported 1 | |
41 | set thissig "ABRT" | |
42 | ||
43 | proc test_one_sig {nextsig} { | |
44 | global sig_supported | |
45 | global gdb_prompt | |
46 | global thissig | |
47 | ||
48 | set this_sig_supported $sig_supported | |
49 | gdb_test "handle SIG$thissig stop print" \ | |
50 | "SIG$thissig\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*" | |
51 | gdb_test "b handle_$thissig" "Breakpoint \[0-9\]+ .*" | |
52 | gdb_test "b gen_$nextsig" "Breakpoint \[0-9\]+ .*" | |
53 | ||
54 | set need_another_continue 1 | |
55 | set missed_handler 0 | |
56 | if $this_sig_supported then { | |
c906108c SS |
57 | if { $thissig == "IO" } { |
58 | setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu" | |
59 | } | |
02746bbc MS |
60 | gdb_test "continue" \ |
61 | "Continuing.*Program received signal SIG$thissig.*" \ | |
62 | "get signal $thissig" | |
c906108c SS |
63 | } |
64 | if [ istarget "alpha-dec-osf3*" ] then { | |
65 | # OSF/1-3.x is unable to continue with a job control stop signal. | |
66 | # The inferior remains stopped without an event of interest | |
67 | # and GDB waits forever for the inferior to stop on an event | |
68 | # of interest. Work around the kernel bug. | |
69 | if { $thissig == "TSTP" || $thissig == "TTIN" || $thissig == "TTOU" } { | |
70 | setup_xfail "alpha-dec-osf3*" | |
71 | fail "cannot continue from signal $thissig" | |
72 | set need_another_continue 0 | |
73 | } | |
74 | } | |
75 | ||
76 | if $need_another_continue then { | |
c906108c SS |
77 | if { $thissig == "URG" } { |
78 | setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu" | |
79 | } | |
80 | # Either Lynx or GDB screws up on SIGPRIO | |
81 | if { $thissig == "PRIO" } { | |
82 | setup_xfail "*-*-*lynx*" | |
83 | } | |
02746bbc | 84 | gdb_test_multiple "continue" "send signal $thissig" { |
c906108c SS |
85 | -re "Breakpoint.*handle_$thissig.*$gdb_prompt $" { |
86 | pass "send signal $thissig" | |
87 | } | |
88 | -re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" { | |
89 | fail "missed breakpoint at handle_$thissig" | |
90 | set missed_handler 1 | |
91 | } | |
92 | } | |
93 | } | |
94 | ||
95 | if { $missed_handler == "0" } then { | |
02746bbc | 96 | gdb_test_multiple "signal 0" "advance to $nextsig" { |
dbd492a3 | 97 | -re "Breakpoint.*gen_$nextsig.*\r\n\[0-9\]+\[ \t\]+kill \\(.*\r\n$gdb_prompt $" { |
c906108c SS |
98 | pass "advance to $nextsig" |
99 | set sig_supported 1 | |
100 | } | |
dbd492a3 | 101 | -re "Breakpoint.*gen_$nextsig.*\r\n\[0-9\]+\[ \t\]+handle_.*\r\n$gdb_prompt $" { |
c906108c SS |
102 | pass "advance to $nextsig" |
103 | set sig_supported 0 | |
104 | } | |
c906108c SS |
105 | } |
106 | } | |
107 | set thissig $nextsig | |
108 | } | |
109 | ||
110 | gdb_load $binfile | |
111 | ||
112 | runto gen_ABRT | |
113 | test_one_sig HUP | |
114 | test_one_sig QUIT | |
115 | test_one_sig ILL | |
116 | test_one_sig EMT | |
117 | test_one_sig FPE | |
118 | test_one_sig BUS | |
119 | test_one_sig SEGV | |
120 | test_one_sig SYS | |
121 | test_one_sig PIPE | |
122 | test_one_sig ALRM | |
123 | test_one_sig URG | |
124 | test_one_sig TSTP | |
125 | test_one_sig CONT | |
126 | test_one_sig CHLD | |
127 | test_one_sig TTIN | |
128 | test_one_sig TTOU | |
129 | test_one_sig IO | |
130 | test_one_sig XCPU | |
131 | test_one_sig XFSZ | |
132 | test_one_sig VTALRM | |
133 | test_one_sig PROF | |
134 | test_one_sig WINCH | |
135 | test_one_sig LOST | |
136 | test_one_sig USR1 | |
137 | test_one_sig USR2 | |
138 | test_one_sig PWR | |
139 | test_one_sig POLL | |
140 | test_one_sig WIND | |
141 | test_one_sig PHONE | |
142 | test_one_sig WAITING | |
143 | test_one_sig LWP | |
144 | test_one_sig DANGER | |
145 | test_one_sig GRANT | |
146 | test_one_sig RETRACT | |
147 | test_one_sig MSG | |
148 | test_one_sig SOUND | |
149 | test_one_sig SAK | |
150 | test_one_sig PRIO | |
151 | test_one_sig 33 | |
152 | test_one_sig 34 | |
153 | test_one_sig 35 | |
154 | test_one_sig 36 | |
155 | test_one_sig 37 | |
156 | test_one_sig 38 | |
157 | test_one_sig 39 | |
158 | test_one_sig 40 | |
159 | test_one_sig 41 | |
160 | test_one_sig 42 | |
161 | test_one_sig 43 | |
162 | test_one_sig 44 | |
163 | test_one_sig 45 | |
164 | test_one_sig 46 | |
165 | test_one_sig 47 | |
166 | test_one_sig 48 | |
167 | test_one_sig 49 | |
168 | test_one_sig 50 | |
169 | test_one_sig 51 | |
170 | test_one_sig 52 | |
171 | test_one_sig 53 | |
172 | test_one_sig 54 | |
173 | test_one_sig 55 | |
174 | test_one_sig 56 | |
175 | test_one_sig 57 | |
176 | test_one_sig 58 | |
177 | test_one_sig 59 | |
178 | test_one_sig 60 | |
179 | test_one_sig 61 | |
180 | test_one_sig 62 | |
181 | test_one_sig 63 | |
182 | test_one_sig TERM | |
183 | ||
184 | # The last signal (SIGTERM) gets handled slightly differently because | |
185 | # we are not setting up for another test. | |
186 | gdb_test "handle SIGTERM stop print" \ | |
187 | "SIGTERM\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*" | |
188 | gdb_test "b handle_TERM" "Breakpoint \[0-9\]+ .*" | |
189 | gdb_test "continue" \ | |
190 | "Continuing.*Program received signal SIGTERM.*" \ | |
191 | "get signal TERM" | |
192 | gdb_test "continue" "Breakpoint.*handle_TERM.*" "send signal TERM" | |
7a292a7a | 193 | gdb_continue_to_end "continue to sigall exit" |
c906108c SS |
194 | |
195 | return 0 |