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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.reverse/] [step-precsave.exp] - Blame information for rev 833

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

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

powered by: WebSVN 2.1.0

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