aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/interrupt.exp
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.base/interrupt.exp')
-rw-r--r--gdb/testsuite/gdb.base/interrupt.exp67
1 files changed, 39 insertions, 28 deletions
diff --git a/gdb/testsuite/gdb.base/interrupt.exp b/gdb/testsuite/gdb.base/interrupt.exp
index b3895f0..aa9cc2e 100644
--- a/gdb/testsuite/gdb.base/interrupt.exp
+++ b/gdb/testsuite/gdb.base/interrupt.exp
@@ -17,8 +17,8 @@
# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@prep.ai.mit.edu
-if [info exists nointerrupts] {
- if $nointerrupts {
+if [host_info exists name] {
+ if [board_info host exists gdb,nointerrupts] {
verbose "Skipping interrupt.exp because of nointerrupts."
continue
}
@@ -32,18 +32,20 @@ set prms_id 0
set bug_id 0
set testfile interrupt
-set srcfile ${srcdir}/$subdir/${testfile}.c
+set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
-if { [compile "${srcfile} -g -o ${binfile}"] != "" } {
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
perror "Couldn't compile ${srcfile}"
return -1
}
-if $noinferiorio {
+if [target_info exists gdb,noinferiorio] {
verbose "Skipping interrupt.exp because of noinferiorio."
return
}
-
+
+gdb_start
+
if ![file exists $binfile] then {
perror "$binfile does not exist."
@@ -51,12 +53,15 @@ if ![file exists $binfile] then {
} else {
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
+ # Hope this is unix :-)
gdb_test "shell stty intr '^C'" "" \
"set interrupt character in interrupt.exp"
if [runto_main] then {
- send "continue\n"
+ send_gdb "continue\n"
expect {
- -re "\r\ntalk to me baby\r\n$" {}
+ -re "\r\ntalk to me baby\r\n$" {
+ pass "child process is alive"
+ }
timeout { fail "run (timeout)" }
eof { fail "run (eof)" }
}
@@ -64,29 +69,35 @@ if ![file exists $binfile] then {
# program's output. Under dejagnu (but not interactively) for
# SunOS4, it only appears once. Don't worry about it, I imagine
# dejagnu has just done something to the tty modes.
- send "a\n"
+ send_gdb "a\n"
expect {
- -re "^a\r\n(|a\r\n)$" {}
+ -re "^a\r\n(|a\r\n)$" {
+ pass "child process ate our char"
+ }
timeout { fail "echo a (timeout)" }
eof { fail "echo a (eof)" }
}
# Wait until the program is in the read system call again.
- exec sleep 2
+ sleep 2
- send "\003"
+ send_gdb "\003"
expect {
-re "Program received signal SIGINT.*$prompt $" {
- pass "send control C"
+ pass "send_gdb control C"
}
- -re ".*$prompt $" { fail "send control C" }
- timeout { fail "send control C (timeout)" }
- eof { fail "send control C (eof)" }
+ -re ".*$prompt $" { fail "send_gdb control C" }
+ timeout { fail "send_gdb control C (timeout)" }
+ eof { fail "send_gdb control C (eof)" }
}
- setup_xfail "i*86-*-linux*"
- send "p func1 ()\n"
+ send_gdb "p func1 ()\n"
expect {
-re " = 4.*$prompt $" { pass "call function when asleep" }
+ -re ".*Program received signal SIGSEGV.*$prompt $" {
+ setup_xfail "i*86-pc-linux*-gnu"
+ fail "child died when we called func1, skipped rest of tests"
+ return
+ }
-re "$prompt $" { fail "call function when asleep (wrong output)" }
default {
@@ -94,7 +105,7 @@ if ![file exists $binfile] then {
# don't use PRSABORT), but apparently also happens on
# other machines as well.
- setup_xfail "sparc-*-solaris2*"
+ setup_xfail "sparc*-*-solaris2*"
setup_xfail "mips-*-ultrix*"
setup_xfail "hppa*-*-*"
setup_xfail "i386*-*-bsd*"
@@ -105,8 +116,8 @@ if ![file exists $binfile] then {
setup_xfail "*-*-hpux*"
setup_xfail "*-*-*lynx*"
fail "call function when asleep (stays asleep)"
- # Send a newline to wake it up
- send "\n"
+ # Send_Gdb a newline to wake it up
+ send_gdb "\n"
gdb_test "" " = 4" "call function after waking it"
}
# eof { fail "call function when asleep (eof)" }
@@ -120,18 +131,18 @@ if ![file exists $binfile] then {
# to wake the program, in which case the program now sends it
# back. We check for it either here or in the next expect
# command, because which one it ends up in is timing dependent.
- send "continue\n"
+ send_gdb "continue\n"
# For some reason, i386-*-sysv4 gdb fails to issue the Continuing
# message, but otherwise appears normal (FIXME).
expect {
-re "^continue\r\nContinuing.\r\n(\r\n|)$" { pass "continue" }
-re "^continue\r\n\r\n" { fail "continue (missing Continuing.)" }
-re "$prompt $" { fail "continue" }
- timeout { fail "continue" }
- eof { fail "continue" }
+ timeout { fail "continue (timeout)" }
+ eof { fail "continue (eof)" }
}
- send "data\n"
+ send_gdb "data\n"
# The optional leading \r\n is in case we sent a newline above
# to wake the program, in which case the program now sends it
# back.
@@ -141,11 +152,11 @@ if ![file exists $binfile] then {
eof { fail "echo data (eof)" }
}
- setup_xfail "i*86-*-linux*"
- send "\004"
+ setup_xfail "i*86-pc-linux*-gnu"
+ send_gdb "\004"
expect {
-re "end of file.*Program exited normally.*$prompt $" {
- pass "send end of file"
+ pass "send_gdb end of file"
}
-re "$prompt $" { fail "send end of file" }
timeout { fail "send end of file (timeout)" }