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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gdb-7.2/] [gdb/] [testsuite/] [gdb.reverse/] [machinestate.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.
17
# This test tests the restoration of various kinds of machine state
18
# to their original values by reverse execution.  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
if ![target_info exists gdb,can_reverse] {
39
    return
40
}
41
 
42
set testfile "machinestate"
43
set srcfile  ${testfile}.c
44
set srcfile1 ms1.c
45
 
46
if { [prepare_for_testing $testfile.exp $testfile {machinestate.c ms1.c} ] } {
47
    return -1
48
}
49
 
50
set newline "\[\r\n\]+"
51
 
52
set beginmain [gdb_get_line_number " begin main " $srcfile]
53
set endmain   [gdb_get_line_number " end main "   $srcfile]
54
 
55
# Test begins
56
 
57
runto main
58
 
59
if [target_info exists gdb,use_precord] {
60
    # Activate process record/replay
61
    gdb_test_no_output "record" "Turn on process record"
62
}
63
 
64
# Proceed to end of main
65
 
66
gdb_test "break $endmain" \
67
    "Breakpoint.* file .*/$srcfile, line $endmain.*" ""
68
gdb_continue_to_breakpoint "end of main" ".*/$srcfile:$endmain.*"
69
 
70
###
71
###
72
###
73
 
74
# Now run backward to each of several points where data is changed.
75
#
76
 
77
# Module global variable, reverse
78
 
79
set breakloc [gdb_get_line_number \
80
                  "module_global_state: set breakpoint here" $srcfile]
81
 
82
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
83
gdb_test "reverse-continue" ".*/$srcfile:$breakloc.*" "reverse to $breakloc"
84
 
85
gdb_test "print aglobal" ".* = 0$newline"  "module global reverse-breakpoint"
86
gdb_test "step"          ".* module global post-change .*" ""
87
gdb_test "print aglobal" ".* = 1$newline"  "module global forward past bp"
88
gdb_test "reverse-step"  ".*$newline$breakloc.*" ""
89
gdb_test "print aglobal" ".* = 0$newline"  "module global reverse-step to bp"
90
 
91
 
92
# Module static variable, reverse
93
 
94
set breakloc [gdb_get_line_number \
95
                  "module_static_state: set breakpoint here" $srcfile]
96
 
97
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
98
gdb_test "reverse-continue" ".*/$srcfile:$breakloc.*" "reverse to $breakloc"
99
 
100
gdb_test "print astatic" ".* = 0$newline"  "module static reverse-breakpoint"
101
gdb_test "step"          ".* module static post-change .*" ""
102
gdb_test "print astatic" ".* = 1$newline"  "module static forward"
103
gdb_test "reverse-step"  ".*$newline$breakloc.*" ""
104
gdb_test "print astatic" ".* = 0$newline"  "module static reverse-step"
105
 
106
# Function static variable, reverse
107
 
108
set breakloc [gdb_get_line_number \
109
                  "function_static_state: set breakpoint here" $srcfile]
110
 
111
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
112
gdb_test "reverse-continue" ".*/$srcfile:$breakloc.*" "reverse to $breakloc"
113
 
114
gdb_test "print a"      ".* = 0$newline"  "function static reverse-breakpoint"
115
gdb_test "step"         ".* function static post-change .*" ""
116
gdb_test "print a"      ".* = 1$newline"  "function static forward"
117
gdb_test "reverse-step" ".*$newline$breakloc.*" ""
118
gdb_test "print a"      ".* = 0$newline"  "function static reverse-step"
119
 
120
# Auto variable, reverse
121
 
122
set breakloc [gdb_get_line_number \
123
                  "auto_state: set breakpoint here" $srcfile]
124
 
125
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
126
gdb_test "reverse-continue" ".*/$srcfile:$breakloc.*" "reverse to $breakloc"
127
 
128
gdb_test "print a"      ".* = 0$newline"  "auto var reverse-breakpoint"
129
gdb_test "step"         ".* auto post-change .*" ""
130
gdb_test "print a"      ".* = 1$newline"  "auto var forward"
131
gdb_test "reverse-step" ".*$newline$breakloc.*" ""
132
gdb_test "print a"      ".* = 0$newline"  "auto var reverse-step"
133
 
134
# Register variable, reverse
135
 
136
set breakloc [gdb_get_line_number \
137
                  "register_state: set breakpoint here" $srcfile]
138
 
139
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
140
gdb_test "reverse-continue" ".*/$srcfile:$breakloc.*" "reverse to $breakloc"
141
 
142
gdb_test "print a"      ".* = 0$newline"  "register var reverse-breakpoint"
143
gdb_test "step"         ".* register post-change .*" ""
144
gdb_test "print a"      ".* = 1$newline"  "register var step post-change"
145
gdb_test "reverse-step" ".*$newline$breakloc.*" ""
146
gdb_test "print a"      ".* = 0$newline"  "register var reverse step-to"
147
 
148
# Proceed to beginning of main
149
 
150
gdb_test "tbreak $beginmain" ".*/$srcfile, line $beginmain.*" ""
151
gdb_test "reverse-continue"  ".*/$srcfile:$beginmain.*" "reverse to main"
152
 
153
# Now repeat tests while replaying forward.
154
 
155
# Register variable, forward
156
 
157
set breakloc [gdb_get_line_number \
158
                  "register_state: set breakpoint here" $srcfile]
159
 
160
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
161
gdb_test "continue"         ".*/$srcfile:$breakloc.*" "forward to $breakloc"
162
 
163
gdb_test "print a"      ".* = 0$newline"  "register var forward-breakpoint"
164
gdb_test "reverse-step" ".*hide.*" ""
165
gdb_test "step"         ".*$newline$breakloc.*" ""
166
gdb_test "print a"      ".* = 0$newline"  "register var forward step-to"
167
gdb_test "step"         ".* register post-change .*" ""
168
gdb_test "print a"      ".* = 1$newline"  "register var step post-change"
169
 
170
# Auto variable, forward
171
 
172
set breakloc [gdb_get_line_number \
173
                  "auto_state: set breakpoint here" $srcfile]
174
 
175
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
176
gdb_test "continue"         ".*/$srcfile:$breakloc.*" "forward to $breakloc"
177
 
178
gdb_test "print a"      ".* = 0$newline"  "auto var forward-breakpoint"
179
gdb_test "reverse-step" ".*hide.*" ""
180
gdb_test "step"         ".*$newline$breakloc.*" ""
181
gdb_test "print a"      ".* = 0$newline"  "auto var forward step-to"
182
gdb_test "step"         ".* auto post-change .*" ""
183
gdb_test "print a"      ".* = 1$newline"  "auto var step post-change"
184
 
185
# Function static variable, forward
186
 
187
set breakloc [gdb_get_line_number \
188
                  "function_static_state: set breakpoint here" $srcfile]
189
 
190
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
191
gdb_test "continue"         ".*/$srcfile:$breakloc.*" "forward to $breakloc"
192
 
193
gdb_test "print a"      ".* = 0$newline"  "function static forward-breakpoint"
194
gdb_test "reverse-step" ".*hide.*" ""
195
gdb_test "step"         ".*$newline$breakloc.*" ""
196
gdb_test "print a"      ".* = 0$newline"  "function static forward step-to"
197
gdb_test "step"         ".* function static post-change .*" ""
198
gdb_test "print a"      ".* = 1$newline"  "function static step post-change"
199
 
200
# Module static variable, forward
201
 
202
set breakloc [gdb_get_line_number \
203
                  "module_static_state: set breakpoint here" $srcfile]
204
 
205
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
206
gdb_test "continue"         ".*/$srcfile:$breakloc.*" "forward to $breakloc"
207
 
208
gdb_test "print astatic" ".* = 0$newline"  "module static forward-breakpoint"
209
gdb_test "reverse-step"  ".*hide.*" ""
210
gdb_test "step"          ".*$newline$breakloc.*" ""
211
gdb_test "print astatic" ".* = 0$newline"  "module static forward step-to"
212
gdb_test "step"          ".* module static post-change .*" ""
213
gdb_test "print astatic" ".* = 1$newline"  "module static step post-change"
214
 
215
# Module global variable, forward
216
 
217
set breakloc [gdb_get_line_number \
218
                  "module_global_state: set breakpoint here" $srcfile]
219
 
220
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
221
gdb_test "continue"         ".*/$srcfile:$breakloc.*" "forward to $breakloc"
222
 
223
gdb_test "print aglobal" ".* = 0$newline"  "module global forward-breakpoint"
224
gdb_test "reverse-step"  ".*hide.*" ""
225
gdb_test "step"          ".*$newline$breakloc.*" ""
226
gdb_test "print aglobal" ".* = 0$newline"  "module global forward step-to"
227
gdb_test "step"          ".* module global post-change .*" ""
228
gdb_test "print aglobal" ".* = 1$newline"  "module global step post-change"
229
 

powered by: WebSVN 2.1.0

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