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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gdb-7.2/] [gdb/] [testsuite/] [gdb.reverse/] [step-precsave.exp] - Blame information for rev 861

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

powered by: WebSVN 2.1.0

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