-# Copyright (C) 1994, 1995, 1997, 1998 Free Software Foundation, Inc.
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2007, 2008, 2009
+# 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 2 of the License, or
+# 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, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
-if [host_info exists name] {
- if [board_info host exists gdb,nointerrupts] {
- verbose "Skipping interrupt.exp because of nointerrupts."
- continue
- }
+if [target_info exists gdb,nointerrupts] {
+ verbose "Skipping interrupt.exp because of nointerrupts."
+ continue
}
if [target_info exists gdb,noinferiorio] {
set testfile interrupt
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+
+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
}
gdb_start
send_gdb "p func1 ()\n"
gdb_expect {
-re " = 4.*$gdb_prompt $" { pass "call function when asleep" }
- -re ".*Program received signal SIGSEGV.*$gdb_prompt $" {
+ -re ".*Program received signal SIG(SEGV|ILL).*$gdb_prompt $" {
setup_xfail "i*86-pc-linux*-gnu*"
fail "child died when we called func1, skipped rest of tests"
return
setup_xfail "sparc*-*-solaris2*"
setup_xfail "mips-*-ultrix*"
- setup_xfail "i386*-*-bsd*"
setup_xfail "i*86-*-solaris2*"
setup_xfail "*-*-sysv4*"
setup_xfail "vax-*-*"
setup_xfail "alpha-*-*"
+ setup_xfail "*-*-*bsd*"
setup_xfail "*-*-irix*"
setup_xfail "*-*-hpux*"
setup_xfail "*-*-*lynx*"
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 $" {
- pass "send_gdb end of file"
+ pass "send end of file"
}
-re "$gdb_prompt $" { fail "send end of file" }
timeout { fail "send end of file (timeout)" }