summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/interrupt.exp
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2009-01-20 15:33:14 +0000
committerDaniel Jacobowitz <drow@false.org>2009-01-20 15:33:14 +0000
commita12cc160ab21c29ef00ab4e2377e01ae85b9de35 (patch)
tree45b01b887cd8f98b667a2efc7e5defa8452fb2a4 /gdb/testsuite/gdb.base/interrupt.exp
parent6f3b91a62110eaea42cd7df18d6f9293f5d60fa2 (diff)
downloadbinutils-gdb-a12cc160ab21c29ef00ab4e2377e01ae85b9de35.tar.gz
PR gdb/9346
* infcmd.c (signal_command): Do not specify a resume PC. testsuite/ PR gdb/9346 * gdb.base/interrupt.c (sigint_handler): New. (main): Install a SIGINT handler if SIGNALS is defined. Exit on error. * gdb.base/interrupt.exp: Define SIGNALS unless gdb,nosignals. Test "signal SIGINT".
Diffstat (limited to 'gdb/testsuite/gdb.base/interrupt.exp')
-rw-r--r--gdb/testsuite/gdb.base/interrupt.exp38
1 files changed, 36 insertions, 2 deletions
diff --git a/gdb/testsuite/gdb.base/interrupt.exp b/gdb/testsuite/gdb.base/interrupt.exp
index 037902b7217..beee0cf6b06 100644
--- a/gdb/testsuite/gdb.base/interrupt.exp
+++ b/gdb/testsuite/gdb.base/interrupt.exp
@@ -34,7 +34,13 @@ set bug_id 0
set testfile interrupt
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+
+set options { debug }
+if { ! [target_info exists gdb,nosignals] } {
+ lappend options "additional_flags=-DSIGNALS"
+}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $options] != "" } {
untested interrupt.exp
return -1
}
@@ -165,7 +171,35 @@ if ![file exists $binfile] then {
eof { fail "echo data (eof)" }
}
- setup_xfail "i*86-pc-linux*-gnu*"
+ if { ! [target_info exists gdb,nosignals] } {
+ # Wait until the program is in the read system call again.
+ sleep 2
+
+ # Stop the program for another test.
+ set msg "Send Control-C, second time"
+ send_gdb "\003"
+ gdb_test_multiple "" "$msg" {
+ -re "Program received signal SIGINT.*$gdb_prompt $" {
+ pass "$msg"
+ }
+ }
+
+ # The "signal" command should deliver the correct signal and
+ # return to the loop.
+ set msg "signal SIGINT"
+ gdb_test_multiple "signal SIGINT" "$msg" {
+ -re "^signal SIGINT\r\nContinuing with signal SIGINT.\r\n(\r\n|)$" { pass "$msg" }
+ }
+
+ # We should be back in the loop.
+ send_gdb "more data\n"
+ gdb_expect {
+ -re "^(\r\n|)more data\r\n(|more data\r\n)$" { pass "echo more data" }
+ timeout { fail "echo more data (timeout)" }
+ eof { fail "echo more data (eof)" }
+ }
+ }
+
send_gdb "\004"
gdb_expect {
-re "end of file.*Program exited normally.*$gdb_prompt $" {