OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gdb-7.2/] [gdb-7.2-or32-1.0rc1/] [gdb/] [testsuite/] [gdb.reverse/] [step-reverse.exp] - Blame information for rev 341

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
# Copyright 2008, 2009, 2010 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 3 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, see .  */
15
 
16
# This file is part of the GDB testsuite.  It tests reverse stepping.
17
# Lots of code borrowed from "step-test.exp".
18
 
19
#
20
# Test step and next in reverse
21
#
22
 
23
if ![target_info exists gdb,can_reverse] {
24
    return
25
}
26
 
27
set testfile "step-reverse"
28
set srcfile  ${testfile}.c
29
 
30
if { [prepare_for_testing $testfile.exp $testfile $srcfile] } {
31
    return -1
32
}
33
 
34
runto main
35
 
36
if [target_info exists gdb,use_precord] {
37
    # Activate process record/replay
38
    gdb_test_no_output "record" "Turn on process record"
39
}
40
 
41
# plain vanilla step/next (no count)
42
 
43
gdb_test "next" ".*NEXT TEST 1.*" "next test 1"
44
gdb_test "step" ".*STEP TEST 1.*" "step test 1"
45
 
46
# step/next with count
47
 
48
gdb_test "next 2" ".*NEXT TEST 2.*" "next test 2"
49
gdb_test "step 3" ".*STEP TEST 2.*" "step test 2"
50
 
51
# step over call
52
 
53
gdb_test "step" ".*NEXT OVER THIS CALL.*" "step up to call"
54
gdb_test "next" ".*STEP INTO THIS CALL.*" "next over call"
55
 
56
# step into call
57
 
58
gdb_test "step" ".*ARRIVED IN CALLEE.*" "step into call"
59
 
60
# finish out of call
61
 
62
set test_message "finish out of fn call"
63
gdb_test_multiple "finish" "$test_message" {
64
    -re "FINISH TEST.*$gdb_prompt $" {
65
        pass "$test_message"
66
    }
67
    -re "STEP INTO THIS CALL.*$gdb_prompt $" {
68
        send_gdb "step\n"
69
        exp_continue
70
    }
71
}
72
 
73
# stepi over flat code (no calls)
74
 
75
set test_message "simple stepi"
76
gdb_test_multiple "stepi" "$test_message" {
77
    -re "STEPI TEST.*$gdb_prompt $" {
78
        pass "$test_message"
79
    }
80
    -re "FINISH TEST.*$gdb_prompt $" {
81
        send_gdb "stepi\n"
82
        exp_continue
83
    }
84
    -re "NEXTI TEST.*$gdb_prompt $" {
85
        fail "$test_message (too far)"
86
    }
87
}
88
 
89
# stepi into a function call
90
 
91
set test_message "stepi into function call"
92
gdb_test_multiple "stepi" "$test_message" {
93
    -re "ARRIVED IN CALLEE.*$gdb_prompt $" {
94
        pass "$test_message"
95
    }
96
    -re "NEXTI TEST.*$gdb_prompt $" {
97
        fail "$test_message (too far)"
98
    }
99
    -re "RETURN FROM CALLEE.*$gdb_prompt $" {
100
        fail "$test_message (too far)"
101
    }
102
    -re "ENTER CALLEE.*$gdb_prompt $" {
103
        send_gdb "stepi\n"
104
        exp_continue
105
    }
106
    -re "STEPI TEST.*$gdb_prompt $" {
107
        send_gdb "stepi\n"
108
        exp_continue
109
    }
110
}
111
 
112
# stepi thru return of a function call
113
 
114
set test_message "stepi back from function call"
115
gdb_test_multiple "stepi" "$test_message" {
116
    -re "NEXTI TEST.*$gdb_prompt $" {
117
        pass "$test_message"
118
    }
119
    -re "ARRIVED IN CALLEE.*$gdb_prompt $" {
120
        send_gdb "stepi\n"
121
        exp_continue
122
    }
123
    -re "RETURN FROM CALLEE.*$gdb_prompt $" {
124
        send_gdb "stepi\n"
125
        exp_continue
126
    }
127
    -re "STEPI TEST.*$gdb_prompt $" {
128
        send_gdb "stepi\n"
129
        exp_continue
130
    }
131
    -re "ENTER CALLEE.*$gdb_prompt $" {
132
        fail "$test_message (too far)"
133
    }
134
}
135
 
136
###
137
###
138
###
139
 
140
# Set reverse execution direction
141
 
142
gdb_test_no_output "set exec-dir reverse" "set reverse execution"
143
 
144
# stepi backward thru return and into a function
145
 
146
set stepi_location  [gdb_get_line_number "ARRIVED IN CALLEE" "$srcfile"]
147
set test_message "reverse stepi thru function return"
148
gdb_test_multiple "stepi" "$test_message" {
149
    -re "NEXTI TEST.*$gdb_prompt $" {
150
        fail "$test_message (start statement)"
151
    }
152
    -re "RETURN FROM CALLEE.*$gdb_prompt $" {
153
        send_gdb "stepi\n"
154
        exp_continue
155
    }
156
    -re "$hex\[ \t\]*$stepi_location.*ARRIVED IN CALLEE.*$gdb_prompt $" {
157
        send_gdb "stepi\n"
158
        exp_continue
159
    }
160
    -re "ARRIVED IN CALLEE.*$gdb_prompt $" {
161
        pass "$test_message"
162
    }
163
    -re "ENTER CALLEE.*$gdb_prompt $" {
164
        fail "$test_message (too far)"
165
    }
166
    -re "STEPI TEST.*$gdb_prompt $" {
167
        fail "$test_message (too far)"
168
    }
169
}
170
 
171
# stepi backward out of a function call
172
 
173
set stepi_location  [gdb_get_line_number "STEPI TEST" "$srcfile"]
174
set test_message "reverse stepi from a function call"
175
gdb_test_multiple "stepi" "$test_message" {
176
    -re "ARRIVED IN CALLEE.*$gdb_prompt $" {
177
        fail "$test_message (start statement)"
178
    }
179
    -re "ENTER CALLEE.*$gdb_prompt $" {
180
        send_gdb "stepi\n"
181
        exp_continue
182
    }
183
    -re "${hex} in main .*:$stepi_location.*STEPI TEST.*$gdb_prompt $" {
184
        send_gdb "stepi\n"
185
        exp_continue
186
    }
187
    -re "STEPI TEST.*$gdb_prompt $" {
188
        pass "$test_message"
189
    }
190
    -re "STEP INTO THIS CALL.*$gdb_prompt $" {
191
        fail "$test_message (too far)"
192
    }
193
}
194
 
195
# stepi backward over flat code (no calls)
196
 
197
set stepi_location  [gdb_get_line_number "FINISH TEST" "$srcfile"]
198
set test_message "simple reverse stepi"
199
gdb_test_multiple "stepi" "$test_message" {
200
    -re "STEPI TEST.*$gdb_prompt $" {
201
        fail "$test_message (start statement)"
202
    }
203
    -re "$hex\[ \t\]*$stepi_location.* FINISH TEST.*$gdb_prompt $" {
204
        send_gdb "stepi\n"
205
        exp_continue
206
    }
207
    -re "$stepi_location.* FINISH TEST.*$gdb_prompt $" {
208
        pass "$test_message"
209
    }
210
    -re "STEP INTO THIS CALL.*$gdb_prompt $" {
211
        fail "$test_message (too far)"
212
    }
213
}
214
 
215
# step backward into function (thru return)
216
 
217
set test_message "reverse step into fn call"
218
gdb_test_multiple "step" "$test_message" {
219
    -re "RETURN FROM CALLEE.*$gdb_prompt $" {
220
        send_gdb "step\n"
221
        exp_continue
222
    }
223
    -re "ARRIVED IN CALLEE.*$gdb_prompt $" {
224
        pass "$test_message"
225
    }
226
}
227
 
228
# step backward out of called function (thru call)
229
 
230
gdb_test "step" ".*STEP INTO THIS CALL.*" "reverse step out of called fn"
231
 
232
# next backward over call
233
 
234
gdb_test "next" ".*NEXT OVER THIS CALL.*" "reverse next over call"
235
 
236
# step/next backward with count
237
 
238
gdb_test "step 3" ".*REVERSE STEP TEST 1.*" "reverse step test 1"
239
gdb_test "next 2" ".*REVERSE NEXT TEST 1.*" "reverse next test 1"
240
 
241
# step/next backward without count
242
 
243
gdb_test "step" ".*STEP TEST 1.*" "reverse step test 2"
244
gdb_test "next" ".*NEXT TEST 1.*" "reverse next test 2"
245
 
246
 
247
 
248
# Finish test by running forward to the end.
249
# FIXME return to this later...
250
# gdb_test_no_output "set exec-dir forward" "set forward execution"
251
# gdb_continue_to_end "step-reverse.exp"
252
 

powered by: WebSVN 2.1.0

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