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