binutils-gdb/gdb/testsuite/gdb.reverse/sigall-precsave.exp

319 lines
7.2 KiB
Plaintext
Raw Normal View History

# Copyright 2009-2018 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if [target_info exists gdb,nosignals] {
verbose "Skipping sigall-precsave.exp because of nosignals."
return
}
if ![supports_reverse] {
return
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
* gdb.reverse/break-precsave.exp: Use standard_testfile. * gdb.reverse/break-reverse.exp: Use standard_testfile. * gdb.reverse/consecutive-precsave.exp: Use standard_testfile. * gdb.reverse/consecutive-reverse.exp: Use standard_testfile. * gdb.reverse/finish-precsave.exp: Use standard_testfile. * gdb.reverse/finish-reverse-bkpt.exp: Use standard_testfile. * gdb.reverse/finish-reverse.exp: Use standard_testfile. * gdb.reverse/i386-precsave.exp: Use standard_testfile, prepare_for_testing. * gdb.reverse/i386-reverse.exp: Use standard_testfile, prepare_for_testing. * gdb.reverse/i386-sse-reverse.exp: Use standard_testfile, prepare_for_testing. * gdb.reverse/i387-env-reverse.exp: Use standard_testfile, prepare_for_testing. * gdb.reverse/i387-stack-reverse.exp: Use standard_testfile, prepare_for_testing * gdb.reverse/machinestate-precsave.exp: Use standard_testfile. * gdb.reverse/machinestate.exp: Use standard_testfile. * gdb.reverse/next-reverse-bkpt-over-sr.exp: Use standard_testfile. * gdb.reverse/sigall-precsave.exp: Use standard_testfile, build_executable. * gdb.reverse/sigall-reverse.exp: Use standard_testfile, build_executable. * gdb.reverse/solib-precsave.exp: Use standard_testfile, standard_output_file. * gdb.reverse/solib-reverse.exp: Use standard_testfile, standard_output_file. * gdb.reverse/step-precsave.exp: Use standard_testfile. * gdb.reverse/step-reverse.exp: Use standard_testfile. * gdb.reverse/until-precsave.exp: Use standard_testfile. * gdb.reverse/until-reverse.exp: Use standard_testfile. * gdb.reverse/watch-precsave.exp: Use standard_testfile. * gdb.reverse/watch-reverse.exp: Use standard_testfile.
2012-06-26 19:54:59 +02:00
standard_testfile sigall-reverse.c
set precsave [standard_output_file sigall.precsave]
* gdb.reverse/break-precsave.exp: Use standard_testfile. * gdb.reverse/break-reverse.exp: Use standard_testfile. * gdb.reverse/consecutive-precsave.exp: Use standard_testfile. * gdb.reverse/consecutive-reverse.exp: Use standard_testfile. * gdb.reverse/finish-precsave.exp: Use standard_testfile. * gdb.reverse/finish-reverse-bkpt.exp: Use standard_testfile. * gdb.reverse/finish-reverse.exp: Use standard_testfile. * gdb.reverse/i386-precsave.exp: Use standard_testfile, prepare_for_testing. * gdb.reverse/i386-reverse.exp: Use standard_testfile, prepare_for_testing. * gdb.reverse/i386-sse-reverse.exp: Use standard_testfile, prepare_for_testing. * gdb.reverse/i387-env-reverse.exp: Use standard_testfile, prepare_for_testing. * gdb.reverse/i387-stack-reverse.exp: Use standard_testfile, prepare_for_testing * gdb.reverse/machinestate-precsave.exp: Use standard_testfile. * gdb.reverse/machinestate.exp: Use standard_testfile. * gdb.reverse/next-reverse-bkpt-over-sr.exp: Use standard_testfile. * gdb.reverse/sigall-precsave.exp: Use standard_testfile, build_executable. * gdb.reverse/sigall-reverse.exp: Use standard_testfile, build_executable. * gdb.reverse/solib-precsave.exp: Use standard_testfile, standard_output_file. * gdb.reverse/solib-reverse.exp: Use standard_testfile, standard_output_file. * gdb.reverse/step-precsave.exp: Use standard_testfile. * gdb.reverse/step-reverse.exp: Use standard_testfile. * gdb.reverse/until-precsave.exp: Use standard_testfile. * gdb.reverse/until-reverse.exp: Use standard_testfile. * gdb.reverse/watch-precsave.exp: Use standard_testfile. * gdb.reverse/watch-reverse.exp: Use standard_testfile.
2012-06-26 19:54:59 +02:00
if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} {
return -1
}
proc test_one_sig {nextsig} {
global sig_supported
global gdb_prompt
global thissig
set this_sig_supported $sig_supported
gdb_test "handle SIG$thissig stop print" \
"SIG$thissig\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*"
gdb_test "b handle_$thissig" "Breakpoint \[0-9\]+ .*"
gdb_test "b gen_$nextsig" "Breakpoint \[0-9\]+ .*"
set need_another_continue 1
set missed_handler 0
if $this_sig_supported then {
if { $thissig == "IO" } {
setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
}
set testmsg "get signal $thissig"
gdb_test_multiple "continue" $testmsg {
-re "Program received signal SIG$thissig.*handle_$thissig.*$gdb_prompt $" {
fail "$testmsg (wrong location)"
}
-re "Program received signal SIG$thissig.*$gdb_prompt $" {
pass $testmsg
}
-re "Breakpoint.* handle_$thissig.*$gdb_prompt $" {
xfail $testmsg
set need_another_continue 0
}
}
}
if $need_another_continue then {
if { $thissig == "URG" } {
setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
}
# Either Lynx or GDB screws up on SIGPRIO
if { $thissig == "PRIO" } {
setup_xfail "*-*-*lynx*"
}
set testmsg "send signal $thissig"
gdb_test_multiple "continue" $testmsg {
-re "Breakpoint.*handle_$thissig.*$gdb_prompt $" {
pass $testmsg
}
-re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" {
fail "missed breakpoint at handle_$thissig"
set missed_handler 1
}
}
}
if { $missed_handler == "0" } then {
set testmsg "advance to $nextsig"
gdb_test_multiple "signal 0" $testmsg {
-re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" {
pass $testmsg
set sig_supported 1
}
-re "Breakpoint.*gen_$nextsig.*handle.*$gdb_prompt $" {
pass $testmsg
set sig_supported 0
}
}
}
set thissig $nextsig
}
proc test_one_sig_reverse {prevsig} {
global gdb_prompt
gdb_test "reverse-continue" "Breakpoint .* handle_$prevsig.*" \
"reverse to handler of $prevsig"
set saw_signal 0
set testmsg "reverse to gen_$prevsig"
gdb_test_multiple "reverse-continue" $testmsg {
-re "Breakpoint.*handle_.*$gdb_prompt " {
pass "$testmsg (un-handled)"
}
-re "Program received signal SIG$prevsig.*$gdb_prompt " {
pass "reverse to signal event, $prevsig"
set nested_testmsg "reverse signal delivered"
gdb_test_multiple "frame" $nested_testmsg {
-re ".*handle_$prevsig.*$gdb_prompt " {
fail "$nested_testmsg (wrong location)"
}
-re ".*$gdb_prompt " {
pass $nested_testmsg
}
}
set saw_signal 1
send_gdb "reverse-continue\n"
exp_continue
}
-re "Breakpoint.*kill.*$gdb_prompt " {
if { $saw_signal } then {
pass "$testmsg (handled)"
} else {
xfail "$testmsg (handled)"
}
}
-re "No more reverse-execution history.*kill.*$gdb_prompt " {
if { $saw_signal } then {
pass "$testmsg (handled)"
} else {
xfail "$testmsg (handled)"
}
}
}
}
gdb_load $binfile
runto gen_ABRT
if [supports_process_record] {
# Activate process record/replay
Fix test names starting with uppercase using gdb_test_no_output This fixes offender testcases that have test names starting with uppercase when using gdb_test_no_output in a single-line construct. gdb/testsuite/ChangeLog 2016-12-01 Luis Machado <lgustavo@codesourcery.com> Fix test names starting with uppercase throughout the files. * gdb.base/charset.exp * gdb.base/eval.exp * gdb.base/multi-forks.exp * gdb.guile/scm-progspace.exp * gdb.opencl/datatypes.exp * gdb.python/py-block.exp * gdb.python/py-function.exp * gdb.python/py-symbol.exp * gdb.python/py-symtab.exp * gdb.python/py-xmethods.exp * gdb.reverse/break-precsave.exp * gdb.reverse/break-reverse.exp * gdb.reverse/consecutive-precsave.exp * gdb.reverse/consecutive-reverse.exp * gdb.reverse/finish-precsave.exp * gdb.reverse/finish-reverse-bkpt.exp * gdb.reverse/finish-reverse.exp * gdb.reverse/fstatat-reverse.exp * gdb.reverse/getresuid-reverse.exp * gdb.reverse/i386-precsave.exp * gdb.reverse/i386-reverse.exp * gdb.reverse/i386-sse-reverse.exp * gdb.reverse/i387-stack-reverse.exp * gdb.reverse/insn-reverse.exp * gdb.reverse/machinestate-precsave.exp * gdb.reverse/machinestate.exp * gdb.reverse/next-reverse-bkpt-over-sr.exp * gdb.reverse/pipe-reverse.exp * gdb.reverse/readv-reverse.exp * gdb.reverse/recvmsg-reverse.exp * gdb.reverse/rerun-prec.exp * gdb.reverse/s390-mvcle.exp * gdb.reverse/sigall-precsave.exp * gdb.reverse/sigall-reverse.exp * gdb.reverse/solib-precsave.exp * gdb.reverse/solib-reverse.exp * gdb.reverse/step-precsave.exp * gdb.reverse/step-reverse.exp * gdb.reverse/time-reverse.exp * gdb.reverse/until-precsave.exp * gdb.reverse/until-reverse.exp * gdb.reverse/waitpid-reverse.exp * gdb.reverse/watch-precsave.exp * gdb.reverse/watch-reverse.exp
2016-12-01 21:42:48 +01:00
gdb_test_no_output "record" "turn on process record"
}
# Run until end, then save execution log.
set breakloc [gdb_get_line_number "end of main" "$srcfile"]
gdb_test "break $breakloc" \
Fix mingw32 failures due to incorrect directory separator in pattern Some testcases, mostly gdb.reverse ones, assume the presence of a '/' directory separator before the source file name. This is incorrect for mingw32 hosts, generating false failures for those tests. I attempted to catch most of the occurrences of the pattern ".*/$srcfile" and replaced them with ".*$srcfile". The latter is used elsewhere in the testsuite. The resulting patch is attached. I also see other occurrences of the same assumption throughout the testsuite, but usually they are arguments for function calls and i seem to recall either the test harness or GDB deals with those paths properly. gdb/testsuite: 2014-10-17 Luis Machado <lgustavo@codesourcery.com> * gdb.guile/scm-breakpoint.exp: Do not assume any directory separators when matching source file paths. * gdb.python/py-breakpoint.exp: Likewise. * gdb.reverse/break-precsave.exp: Likewise. * gdb.reverse/break-reverse.exp: Likewise. * gdb.reverse/consecutive-precsave.exp: Likewise. * gdb.reverse/finish-precsave.exp: Likewise. * gdb.reverse/finish-reverse-bkpt.exp: Likewise. * gdb.reverse/finish-reverse.exp: Likewise. * gdb.reverse/i386-precsave.exp: Likewise. * gdb.reverse/i387-env-reverse.exp: Likewise. * gdb.reverse/i387-stack-reverse.exp: Likewise. * gdb.reverse/machinestate-precsave.exp: Likewise. * gdb.reverse/machinestate.exp: Likewise. * gdb.reverse/sigall-precsave.exp: Likewise. * gdb.reverse/solib-precsave.exp: Likewise. * gdb.reverse/step-precsave.exp: Likewise. * gdb.reverse/until-precsave.exp: Likewise. * gdb.reverse/watch-precsave.exp: Likewise. * gdb.reverse/watch-reverse.exp: Likewise.
2014-10-17 16:28:17 +02:00
"Breakpoint $decimal at .*$srcfile, line $breakloc\." \
Fix test names starting with uppercase using multi-line gdb_test/mi_gdb_test This fixes offender testcases that have test names starting with uppercase when using gdb_test/mi_gdb_test in a multi-line construct. gdb/testsuite/ChangeLog 2016-12-01 Luis Machado <lgustavo@codesourcery.com> Fix test names starting with uppercase throughout the files. * gdb.ada/array_return.exp * gdb.ada/expr_delims.exp * gdb.ada/mi_dyn_arr.exp * gdb.ada/mi_interface.exp * gdb.ada/mi_var_array.exp * gdb.ada/watch_arg.exp * gdb.arch/alpha-step.exp * gdb.arch/altivec-regs.exp * gdb.arch/e500-regs.exp * gdb.arch/powerpc-d128-regs.exp * gdb.base/arrayidx.exp * gdb.base/break.exp * gdb.base/checkpoint.exp * gdb.base/debug-expr.exp * gdb.base/dmsym.exp * gdb.base/radix.exp * gdb.base/sepdebug.exp * gdb.base/testenv.exp * gdb.base/watch_thread_num.exp * gdb.base/watchpoint-cond-gone.exp * gdb.cell/break.exp * gdb.cell/ea-cache.exp * gdb.compile/compile.exp * gdb.cp/gdb2495.exp * gdb.gdb/selftest.exp * gdb.gdb/xfullpath.exp * gdb.go/hello.exp * gdb.go/integers.exp * gdb.objc/basicclass.exp * gdb.pascal/hello.exp * gdb.pascal/integers.exp * gdb.python/py-breakpoint.exp * gdb.python/py-cmd.exp * gdb.python/py-linetable.exp * gdb.python/py-xmethods.exp * gdb.python/python.exp * gdb.reverse/consecutive-precsave.exp * gdb.reverse/finish-precsave.exp * gdb.reverse/i386-precsave.exp * gdb.reverse/machinestate-precsave.exp * gdb.reverse/sigall-precsave.exp * gdb.reverse/solib-precsave.exp * gdb.reverse/step-precsave.exp * gdb.reverse/until-precsave.exp * gdb.reverse/watch-precsave.exp * gdb.threads/leader-exit.exp * gdb.threads/pthreads.exp * gdb.threads/wp-replication.exp * gdb.trace/actions.exp * gdb.trace/mi-tsv-changed.exp * gdb.trace/tsv.exp
2016-12-01 21:44:38 +01:00
"breakpoint at end of main"
# Signal handlers must be disabled
gdb_test "handle all nostop noprint"
# The list of signals that the program generates, in the order they
# are generated.
set signals {
ABRT
HUP
QUIT
ILL
EMT
FPE
BUS
SEGV
SYS
PIPE
ALRM
URG
TSTP
CONT
CHLD
TTIN
TTOU
IO
XCPU
XFSZ
VTALRM
PROF
WINCH
LOST
USR1
USR2
PWR
POLL
WIND
PHONE
WAITING
LWP
DANGER
GRANT
RETRACT
MSG
SOUND
SAK
PRIO
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
TERM
}
# Software single-step targets can't step into signal handlers. Since
# later, when replaying the execution log, the test wants to set
# breakpoints on handlers, we need to make sure that while recording,
# GDB steps through the handlers too, so that the execution log covers
# them. Setting breakpoints in all handlers takes care of it. This
# is harmless for hardware-step targets.
foreach sig $signals {
set test "break *handle_$sig"
gdb_test_multiple $test $test {
-re "Breakpoint .*$gdb_prompt $" {
# No need to record a pass for each breakpoint.
}
}
}
gdb_test_multiple "continue" "continue" {
-re "Breakpoint .* end of main .*$gdb_prompt $" {
pass "run to end of main"
}
-re "Breakpoint .* handle_.*$gdb_prompt $" {
send_gdb "continue\n"
exp_continue
}
}
delete_breakpoints
gdb_test "record save $precsave" \
"Saved core file $precsave with execution log\." \
"save process recfile"
Fix test names starting with uppercase using gdb_test on a single line. Changes in v3: Fixed incorrect substitutions. This fixes offender testcases that have test names starting with uppercase when using gdb_test in a single line construct. gdb/testsuite/ChangeLog 2016-12-01 Luis Machado <lgustavo@codesourcery.com> Fix test names starting with uppercase throughout the files. * gdb.arch/i386-mpx-simple_segv.exp * gdb.arch/i386-mpx.exp * gdb.arch/i386-permbkpt.exp * gdb.arch/pa-nullify.exp * gdb.arch/powerpc-d128-regs.exp * gdb.arch/vsx-regs.exp * gdb.base/bfp-test.exp * gdb.base/break.exp * gdb.base/breakpoint-shadow.exp * gdb.base/callfuncs.exp * gdb.base/charset.exp * gdb.base/commands.exp * gdb.base/completion.exp * gdb.base/dfp-test.exp * gdb.base/echo.exp * gdb.base/ending-run.exp * gdb.base/eval.exp * gdb.base/expand-psymtabs.exp * gdb.base/float128.exp * gdb.base/floatn.exp * gdb.base/foll-exec-mode.exp * gdb.base/gdb1056.exp * gdb.base/gdb11531.exp * gdb.base/kill-after-signal.exp * gdb.base/multi-forks.exp * gdb.base/overlays.exp * gdb.base/pending.exp * gdb.base/sepdebug.exp * gdb.base/testenv.exp * gdb.base/valgrind-db-attach.exp * gdb.base/watch_thread_num.exp * gdb.base/watchpoint-cond-gone.exp * gdb.base/watchpoint.exp * gdb.base/watchpoints.exp * gdb.cp/arg-reference.exp * gdb.cp/baseenum.exp * gdb.cp/operator.exp * gdb.cp/shadow.exp * gdb.dwarf2/dw2-op-out-param.exp * gdb.dwarf2/dw2-reg-undefined.exp * gdb.go/chan.exp * gdb.go/hello.exp * gdb.go/integers.exp * gdb.go/methods.exp * gdb.go/package.exp * gdb.guile/scm-parameter.exp * gdb.guile/scm-progspace.exp * gdb.guile/scm-value.exp * gdb.mi/mi-pending.exp * gdb.mi/user-selected-context-sync.exp * gdb.multi/multi-attach.exp * gdb.multi/tids.exp * gdb.opt/clobbered-registers-O2.exp * gdb.pascal/floats.exp * gdb.pascal/integers.exp * gdb.python/py-block.exp * gdb.python/py-events.exp * gdb.python/py-parameter.exp * gdb.python/py-symbol.exp * gdb.python/py-symtab.exp * gdb.python/py-type.exp * gdb.python/py-value.exp * gdb.python/py-xmethods.exp * gdb.python/python.exp * gdb.reverse/break-precsave.exp * gdb.reverse/consecutive-precsave.exp * gdb.reverse/finish-precsave.exp * gdb.reverse/i386-precsave.exp * gdb.reverse/machinestate-precsave.exp * gdb.reverse/sigall-precsave.exp * gdb.reverse/solib-precsave.exp * gdb.reverse/step-precsave.exp * gdb.reverse/until-precsave.exp * gdb.reverse/watch-precsave.exp * gdb.server/ext-attach.exp * gdb.server/ext-restart.exp * gdb.server/ext-run.exp * gdb.server/ext-wrapper.exp * gdb.stabs/gdb11479.exp * gdb.stabs/weird.exp * gdb.threads/attach-many-short-lived-threads.exp * gdb.threads/kill.exp * gdb.threads/watchpoint-fork.exp
2016-12-01 21:41:23 +01:00
gdb_test "kill" "" "kill process, prepare to debug log file" \
"Kill the program being debugged\\? \\(y or n\\) " "y"
gdb_test "record restore $precsave" \
I caught a few mingw32-specific failures for some of the gdb.reverse tests. FAIL: gdb.reverse/consecutive-precsave.exp: reload precord save file FAIL: gdb.reverse/finish-precsave.exp: reload precord save file FAIL: gdb.reverse/until-precsave.exp: reload core file FAIL: gdb.reverse/watch-precsave.exp: reload core file FAIL: gdb.reverse/step-precsave.exp: reload core file FAIL: gdb.reverse/break-precsave.exp: reload precord save file FAIL: gdb.reverse/sigall-precsave.exp: reload precord save file They happen for two reasons. - mingw32 does not define SIGTRAP, so upon recording a core file, the signal information will be missing, which in turn causes GDB to not display the stopping signal when it loads the same core file. An earlier message warns about this: "warning: Signal SIGTRAP does not exist on this system." - The testcase is crafted in a way that expects a pattern of the stopping signal message instead of a successful core file read message. The following patch fixes this by changing the old pattern to a more reasonable one, while still ignoring the fact that mingw32-based GDB does not record a SIGTRAP in a core file because it does not define it. gdb/testsuite/ 2014-11-18 Luis Machado <lgustavo@codesourcery.com> * gdb.reverse/break-precsave: Expect completion message for core file reads. * gdb.reverse/consecutive-precsave.exp: Likewise. * gdb.reverse/finish-precsave.exp: Likewise. * gdb.reverse/i386-precsave.exp: Likewise. * gdb.reverse/machinestate-precsave.exp: Likewise. * gdb.reverse/sigall-precsave.exp: Likewise. * gdb.reverse/solib-precsave.exp: Likewise. * gdb.reverse/step-precsave.exp: Likewise. * gdb.reverse/until-precsave.exp: Likewise. * gdb.reverse/watch-precsave.exp: Likewise.
2014-11-18 14:16:37 +01:00
"Restored records from core file .*" \
"reload precord save file"
# Signal handlers must be re-enabled
gdb_test "handle all stop print"
# Make the first signal SIGABRT because it is always supported.
set sig_supported 1
set thissig "ABRT"
# test signal handling
foreach sig [lrange $signals 1 end] {
test_one_sig $sig
}
# The last signal (SIGTERM) gets handled slightly differently because
# we are not setting up for another test.
gdb_test "handle SIGTERM stop print" \
"SIGTERM\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*"
gdb_test "b handle_TERM" "Breakpoint \[0-9\]+ .*"
gdb_test "continue" \
"Continuing.*Program received signal SIGTERM.*" \
"get signal TERM"
gdb_test "continue" "Breakpoint.*handle_TERM.*" "send signal TERM"
gdb_test "continue" " end of main .*" "continue to sigall exit"
foreach sig [lreverse $signals] {
test_one_sig_reverse $sig
}
# Make the first signal SIGABRT because it is always supported.
set sig_supported 1
set thissig "ABRT"
foreach sig [lrange $signals 1 end] {
test_one_sig $sig
}