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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.reverse/] [machinestate-precsave.exp] - Blame information for rev 231

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.
17
# This test tests the restoration of various kinds of machine state
18
# to their original values with a process record log.  We will execute
19
# the program forward while it changes various types of data, and
20
# then execute it backward to see if their values get restored.
21
#
22
# The types of machine state (data) that are tested are:
23
#   register variable
24
#   auto variable
25
#   function static variable
26
#   module static variable
27
#   module global variable
28
#
29
# TODO:
30
# various, possibly including...
31
#   .bss variable, .data variable, ...
32
#   shared library variable
33
#   heap variable (pointer)...
34
#   overlay variables...
35
#   Test forward replay
36
#
37
 
38
# This test suitable only for process record-replay
39
if ![target_info exists gdb,use_precord] {
40
    return
41
}
42
 
43
set testfile "machinestate"
44
set srcfile  ${testfile}.c
45
set srcfile1 ms1.c
46
 
47
if { [prepare_for_testing $testfile.exp $testfile {machinestate.c ms1.c} ] } {
48
    return -1
49
}
50
 
51
set newline "\[\r\n\]+"
52
 
53
set beginmain [gdb_get_line_number " begin main " $srcfile]
54
set endmain   [gdb_get_line_number " end main "   $srcfile]
55
 
56
# Test begins
57
 
58
runto main
59
 
60
if [target_info exists gdb,use_precord] {
61
    # Activate process record/replay
62
    gdb_test "record" "" "Turn on process record"
63
    # FIXME: command ought to acknowledge, so we can test if it succeeded.
64
}
65
 
66
gdb_test "break $endmain" \
67
    "Breakpoint $decimal at .*/$srcfile, line $endmain\." \
68
    "BP at end of main"
69
 
70
gdb_test "continue" "Breakpoint .* end main .*" "run to end of main"
71
 
72
gdb_test "record save machinestate.precsave" \
73
    "Saved core file machinestate.precsave with execution log\."  \
74
    "save process recfile"
75
 
76
gdb_test "kill" "" "Kill process, prepare to debug log file" \
77
    "Kill the program being debugged\\? \\(y or n\\) " "y"
78
 
79
gdb_test "record restore machinestate.precsave" \
80
    "Program terminated with signal .*" \
81
    "reload prec save file"
82
 
83
# Proceed to end of main
84
 
85
gdb_test "break $endmain" \
86
    "Breakpoint.* file .*/$srcfile, line $endmain.*" ""
87
 
88
gdb_test_multiple "continue" "go to end of main forward" {
89
    -re ".*Breakpoint $decimal,.*/$srcfile:$endmain.*$gdb_prompt $"  {
90
        pass "go to end of main forward"
91
    }
92
    -re "No more reverse-execution history.* end main .*$gdb_prompt $" {
93
        pass "go to end of main forward"
94
    }
95
}
96
 
97
###
98
###
99
###
100
 
101
# Now run backward to each of several points where data is changed.
102
#
103
 
104
# Module global variable, reverse
105
 
106
set breakloc [gdb_get_line_number \
107
                  "module_global_state: set breakpoint here" $srcfile]
108
 
109
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
110
gdb_test "reverse-continue" ".*/$srcfile:$breakloc.*" "reverse to $breakloc"
111
 
112
gdb_test "print aglobal" ".* = 0$newline"  "module global reverse-breakpoint"
113
gdb_test "step"          ".* module global post-change .*" ""
114
gdb_test "print aglobal" ".* = 1$newline"  "module global forward past bp"
115
gdb_test "reverse-step"  ".*$newline$breakloc.*" ""
116
gdb_test "print aglobal" ".* = 0$newline"  "module global reverse-step to bp"
117
 
118
 
119
# Module static variable, reverse
120
 
121
set breakloc [gdb_get_line_number \
122
                  "module_static_state: set breakpoint here" $srcfile]
123
 
124
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
125
gdb_test "reverse-continue" ".*/$srcfile:$breakloc.*" "reverse to $breakloc"
126
 
127
gdb_test "print astatic" ".* = 0$newline"  "module static reverse-breakpoint"
128
gdb_test "step"          ".* module static post-change .*" ""
129
gdb_test "print astatic" ".* = 1$newline"  "module static forward"
130
gdb_test "reverse-step"  ".*$newline$breakloc.*" ""
131
gdb_test "print astatic" ".* = 0$newline"  "module static reverse-step"
132
 
133
# Function static variable, reverse
134
 
135
set breakloc [gdb_get_line_number \
136
                  "function_static_state: set breakpoint here" $srcfile]
137
 
138
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
139
gdb_test "reverse-continue" ".*/$srcfile:$breakloc.*" "reverse to $breakloc"
140
 
141
gdb_test "print a"      ".* = 0$newline"  "function static reverse-breakpoint"
142
gdb_test "step"         ".* function static post-change .*" ""
143
gdb_test "print a"      ".* = 1$newline"  "function static forward"
144
gdb_test "reverse-step" ".*$newline$breakloc.*" ""
145
gdb_test "print a"      ".* = 0$newline"  "function static reverse-step"
146
 
147
# Auto variable, reverse
148
 
149
set breakloc [gdb_get_line_number \
150
                  "auto_state: set breakpoint here" $srcfile]
151
 
152
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
153
gdb_test "reverse-continue" ".*/$srcfile:$breakloc.*" "reverse to $breakloc"
154
 
155
gdb_test "print a"      ".* = 0$newline"  "auto var reverse-breakpoint"
156
gdb_test "step"         ".* auto post-change .*" ""
157
gdb_test "print a"      ".* = 1$newline"  "auto var forward"
158
gdb_test "reverse-step" ".*$newline$breakloc.*" ""
159
gdb_test "print a"      ".* = 0$newline"  "auto var reverse-step"
160
 
161
# Register variable, reverse
162
 
163
set breakloc [gdb_get_line_number \
164
                  "register_state: set breakpoint here" $srcfile]
165
 
166
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
167
gdb_test "reverse-continue" ".*/$srcfile:$breakloc.*" "reverse to $breakloc"
168
 
169
gdb_test "print a"      ".* = 0$newline"  "register var reverse-breakpoint"
170
gdb_test "step"         ".* register post-change .*" ""
171
gdb_test "print a"      ".* = 1$newline"  "register var step post-change"
172
gdb_test "reverse-step" ".*$newline$breakloc.*" ""
173
gdb_test "print a"      ".* = 0$newline"  "register var reverse step-to"
174
 
175
# Proceed to beginning of main
176
 
177
gdb_test "tbreak $beginmain" ".*/$srcfile, line $beginmain.*" ""
178
gdb_test "reverse-continue"  ".*/$srcfile:$beginmain.*" "reverse to main"
179
 
180
# Now repeat tests while replaying forward.
181
 
182
# Register variable, forward
183
 
184
set breakloc [gdb_get_line_number \
185
                  "register_state: set breakpoint here" $srcfile]
186
 
187
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
188
gdb_test "continue"         ".*/$srcfile:$breakloc.*" "forward to $breakloc"
189
 
190
gdb_test "print a"      ".* = 0$newline"  "register var forward-breakpoint"
191
gdb_test "reverse-step" ".*hide.*" ""
192
gdb_test "step"         ".*$newline$breakloc.*" ""
193
gdb_test "print a"      ".* = 0$newline"  "register var forward step-to"
194
gdb_test "step"         ".* register post-change .*" ""
195
gdb_test "print a"      ".* = 1$newline"  "register var step post-change"
196
 
197
# Auto variable, forward
198
 
199
set breakloc [gdb_get_line_number \
200
                  "auto_state: set breakpoint here" $srcfile]
201
 
202
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
203
gdb_test "continue"         ".*/$srcfile:$breakloc.*" "forward to $breakloc"
204
 
205
gdb_test "print a"      ".* = 0$newline"  "auto var forward-breakpoint"
206
gdb_test "reverse-step" ".*hide.*" ""
207
gdb_test "step"         ".*$newline$breakloc.*" ""
208
gdb_test "print a"      ".* = 0$newline"  "auto var forward step-to"
209
gdb_test "step"         ".* auto post-change .*" ""
210
gdb_test "print a"      ".* = 1$newline"  "auto var step post-change"
211
 
212
# Function static variable, forward
213
 
214
set breakloc [gdb_get_line_number \
215
                  "function_static_state: set breakpoint here" $srcfile]
216
 
217
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
218
gdb_test "continue"         ".*/$srcfile:$breakloc.*" "forward to $breakloc"
219
 
220
gdb_test "print a"      ".* = 0$newline"  "function static forward-breakpoint"
221
gdb_test "reverse-step" ".*hide.*" ""
222
gdb_test "step"         ".*$newline$breakloc.*" ""
223
gdb_test "print a"      ".* = 0$newline"  "function static forward step-to"
224
gdb_test "step"         ".* function static post-change .*" ""
225
gdb_test "print a"      ".* = 1$newline"  "function static step post-change"
226
 
227
# Module static variable, forward
228
 
229
set breakloc [gdb_get_line_number \
230
                  "module_static_state: set breakpoint here" $srcfile]
231
 
232
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
233
gdb_test "continue"         ".*/$srcfile:$breakloc.*" "forward to $breakloc"
234
 
235
gdb_test "print astatic" ".* = 0$newline"  "module static forward-breakpoint"
236
gdb_test "reverse-step"  ".*hide.*" ""
237
gdb_test "step"          ".*$newline$breakloc.*" ""
238
gdb_test "print astatic" ".* = 0$newline"  "module static forward step-to"
239
gdb_test "step"          ".* module static post-change .*" ""
240
gdb_test "print astatic" ".* = 1$newline"  "module static step post-change"
241
 
242
# Module global variable, forward
243
 
244
set breakloc [gdb_get_line_number \
245
                  "module_global_state: set breakpoint here" $srcfile]
246
 
247
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
248
gdb_test "continue"         ".*/$srcfile:$breakloc.*" "forward to $breakloc"
249
 
250
gdb_test "print aglobal" ".* = 0$newline"  "module global forward-breakpoint"
251
gdb_test "reverse-step"  ".*hide.*" ""
252
gdb_test "step"          ".*$newline$breakloc.*" ""
253
gdb_test "print aglobal" ".* = 0$newline"  "module global forward step-to"
254
gdb_test "step"          ".* module global post-change .*" ""
255
gdb_test "print aglobal" ".* = 1$newline"  "module global step post-change"
256
 

powered by: WebSVN 2.1.0

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