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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.base/] [jump.exp] - Blame information for rev 816

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
#   Copyright 1998, 1999, 2007, 2008, 2009, 2010
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 3 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, see .  */
16
 
17
if $tracelevel then {
18
        strace $tracelevel
19
        }
20
 
21
set prms_id 0
22
set bug_id 0
23
 
24
clear_xfail "*-*-*"
25
 
26
set testfile "jump"
27
set srcfile ${testfile}.c
28
set binfile ${objdir}/${subdir}/${testfile}
29
 
30
# Build the test case
31
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
32
     untested jump.exp
33
     return -1
34
    }
35
 
36
 
37
# Start with a fresh gdb
38
 
39
gdb_exit
40
gdb_start
41
gdb_reinitialize_dir $srcdir/$subdir
42
gdb_load ${binfile}
43
 
44
if ![runto_main] then {
45
  perror "Couldn't run to main"
46
  return -1
47
}
48
 
49
# Set a breakpoint on the statement that we're about to jump to.
50
# The statement doesn't contain a function call.
51
#
52
send_gdb "break 22\n"
53
set bp_on_non_call 0
54
gdb_expect {
55
  -re "\[Bb\]reakpoint (\[0-9\]*) at 0x\[0-9a-fA-F\]*: file .*${srcfile}, line 22.*$gdb_prompt $"\
56
          {set bp_on_non_call $expect_out(1,string)
57
           pass "break before jump to non-call"}
58
  -re "$gdb_prompt $"\
59
          {fail "break before jump to non-call"}
60
  timeout {fail "(timeout) break before jump to non-call"}
61
}
62
 
63
# Can we jump to the statement?  Do we stop there?
64
#
65
send_gdb "jump 22\n"
66
gdb_expect {
67
  -re "Breakpoint \[0-9\]*, .*${srcfile}:22.*$gdb_prompt $"\
68
          {pass "jump to non-call"}
69
  -re "$gdb_prompt $"\
70
          {fail "jump to non-call"}
71
  timeout {fail "(timeout) jump to non-call"}
72
}
73
 
74
# Set a breakpoint on the statement that we're about to jump to.
75
# The statement does contain a function call.
76
#
77
send_gdb "break 21\n"
78
set bp_on_call 0
79
gdb_expect {
80
  -re "\[Bb\]reakpoint (\[0-9\]*) at 0x\[0-9a-fA-F\]*: file .*${srcfile}, line 21.*$gdb_prompt $"\
81
          {set bp_on_call $expect_out(1,string)
82
           pass "break before jump to call"}
83
  -re "$gdb_prompt $"\
84
          {fail "break before jump to call"}
85
  timeout {fail "(timeout) break before jump to call"}
86
}
87
 
88
# Can we jump to the statement?  Do we stop there?
89
#
90
send_gdb "jump 21\n"
91
gdb_expect {
92
  -re "Breakpoint \[0-9\]*, .*${srcfile}:21.*$gdb_prompt $"\
93
          {pass "jump to call"}
94
  -re "$gdb_prompt $"\
95
          {fail "jump to call"}
96
  timeout {fail "(timeout) jump to call"}
97
}
98
 
99
# If we disable the breakpoint at the function call, and then
100
# if we jump to that statement, do we not stop there, but at
101
# the following breakpoint?
102
#
103
send_gdb "disable $bp_on_call\n"
104
gdb_expect {
105
  -re "$gdb_prompt $"\
106
          {pass "disable breakpoint on call"}
107
  timeout {fail "(timeout) disable breakpoint on call"}
108
}
109
 
110
send_gdb "jump 21\n"
111
gdb_expect {
112
  -re "Breakpoint \[0-9\]*, .*${srcfile}:22.*$gdb_prompt $"\
113
          {pass "jump to call with disabled breakpoint"}
114
  -re "$gdb_prompt $"\
115
          {fail "jump to call with disabled breakpoint"}
116
  timeout {fail "(timeout) jump to call with disabled breakpoint"}
117
}
118
 
119
# Verify that GDB responds gracefully to the "jump" command without
120
# an argument.
121
#
122
send_gdb "jump\n"
123
gdb_expect {
124
  -re "Argument required .starting address..*$gdb_prompt $"\
125
          {pass "jump without argument disallowed"}
126
  -re "$gdb_prompt $"\
127
          {fail "jump without argument disallowed"}
128
  timeout {fail "(timeout) jump without argument disallowed"}
129
}
130
 
131
# Verify that GDB responds gracefully to the "jump" command with
132
# trailing junk.
133
#
134
send_gdb "jump 21 100\n"
135
gdb_expect {
136
  -re "Junk at end of line specification: 100.*$gdb_prompt $"\
137
          {pass "jump with trailing argument junk"}
138
  -re "$gdb_prompt $"\
139
          {fail "jump with trailing argument junk"}
140
  timeout {fail "(timeout) jump with trailing argument junk"}
141
}
142
 
143
# Verify that GDB responds gracefully to a request to jump out of
144
# the current function.  (Note that this will very likely cause the
145
# inferior to die.  Be prepared to rerun the inferior, if further
146
# testing is desired.)
147
#
148
# Try it both ways: confirming and not confirming the jump.
149
#
150
send_gdb "jump 12\n"
151
gdb_expect {
152
  -re "Line 12 is not in `main'.  Jump anyway.*y or n. $"\
153
          {send_gdb "n\n"
154
           gdb_expect {
155
             -re "Not confirmed.*$gdb_prompt $"\
156
                     {pass "aborted jump out of current function"}
157
             -re "$gdb_prompt $"\
158
                     {fail "aborted jump out of current function"}
159
             timeout {fail "(timeout) aborted jump out of current function"}
160
           }
161
          }
162
  -re "$gdb_prompt $"\
163
          {fail "aborted jump out of current function"}
164
  timeout {fail "(timeout) aborted jump out of current function"}
165
}
166
 
167
send_gdb "jump 12\n"
168
gdb_expect {
169
  -re "Line 12 is not in `main'.  Jump anyway.*y or n. $"\
170
          {send_gdb "y\n"
171
           gdb_expect {
172
             -re "Continuing at.*$gdb_prompt $"\
173
                     {pass "jump out of current function"}
174
             -re "$gdb_prompt $"\
175
                     {fail "jump out of current function"}
176
             timeout {fail "(timeout) jump out of current function"}
177
           }
178
          }
179
  -re "$gdb_prompt $"\
180
          {fail "jump out of current function"}
181
  timeout {fail "(timeout) jump out of current function"}
182
}
183
 
184
gdb_exit
185
return 0

powered by: WebSVN 2.1.0

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