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