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.exp] - Blame information for rev 387

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 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 "record" "" "Turn on process record"
62
    # FIXME: command ought to acknowledge, so we can test if it succeeded.
63
}
64
 
65
# Proceed to end of main
66
 
67
gdb_test "break $endmain" \
68
    "Breakpoint.* file .*/$srcfile, line $endmain.*" ""
69
gdb_continue_to_breakpoint "end of main" ".*/$srcfile:$endmain.*"
70
 
71
###
72
###
73
###
74
 
75
# Now run backward to each of several points where data is changed.
76
#
77
 
78
# Module global variable, reverse
79
 
80
set breakloc [gdb_get_line_number \
81
                  "module_global_state: set breakpoint here" $srcfile]
82
 
83
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
84
gdb_test "reverse-continue" ".*/$srcfile:$breakloc.*" "reverse to $breakloc"
85
 
86
gdb_test "print aglobal" ".* = 0$newline"  "module global reverse-breakpoint"
87
gdb_test "step"          ".* module global post-change .*" ""
88
gdb_test "print aglobal" ".* = 1$newline"  "module global forward past bp"
89
gdb_test "reverse-step"  ".*$newline$breakloc.*" ""
90
gdb_test "print aglobal" ".* = 0$newline"  "module global reverse-step to bp"
91
 
92
 
93
# Module static variable, reverse
94
 
95
set breakloc [gdb_get_line_number \
96
                  "module_static_state: set breakpoint here" $srcfile]
97
 
98
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
99
gdb_test "reverse-continue" ".*/$srcfile:$breakloc.*" "reverse to $breakloc"
100
 
101
gdb_test "print astatic" ".* = 0$newline"  "module static reverse-breakpoint"
102
gdb_test "step"          ".* module static post-change .*" ""
103
gdb_test "print astatic" ".* = 1$newline"  "module static forward"
104
gdb_test "reverse-step"  ".*$newline$breakloc.*" ""
105
gdb_test "print astatic" ".* = 0$newline"  "module static reverse-step"
106
 
107
# Function static variable, reverse
108
 
109
set breakloc [gdb_get_line_number \
110
                  "function_static_state: set breakpoint here" $srcfile]
111
 
112
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
113
gdb_test "reverse-continue" ".*/$srcfile:$breakloc.*" "reverse to $breakloc"
114
 
115
gdb_test "print a"      ".* = 0$newline"  "function static reverse-breakpoint"
116
gdb_test "step"         ".* function static post-change .*" ""
117
gdb_test "print a"      ".* = 1$newline"  "function static forward"
118
gdb_test "reverse-step" ".*$newline$breakloc.*" ""
119
gdb_test "print a"      ".* = 0$newline"  "function static reverse-step"
120
 
121
# Auto variable, reverse
122
 
123
set breakloc [gdb_get_line_number \
124
                  "auto_state: set breakpoint here" $srcfile]
125
 
126
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
127
gdb_test "reverse-continue" ".*/$srcfile:$breakloc.*" "reverse to $breakloc"
128
 
129
gdb_test "print a"      ".* = 0$newline"  "auto var reverse-breakpoint"
130
gdb_test "step"         ".* auto post-change .*" ""
131
gdb_test "print a"      ".* = 1$newline"  "auto var forward"
132
gdb_test "reverse-step" ".*$newline$breakloc.*" ""
133
gdb_test "print a"      ".* = 0$newline"  "auto var reverse-step"
134
 
135
# Register variable, reverse
136
 
137
set breakloc [gdb_get_line_number \
138
                  "register_state: set breakpoint here" $srcfile]
139
 
140
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
141
gdb_test "reverse-continue" ".*/$srcfile:$breakloc.*" "reverse to $breakloc"
142
 
143
gdb_test "print a"      ".* = 0$newline"  "register var reverse-breakpoint"
144
gdb_test "step"         ".* register post-change .*" ""
145
gdb_test "print a"      ".* = 1$newline"  "register var step post-change"
146
gdb_test "reverse-step" ".*$newline$breakloc.*" ""
147
gdb_test "print a"      ".* = 0$newline"  "register var reverse step-to"
148
 
149
# Proceed to beginning of main
150
 
151
gdb_test "tbreak $beginmain" ".*/$srcfile, line $beginmain.*" ""
152
gdb_test "reverse-continue"  ".*/$srcfile:$beginmain.*" "reverse to main"
153
 
154
# Now repeat tests while replaying forward.
155
 
156
# Register variable, forward
157
 
158
set breakloc [gdb_get_line_number \
159
                  "register_state: set breakpoint here" $srcfile]
160
 
161
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
162
gdb_test "continue"         ".*/$srcfile:$breakloc.*" "forward to $breakloc"
163
 
164
gdb_test "print a"      ".* = 0$newline"  "register var forward-breakpoint"
165
gdb_test "reverse-step" ".*hide.*" ""
166
gdb_test "step"         ".*$newline$breakloc.*" ""
167
gdb_test "print a"      ".* = 0$newline"  "register var forward step-to"
168
gdb_test "step"         ".* register post-change .*" ""
169
gdb_test "print a"      ".* = 1$newline"  "register var step post-change"
170
 
171
# Auto variable, forward
172
 
173
set breakloc [gdb_get_line_number \
174
                  "auto_state: set breakpoint here" $srcfile]
175
 
176
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
177
gdb_test "continue"         ".*/$srcfile:$breakloc.*" "forward to $breakloc"
178
 
179
gdb_test "print a"      ".* = 0$newline"  "auto var forward-breakpoint"
180
gdb_test "reverse-step" ".*hide.*" ""
181
gdb_test "step"         ".*$newline$breakloc.*" ""
182
gdb_test "print a"      ".* = 0$newline"  "auto var forward step-to"
183
gdb_test "step"         ".* auto post-change .*" ""
184
gdb_test "print a"      ".* = 1$newline"  "auto var step post-change"
185
 
186
# Function static variable, forward
187
 
188
set breakloc [gdb_get_line_number \
189
                  "function_static_state: set breakpoint here" $srcfile]
190
 
191
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
192
gdb_test "continue"         ".*/$srcfile:$breakloc.*" "forward to $breakloc"
193
 
194
gdb_test "print a"      ".* = 0$newline"  "function static forward-breakpoint"
195
gdb_test "reverse-step" ".*hide.*" ""
196
gdb_test "step"         ".*$newline$breakloc.*" ""
197
gdb_test "print a"      ".* = 0$newline"  "function static forward step-to"
198
gdb_test "step"         ".* function static post-change .*" ""
199
gdb_test "print a"      ".* = 1$newline"  "function static step post-change"
200
 
201
# Module static variable, forward
202
 
203
set breakloc [gdb_get_line_number \
204
                  "module_static_state: set breakpoint here" $srcfile]
205
 
206
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
207
gdb_test "continue"         ".*/$srcfile:$breakloc.*" "forward to $breakloc"
208
 
209
gdb_test "print astatic" ".* = 0$newline"  "module static forward-breakpoint"
210
gdb_test "reverse-step"  ".*hide.*" ""
211
gdb_test "step"          ".*$newline$breakloc.*" ""
212
gdb_test "print astatic" ".* = 0$newline"  "module static forward step-to"
213
gdb_test "step"          ".* module static post-change .*" ""
214
gdb_test "print astatic" ".* = 1$newline"  "module static step post-change"
215
 
216
# Module global variable, forward
217
 
218
set breakloc [gdb_get_line_number \
219
                  "module_global_state: set breakpoint here" $srcfile]
220
 
221
gdb_test "tbreak $breakloc" ".*/$srcfile, line $breakloc.*" ""
222
gdb_test "continue"         ".*/$srcfile:$breakloc.*" "forward to $breakloc"
223
 
224
gdb_test "print aglobal" ".* = 0$newline"  "module global forward-breakpoint"
225
gdb_test "reverse-step"  ".*hide.*" ""
226
gdb_test "step"          ".*$newline$breakloc.*" ""
227
gdb_test "print aglobal" ".* = 0$newline"  "module global forward step-to"
228
gdb_test "step"          ".* module global post-change .*" ""
229
gdb_test "print aglobal" ".* = 1$newline"  "module global step post-change"
230
 

powered by: WebSVN 2.1.0

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