1 # Copyright (C) 1994, 1995 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
17 # Please email any bugs, comments, and/or additions to this file to:
20 if [host_info exists name] {
21 if [board_info host exists gdb,nointerrupts] {
22 verbose "Skipping interrupt.exp because of nointerrupts."
34 set testfile interrupt
35 set srcfile ${testfile}.c
36 set binfile ${objdir}/${subdir}/${testfile}
37 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
38 perror "Couldn't compile ${srcfile}"
42 if [target_info exists gdb,noinferiorio] {
43 verbose "Skipping interrupt.exp because of noinferiorio."
50 if ![file exists $binfile] then {
51 perror "$binfile does not exist."
54 gdb_reinitialize_dir $srcdir/$subdir
56 # Hope this is unix :-)
57 gdb_test "shell stty intr '^C'" "" \
58 "set interrupt character in interrupt.exp"
59 if [runto_main] then {
62 -re "\r\ntalk to me baby\r\n$" {
63 pass "child process is alive"
65 timeout { fail "run (timeout)" }
66 eof { fail "run (eof)" }
68 # This should appear twice, once for the echo and once for the
69 # program's output. Under dejagnu (but not interactively) for
70 # SunOS4, it only appears once. Don't worry about it, I imagine
71 # dejagnu has just done something to the tty modes.
74 -re "^a\r\n(|a\r\n)$" {
75 pass "child process ate our char"
77 timeout { fail "echo a (timeout)" }
78 eof { fail "echo a (eof)" }
80 # Wait until the program is in the read system call again.
85 -re "Program received signal SIGINT.*$gdb_prompt $" {
86 pass "send_gdb control C"
88 -re ".*$gdb_prompt $" { fail "send_gdb control C" }
89 timeout { fail "send_gdb control C (timeout)" }
90 eof { fail "send_gdb control C (eof)" }
93 send_gdb "p func1 ()\n"
95 -re " = 4.*$gdb_prompt $" { pass "call function when asleep" }
96 -re ".*Program received signal SIGSEGV.*$gdb_prompt $" {
97 setup_xfail "i*86-pc-linux*-gnu"
98 fail "child died when we called func1, skipped rest of tests"
101 -re "$gdb_prompt $" { fail "call function when asleep (wrong output)" }
104 # This fail probably happens whenever we use /proc (we
105 # don't use PRSABORT), but apparently also happens on
106 # other machines as well.
108 setup_xfail "sparc*-*-solaris2*"
109 setup_xfail "mips-*-ultrix*"
110 setup_xfail "hppa*-*-*"
111 setup_xfail "i386*-*-bsd*"
112 setup_xfail "*-*-sysv4*"
113 setup_xfail "vax-*-*"
114 setup_xfail "alpha-*-*"
115 setup_xfail "*-*-irix*"
116 setup_xfail "*-*-hpux*"
117 setup_xfail "*-*-*lynx*"
118 fail "call function when asleep (stays asleep)"
119 # Send_Gdb a newline to wake it up
121 gdb_test "" " = 4" "call function after waking it"
123 # eof { fail "call function when asleep (eof)" }
126 # Now try calling the function again.
127 gdb_test "p func1 ()" " = 4" "call function a second time"
129 # And the program should still be doing the same thing.
130 # The optional trailing \r\n is in case we sent a newline above
131 # to wake the program, in which case the program now sends it
132 # back. We check for it either here or in the next expect
133 # command, because which one it ends up in is timing dependent.
134 send_gdb "continue\n"
135 # For some reason, i386-*-sysv4 gdb fails to issue the Continuing
136 # message, but otherwise appears normal (FIXME).
138 -re "^continue\r\nContinuing.\r\n(\r\n|)$" { pass "continue" }
139 -re "^continue\r\n\r\n" { fail "continue (missing Continuing.)" }
140 -re "$gdb_prompt $" { fail "continue" }
141 timeout { fail "continue (timeout)" }
142 eof { fail "continue (eof)" }
146 # The optional leading \r\n is in case we sent a newline above
147 # to wake the program, in which case the program now sends it
150 -re "^(\r\n|)data\r\n(|data\r\n)$" { pass "echo data" }
151 timeout { fail "echo data (timeout)" }
152 eof { fail "echo data (eof)" }
155 setup_xfail "i*86-pc-linux*-gnu"
158 -re "end of file.*Program exited normally.*$gdb_prompt $" {
159 pass "send_gdb end of file"
161 -re "$gdb_prompt $" { fail "send end of file" }
162 timeout { fail "send end of file (timeout)" }
163 eof { fail "send end of file (eof)" }