gdb/
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / interrupt.exp
index c2ad284f8e38e75d0556bba6ad7b8a276c506bff..beee0cf6b06ec4c19f637395ee591cb1feec1c46 100644 (file)
@@ -1,27 +1,22 @@
-# 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] {
@@ -39,8 +34,15 @@ 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}] != "" } {
-     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
@@ -100,7 +102,7 @@ if ![file exists $binfile] then {
        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
@@ -121,11 +123,11 @@ if ![file exists $binfile] then {
 
                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*"
@@ -169,11 +171,39 @@ 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 $" {
-               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)" }
This page took 0.028537 seconds and 4 git commands to generate.