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

Subversion Repositories or1k

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

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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