OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [gdb/] [testsuite/] [gdb.base/] [interrupt.exp] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
2
# Free Software Foundation, Inc.
3
 
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
 
18
# Please email any bugs, comments, and/or additions to this file to:
19
# bug-gdb@prep.ai.mit.edu
20
 
21
if [host_info exists name] {
22
    if [board_info host exists gdb,nointerrupts] {
23
        verbose "Skipping interrupt.exp because of nointerrupts."
24
        continue
25
    }
26
}
27
 
28
if [target_info exists gdb,noinferiorio] {
29
    verbose "Skipping interrupt.exp because of noinferiorio."
30
    return
31
}
32
 
33
if $tracelevel then {
34
        strace $tracelevel
35
}
36
 
37
set prms_id 0
38
set bug_id 0
39
 
40
set testfile interrupt
41
set srcfile ${testfile}.c
42
set binfile ${objdir}/${subdir}/${testfile}
43
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
44
     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
45
}
46
 
47
gdb_start
48
 
49
 
50
if ![file exists $binfile] then {
51
    perror "$binfile does not exist."
52
    return 0
53
} else {
54
    gdb_reinitialize_dir $srcdir/$subdir
55
    gdb_load $binfile
56
    # Hope this is unix :-)
57
    gdb_test "shell stty intr '^C'" "" \
58
        "set interrupt character in interrupt.exp"
59
    if [runto_main] then {
60
        send_gdb "continue\n"
61
        gdb_expect {
62
            -re "\r\ntalk to me baby\r\n$" {
63
                pass "child process is alive"
64
            }
65
            timeout { fail "run (timeout)" }
66
            eof { fail "run (eof)" }
67
        }
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.
72
        send_gdb "a\n"
73
        gdb_expect {
74
            -re "^a\r\n(|a\r\n)$" {
75
                pass "child process ate our char"
76
            }
77
            timeout { fail "echo a (timeout)" }
78
            eof { fail "echo a (eof)" }
79
        }
80
        # Wait until the program is in the read system call again.
81
        sleep 2
82
 
83
        # Cntrl-c may fail for simulator targets running on a BSD host.
84
        # This is the result of a combination of the read syscall
85
        # being restarted and gdb capturing the cntrl-c signal.
86
 
87
        # Cntrl-c may fail for simulator targets on slow hosts.
88
        # This is because there is a race condition between entering
89
        # the read and delivering the cntrl-c.
90
 
91
        send_gdb "\003"
92
        gdb_expect {
93
            -re "Program received signal SIGINT.*$gdb_prompt $" {
94
                pass "send_gdb control C"
95
            }
96
            -re ".*$gdb_prompt $" { fail "send_gdb control C" }
97
            timeout { fail "send_gdb control C (timeout)" }
98
            eof { fail "send_gdb control C (eof)" }
99
        }
100
 
101
        send_gdb "p func1 ()\n"
102
        gdb_expect {
103
            -re " = 4.*$gdb_prompt $" { pass "call function when asleep" }
104
            -re ".*Program received signal SIGSEGV.*$gdb_prompt $" {
105
                setup_xfail "i*86-pc-linux*-gnu*"
106
                fail "child died when we called func1, skipped rest of tests"
107
                return
108
            }
109
            -re "$gdb_prompt $" {
110
                # On HPUX-11.0 'send "p func1 ()"' above
111
                # terminates the program. A defect is pending on this
112
                # issue [defect #DTS CHFts24203]. Hence calling setup_xfail
113
                # below.
114
                setup_xfail "hppa*-*-*11*" CHFts24203
115
                fail "call function when asleep (wrong output)"
116
            }
117
            default {
118
 
119
                # This fail probably happens whenever we use /proc (we
120
                # don't use PRSABORT), but apparently also happens on
121
                # other machines as well.
122
 
123
                setup_xfail "sparc*-*-solaris2*"
124
                setup_xfail "mips-*-ultrix*"
125
                setup_xfail "i386*-*-bsd*"
126
                setup_xfail "i*86-*-solaris2*"
127
                setup_xfail "*-*-sysv4*"
128
                setup_xfail "vax-*-*"
129
                setup_xfail "alpha-*-*"
130
                setup_xfail "*-*-irix*"
131
                setup_xfail "*-*-hpux*"
132
                setup_xfail "*-*-*lynx*"
133
                fail "call function when asleep (stays asleep)"
134
                # Send_Gdb a newline to wake it up
135
                send_gdb "\n"
136
                gdb_test "" " = 4" "call function after waking it"
137
            }
138
#           eof { fail "call function when asleep (eof)" }
139
        }
140
 
141
        # Now try calling the function again.
142
        gdb_test "p func1 ()" " = 4" "call function a second time"
143
 
144
        # And the program should still be doing the same thing.
145
        # The optional trailing \r\n is in case we sent a newline above
146
        # to wake the program, in which case the program now sends it
147
        # back.  We check for it either here or in the next gdb_expect
148
        # command, because which one it ends up in is timing dependent.
149
        send_gdb "continue\n"
150
        # For some reason, i386-*-sysv4 gdb fails to issue the Continuing
151
        # message, but otherwise appears normal (FIXME).
152
        gdb_expect {
153
            -re "^continue\r\nContinuing.\r\n(\r\n|)$" { pass "continue" }
154
            -re "^continue\r\n\r\n" { fail "continue (missing Continuing.)" }
155
            -re "$gdb_prompt $" { fail "continue" }
156
            timeout { fail "continue (timeout)" }
157
            eof { fail "continue (eof)" }
158
        }
159
 
160
        send_gdb "data\n"
161
        # The optional leading \r\n is in case we sent a newline above
162
        # to wake the program, in which case the program now sends it
163
        # back.
164
        # FIXME: The pattern below leads to an expected success on HPUX-11.0
165
        # but the success is spurious. Need to provide the right reg.expr.
166
        # here.
167
        gdb_expect {
168
            -re "^(\r\n|)data\r\n(|data\r\n)$" { pass "echo data" }
169
            timeout { fail "echo data (timeout)" }
170
            eof { fail "echo data (eof)" }
171
        }
172
 
173
        setup_xfail "i*86-pc-linux*-gnu*"
174
        send_gdb "\004"
175
        gdb_expect {
176
            -re "end of file.*Program exited normally.*$gdb_prompt $" {
177
                pass "send end of file"
178
            }
179
            -re "$gdb_prompt $" { fail "send end of file" }
180
            timeout { fail "send end of file (timeout)" }
181
            eof { fail "send end of file (eof)" }
182
        }
183
    }
184
}
185
return 0

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.