]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.reverse/sigall-precsave.exp
Replace --private with --private-headers for objdump.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.reverse / sigall-precsave.exp
CommitLineData
7b6bb8da 1# Copyright 2009, 2010, 2011 Free Software Foundation, Inc.
02506ff1
MS
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
16if [target_info exists gdb,nosignals] {
17 verbose "Skipping sigall-reverse.exp because of nosignals."
18 return
19}
20
21if ![target_info exists gdb,can_reverse] {
22 return
23}
24
25if $tracelevel then {
26 strace $tracelevel
27}
28
02506ff1
MS
29
30gdb_exit
31gdb_start
32gdb_reinitialize_dir $srcdir/$subdir
33
34set testfile sigall-reverse
35set srcfile ${testfile}.c
36set binfile ${objdir}/${subdir}/${testfile}
37if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
38 untested sigall.exp
39 return -1
40}
41
42# Make the first signal SIGABRT because it is always supported.
43set sig_supported 1
44set thissig "ABRT"
45
46proc test_one_sig {nextsig} {
47 global sig_supported
48 global gdb_prompt
49 global thissig
50
51 set this_sig_supported $sig_supported
52 gdb_test "handle SIG$thissig stop print" \
53 "SIG$thissig\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*"
54 gdb_test "b handle_$thissig" "Breakpoint \[0-9\]+ .*"
55 gdb_test "b gen_$nextsig" "Breakpoint \[0-9\]+ .*"
56
57 set need_another_continue 1
58 set missed_handler 0
59 if $this_sig_supported then {
60 if { $thissig == "IO" } {
61 setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
62 }
63 set testmsg "get signal $thissig"
64 gdb_test_multiple "continue" $testmsg {
65 -re "Program received signal SIG$thissig.*handle_$thissig.*$gdb_prompt $" {
66 fail "$testmsg (wrong location)"
67 }
68 -re "Program received signal SIG$thissig.*$gdb_prompt $" {
69 pass $testmsg
70 }
71 -re "Breakpoint.* handle_$thissig.*$gdb_prompt $" {
72 xfail $testmsg
73 set need_another_continue 0
74 }
75 }
76 }
77 if [ istarget "alpha-dec-osf3*" ] then {
78 # OSF/1-3.x is unable to continue with a job control stop signal.
79 # The inferior remains stopped without an event of interest
80 # and GDB waits forever for the inferior to stop on an event
81 # of interest. Work around the kernel bug.
82 if { $thissig == "TSTP" || $thissig == "TTIN" || $thissig == "TTOU" } {
83 setup_xfail "alpha-dec-osf3*"
84 fail "cannot continue from signal $thissig"
85 set need_another_continue 0
86 }
87 }
88
89 if $need_another_continue then {
90 if { $thissig == "URG" } {
91 setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
92 }
93 # Either Lynx or GDB screws up on SIGPRIO
94 if { $thissig == "PRIO" } {
95 setup_xfail "*-*-*lynx*"
96 }
97 set testmsg "send signal $thissig"
98 gdb_test_multiple "continue" $testmsg {
99 -re "Breakpoint.*handle_$thissig.*$gdb_prompt $" {
100 pass $testmsg
101 }
102 -re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" {
103 fail "missed breakpoint at handle_$thissig"
104 set missed_handler 1
105 }
106 }
107 }
108
109 if { $missed_handler == "0" } then {
110 set testmsg "advance to $nextsig"
111 gdb_test_multiple "signal 0" $testmsg {
112 -re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" {
113 pass $testmsg
114 set sig_supported 1
115 }
116 -re "Breakpoint.*gen_$nextsig.*handle.*$gdb_prompt $" {
117 pass $testmsg
118 set sig_supported 0
119 }
120 }
121 }
122 set thissig $nextsig
123}
124
125proc test_one_sig_reverse {prevsig} {
126 global gdb_prompt
127
128 gdb_test "reverse-continue" "Breakpoint .* handle_$prevsig.*" \
129 "reverse to handler of $prevsig"
130
131 set saw_signal 0
132 set testmsg "reverse to gen_$prevsig"
133 gdb_test_multiple "reverse-continue" $testmsg {
134 -re "Breakpoint.*handle_.*$gdb_prompt " {
135 pass "$testmsg (un-handled)"
136 }
137 -re "Program received signal SIG$prevsig.*$gdb_prompt " {
138 pass "reverse to signal event, $prevsig"
139
140 set nested_testmsg "reverse signal delivered"
141 gdb_test_multiple "frame" $nested_testmsg {
142 -re ".*handle_$prevsig.*$gdb_prompt " {
143 fail "$nested_testmsg (wrong location)"
144 }
145 -re ".*$gdb_prompt " {
146 pass $nested_testmsg
147 }
148 }
149
150 set saw_signal 1
151 send_gdb "reverse-continue\n"
152 exp_continue
153 }
154 -re "Breakpoint.*kill.*$gdb_prompt " {
155 if { $saw_signal } then {
156 pass "$testmsg (handled)"
157 } else {
158 xfail "$testmsg (handled)"
159 }
160 }
161 -re "No more reverse-execution history.*kill.*$gdb_prompt " {
162 if { $saw_signal } then {
163 pass "$testmsg (handled)"
164 } else {
165 xfail "$testmsg (handled)"
166 }
167 }
168 }
169}
170
171gdb_load $binfile
172
173runto gen_ABRT
174
175if [target_info exists gdb,use_precord] {
176 # Activate process record/replay
bcd2dc50 177 gdb_test_no_output "record" "Turn on process record"
02506ff1
MS
178}
179
180# Run until end, then save execution log.
181
182set breakloc [gdb_get_line_number "end of main" "$srcfile"]
183gdb_test "break $breakloc" \
184 "Breakpoint $decimal at .*/$srcfile, line $breakloc\." \
185 "BP at end of main"
186
187# Signal handlers must be disabled
188gdb_test "handle all nostop noprint"
189
190gdb_test "continue" "Breakpoint .* end of main .*" "run to end of main"
191
192gdb_test "record save sigall.precsave" \
193 "Saved core file sigall.precsave with execution log\." \
194 "save process recfile"
195
196gdb_test "kill" "" "Kill process, prepare to debug log file" \
197 "Kill the program being debugged\\? \\(y or n\\) " "y"
198
199gdb_test "record restore sigall.precsave" \
200 "Program terminated with signal .*" \
201 "reload precord save file"
202
203# Signal handlers must be re-enabled
204gdb_test "handle all stop print"
205
206# test signal handling
207test_one_sig HUP
208test_one_sig QUIT
209test_one_sig ILL
210test_one_sig EMT
211test_one_sig FPE
212test_one_sig BUS
213test_one_sig SEGV
214test_one_sig SYS
215test_one_sig PIPE
216test_one_sig ALRM
217test_one_sig URG
218test_one_sig TSTP
219test_one_sig CONT
220test_one_sig CHLD
221test_one_sig TTIN
222test_one_sig TTOU
223test_one_sig IO
224test_one_sig XCPU
225test_one_sig XFSZ
226test_one_sig VTALRM
227test_one_sig PROF
228test_one_sig WINCH
229test_one_sig LOST
230test_one_sig USR1
231test_one_sig USR2
232test_one_sig PWR
233test_one_sig POLL
234test_one_sig WIND
235test_one_sig PHONE
236test_one_sig WAITING
237test_one_sig LWP
238test_one_sig DANGER
239test_one_sig GRANT
240test_one_sig RETRACT
241test_one_sig MSG
242test_one_sig SOUND
243test_one_sig SAK
244test_one_sig PRIO
245test_one_sig 33
246test_one_sig 34
247test_one_sig 35
248test_one_sig 36
249test_one_sig 37
250test_one_sig 38
251test_one_sig 39
252test_one_sig 40
253test_one_sig 41
254test_one_sig 42
255test_one_sig 43
256test_one_sig 44
257test_one_sig 45
258test_one_sig 46
259test_one_sig 47
260test_one_sig 48
261test_one_sig 49
262test_one_sig 50
263test_one_sig 51
264test_one_sig 52
265test_one_sig 53
266test_one_sig 54
267test_one_sig 55
268test_one_sig 56
269test_one_sig 57
270test_one_sig 58
271test_one_sig 59
272test_one_sig 60
273test_one_sig 61
274test_one_sig 62
275test_one_sig 63
276test_one_sig TERM
277
278# The last signal (SIGTERM) gets handled slightly differently because
279# we are not setting up for another test.
280gdb_test "handle SIGTERM stop print" \
281 "SIGTERM\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*"
282gdb_test "b handle_TERM" "Breakpoint \[0-9\]+ .*"
283gdb_test "continue" \
284 "Continuing.*Program received signal SIGTERM.*" \
285 "get signal TERM"
286gdb_test "continue" "Breakpoint.*handle_TERM.*" "send signal TERM"
287
288gdb_test "continue" " end of main .*" "continue to sigall exit"
289
290test_one_sig_reverse TERM
291test_one_sig_reverse 63
292test_one_sig_reverse 62
293test_one_sig_reverse 61
294test_one_sig_reverse 60
295test_one_sig_reverse 59
296test_one_sig_reverse 58
297test_one_sig_reverse 57
298test_one_sig_reverse 56
299test_one_sig_reverse 55
300test_one_sig_reverse 54
301test_one_sig_reverse 53
302test_one_sig_reverse 52
303test_one_sig_reverse 51
304test_one_sig_reverse 50
305test_one_sig_reverse 49
306test_one_sig_reverse 48
307test_one_sig_reverse 47
308test_one_sig_reverse 46
309test_one_sig_reverse 45
310test_one_sig_reverse 44
311test_one_sig_reverse 43
312test_one_sig_reverse 42
313test_one_sig_reverse 41
314test_one_sig_reverse 40
315test_one_sig_reverse 39
316test_one_sig_reverse 38
317test_one_sig_reverse 37
318test_one_sig_reverse 36
319test_one_sig_reverse 35
320test_one_sig_reverse 34
321test_one_sig_reverse 33
322test_one_sig_reverse PRIO
323test_one_sig_reverse SAK
324test_one_sig_reverse SOUND
325test_one_sig_reverse MSG
326test_one_sig_reverse RETRACT
327test_one_sig_reverse GRANT
328test_one_sig_reverse DANGER
329test_one_sig_reverse LWP
330test_one_sig_reverse WAITING
331test_one_sig_reverse PHONE
332test_one_sig_reverse WIND
333test_one_sig_reverse POLL
334test_one_sig_reverse PWR
335test_one_sig_reverse USR2
336test_one_sig_reverse USR1
337test_one_sig_reverse LOST
338test_one_sig_reverse WINCH
339test_one_sig_reverse PROF
340test_one_sig_reverse VTALRM
341test_one_sig_reverse XFSZ
342test_one_sig_reverse XCPU
343test_one_sig_reverse IO
344test_one_sig_reverse TTOU
345test_one_sig_reverse TTIN
346test_one_sig_reverse CHLD
347test_one_sig_reverse CONT
348test_one_sig_reverse TSTP
349test_one_sig_reverse URG
350test_one_sig_reverse ALRM
351test_one_sig_reverse PIPE
352test_one_sig_reverse SYS
353test_one_sig_reverse SEGV
354test_one_sig_reverse BUS
355test_one_sig_reverse FPE
356test_one_sig_reverse EMT
357test_one_sig_reverse ILL
358test_one_sig_reverse QUIT
359test_one_sig_reverse HUP
360test_one_sig_reverse ABRT
361
362# Make the first signal SIGABRT because it is always supported.
363set sig_supported 1
364set thissig "ABRT"
365
366test_one_sig HUP
367test_one_sig QUIT
368test_one_sig ILL
369test_one_sig EMT
370test_one_sig FPE
371test_one_sig BUS
372test_one_sig SEGV
373test_one_sig SYS
374test_one_sig PIPE
375test_one_sig ALRM
376test_one_sig URG
377test_one_sig TSTP
378test_one_sig CONT
379test_one_sig CHLD
380test_one_sig TTIN
381test_one_sig TTOU
382test_one_sig IO
383test_one_sig XCPU
384test_one_sig XFSZ
385test_one_sig VTALRM
386test_one_sig PROF
387test_one_sig WINCH
388test_one_sig LOST
389test_one_sig USR1
390test_one_sig USR2
391test_one_sig PWR
392test_one_sig POLL
393test_one_sig WIND
394test_one_sig PHONE
395test_one_sig WAITING
396test_one_sig LWP
397test_one_sig DANGER
398test_one_sig GRANT
399test_one_sig RETRACT
400test_one_sig MSG
401test_one_sig SOUND
402test_one_sig SAK
403test_one_sig PRIO
404test_one_sig 33
405test_one_sig 34
406test_one_sig 35
407test_one_sig 36
408test_one_sig 37
409test_one_sig 38
410test_one_sig 39
411test_one_sig 40
412test_one_sig 41
413test_one_sig 42
414test_one_sig 43
415test_one_sig 44
416test_one_sig 45
417test_one_sig 46
418test_one_sig 47
419test_one_sig 48
420test_one_sig 49
421test_one_sig 50
422test_one_sig 51
423test_one_sig 52
424test_one_sig 53
425test_one_sig 54
426test_one_sig 55
427test_one_sig 56
428test_one_sig 57
429test_one_sig 58
430test_one_sig 59
431test_one_sig 60
432test_one_sig 61
433test_one_sig 62
434test_one_sig 63
435test_one_sig TERM