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/] [i386-reverse.exp] - Blame information for rev 252

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

Line No. Rev Author Line
1 227 jeremybenn
# Copyright 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
 
18
#
19
# This test tests some i386 general instructions for reverse execution.
20
#
21
 
22
if ![target_info exists gdb,can_reverse] {
23
    return
24
}
25
 
26
if $tracelevel {
27
    strace $tracelevel
28
}
29
 
30
set prms_id 0
31
set bug_id 0
32
 
33
if ![istarget "i?86-*linux*"] then {
34
    verbose "Skipping i386 reverse tests."
35
    return
36
}
37
 
38
set testfile "i386-reverse"
39
set srcfile ${testfile}.c
40
set binfile ${objdir}/${subdir}/${testfile}
41
 
42
# some targets have leading underscores on assembly symbols.
43
# TODO: detect this automatically
44
set additional_flags ""
45
if [istarget "i?86-*-cygwin*"] then {
46
  set additional_flags "additional_flags=-DSYMBOL_PREFIX=\"_\""
47
}
48
 
49
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } {
50
    untested i386-reverse
51
    return -1
52
}
53
 
54
set end_of_main          [gdb_get_line_number " end of main "]
55
set end_of_inc_dec_tests [gdb_get_line_number " end inc_dec_tests "]
56
 
57
# Get things started.
58
 
59
gdb_exit
60
gdb_start
61
gdb_reinitialize_dir $srcdir/$subdir
62
gdb_load ${binfile}
63
runto main
64
 
65
if [target_info exists gdb,use_precord] {
66
    # Activate process record/replay
67
    gdb_test "record" "" "Turn on process record"
68
    # FIXME: command ought to acknowledge, so we can test if it succeeded.
69
}
70
 
71
global hex
72
global decimal
73
 
74
gdb_test "step" "inc .eax.*" "step to inc eax 1st time"
75
send_gdb "info reg eax\n"
76
gdb_expect {
77
    -re "eax *($hex)\t.*$gdb_prompt " {
78
        set preinc_eax $expect_out(1,string)
79
    }
80
}
81
 
82
gdb_test "step" "inc .ecx.*" "step to inc ecx 1st time"
83
send_gdb "info reg ecx\n"
84
gdb_expect {
85
    -re "ecx *($hex)\t.*$gdb_prompt " {
86
        set preinc_ecx $expect_out(1,string)
87
    }
88
}
89
 
90
gdb_test "step" "inc .edx.*" "step to inc edx 1st time"
91
send_gdb "info reg edx\n"
92
gdb_expect {
93
    -re "edx *($hex)\t.*$gdb_prompt " {
94
        set preinc_edx $expect_out(1,string)
95
    }
96
}
97
 
98
gdb_test "step" "inc .ebx.*" "step to inc ebx 1st time"
99
send_gdb "info reg ebx\n"
100
gdb_expect {
101
    -re "ebx *($hex)\t.*$gdb_prompt " {
102
        set preinc_ebx $expect_out(1,string)
103
    }
104
}
105
 
106
gdb_test "step" "inc .esp.*" "step to inc esp 1st time"
107
send_gdb "info reg esp\n"
108
gdb_expect {
109
    -re "esp *($hex)\t.*$gdb_prompt " {
110
        set preinc_esp $expect_out(1,string)
111
    }
112
}
113
 
114
gdb_test "step" "inc .ebp.*" "step to inc ebp 1st time"
115
send_gdb "info reg ebp\n"
116
gdb_expect {
117
    -re "ebp *($hex)\t.*$gdb_prompt " {
118
        set preinc_ebp $expect_out(1,string)
119
    }
120
}
121
 
122
gdb_test "step" "inc .esi.*" "step to inc esi 1st time"
123
send_gdb "info reg esi\n"
124
gdb_expect {
125
    -re "esi *($hex)\t.*$gdb_prompt " {
126
        set preinc_esi $expect_out(1,string)
127
    }
128
}
129
 
130
gdb_test "step" "inc .edi.*" "step to inc edi 1st time"
131
send_gdb "info reg edi\n"
132
gdb_expect {
133
    -re "edi *($hex)\t.*$gdb_prompt " {
134
        set preinc_edi $expect_out(1,string)
135
    }
136
}
137
 
138
gdb_test "step" "dec .eax.*" "step to dec eax 1st time"
139
send_gdb "info reg eax\n"
140
gdb_expect {
141
    -re "eax *($hex)\t.*$gdb_prompt " {
142
        set predec_eax $expect_out(1,string)
143
    }
144
}
145
 
146
gdb_test "step" "dec .ecx.*" "step to dec ecx 1st time"
147
send_gdb "info reg ecx\n"
148
gdb_expect {
149
    -re "ecx *($hex)\t.*$gdb_prompt " {
150
        set predec_ecx $expect_out(1,string)
151
    }
152
}
153
 
154
gdb_test "step" "dec .edx.*" "step to dec edx 1st time"
155
send_gdb "info reg edx\n"
156
gdb_expect {
157
    -re "edx *($hex)\t.*$gdb_prompt " {
158
        set predec_edx $expect_out(1,string)
159
    }
160
}
161
 
162
gdb_test "step" "dec .ebx.*" "step to dec ebx 1st time"
163
send_gdb "info reg ebx\n"
164
gdb_expect {
165
    -re "ebx *($hex)\t.*$gdb_prompt " {
166
        set predec_ebx $expect_out(1,string)
167
    }
168
}
169
 
170
gdb_test "step" "dec .esp.*" "step to dec esp 1st time"
171
send_gdb "info reg esp\n"
172
gdb_expect {
173
    -re "esp *($hex)\t.*$gdb_prompt " {
174
        set predec_esp $expect_out(1,string)
175
    }
176
}
177
 
178
gdb_test "step" "dec .ebp.*" "step to dec ebp 1st time"
179
send_gdb "info reg ebp\n"
180
gdb_expect {
181
    -re "ebp *($hex)\t.*$gdb_prompt " {
182
        set predec_ebp $expect_out(1,string)
183
    }
184
}
185
 
186
gdb_test "step" "dec .esi.*" "step to dec esi 1st time"
187
send_gdb "info reg esi\n"
188
gdb_expect {
189
    -re "esi *($hex)\t.*$gdb_prompt " {
190
        set predec_esi $expect_out(1,string)
191
    }
192
}
193
 
194
gdb_test "step" "dec .edi.*" "step to dec edi 1st time"
195
send_gdb "info reg edi\n"
196
gdb_expect {
197
    -re "edi *($hex)\t.*$gdb_prompt " {
198
        set predec_edi $expect_out(1,string)
199
    }
200
}
201
 
202
# gdb_test "step" "end inc_dec_tests .*" "step to end inc_dec_tests 1st time"
203
 
204
gdb_test "break $end_of_main" \
205
    "Breakpoint $decimal at .* line $end_of_main\." \
206
    "set breakpoint at end of main"
207
 
208
gdb_test "continue" \
209
    " end of main .*" \
210
    "continue to end of main"
211
 
212
gdb_test "break $end_of_inc_dec_tests" \
213
    "Breakpoint $decimal at .* line $end_of_inc_dec_tests\." \
214
    "set breakpoint at end of inc_dec_tests"
215
 
216
gdb_test "reverse-continue" \
217
    " end inc_dec_tests .*" \
218
    "reverse to inc_dec_tests"
219
 
220
#
221
# Now reverse step, and check register values.
222
#
223
 
224
gdb_test "info reg edi" "edi *$preinc_edi\t.*" "edi before reverse-dec"
225
gdb_test "reverse-step" "dec .edi.*" "reverse-step to dec edi"
226
gdb_test "info reg edi" "edi *$predec_edi\t.*" "edi after reverse-dec"
227
 
228
gdb_test "info reg esi" "esi *$preinc_esi\t.*" "esi before reverse-dec"
229
gdb_test "reverse-step" "dec .esi.*" "reverse-step to dec esi"
230
gdb_test "info reg esi" "esi *$predec_esi\t.*" "esi after reverse-dec"
231
 
232
gdb_test "info reg ebp" "ebp *$preinc_ebp\t.*" "ebp before reverse-dec"
233
gdb_test "reverse-step" "dec .ebp.*" "reverse-step to dec ebp"
234
gdb_test "info reg ebp" "ebp *$predec_ebp\t.*" "ebp after reverse-dec"
235
 
236
gdb_test "info reg esp" "esp *$preinc_esp\t.*" "esp before reverse-dec"
237
gdb_test "reverse-step" "dec .esp.*" "reverse-step to dec esp"
238
gdb_test "info reg esp" "esp *$predec_esp\t.*" "esp after reverse-dec"
239
 
240
gdb_test "info reg ebx" "ebx *$preinc_ebx\t.*" "ebx before reverse-dec"
241
gdb_test "reverse-step" "dec .ebx.*" "reverse-step to dec ebx"
242
gdb_test "info reg ebx" "ebx *$predec_ebx\t.*" "ebx after reverse-dec"
243
 
244
gdb_test "info reg edx" "edx *$preinc_edx\t.*" "edx before reverse-dec"
245
gdb_test "reverse-step" "dec .edx.*" "reverse-step to dec edx"
246
gdb_test "info reg edx" "edx *$predec_edx\t.*" "edx after reverse-dec"
247
 
248
gdb_test "info reg ecx" "ecx *$preinc_ecx\t.*" "ecx before reverse-dec"
249
gdb_test "reverse-step" "dec .ecx.*" "reverse-step to dec ecx"
250
gdb_test "info reg ecx" "ecx *$predec_ecx\t.*" "ecx after reverse-dec"
251
 
252
gdb_test "info reg eax" "eax *$preinc_eax\t.*" "eax before reverse-dec"
253
gdb_test "reverse-step" "dec .eax.*" "reverse-step to dec eax"
254
gdb_test "info reg eax" "eax *$predec_eax\t.*" "eax after reverse-dec"
255
 
256
gdb_test "info reg edi" "edi *$predec_edi\t.*" "edi before reverse-inc"
257
gdb_test "reverse-step" "inc .edi.*" "reverse-step to inc edi"
258
gdb_test "info reg edi" "edi *$preinc_edi\t.*" "edi after reverse-inc"
259
 
260
gdb_test "info reg esi" "esi *$predec_esi\t.*" "esi before reverse-inc"
261
gdb_test "reverse-step" "inc .esi.*" "reverse-step to inc esi"
262
gdb_test "info reg esi" "esi *$preinc_esi\t.*" "esi after reverse-inc"
263
 
264
gdb_test "info reg ebp" "ebp *$predec_ebp\t.*" "ebp before reverse-inc"
265
gdb_test "reverse-step" "inc .ebp.*" "reverse-step to inc ebp"
266
gdb_test "info reg ebp" "ebp *$preinc_ebp\t.*" "ebp after reverse-inc"
267
 
268
gdb_test "info reg esp" "esp *$predec_esp\t.*" "esp before reverse-inc"
269
gdb_test "reverse-step" "inc .esp.*" "reverse-step to inc esp"
270
gdb_test "info reg esp" "esp *$preinc_esp\t.*" "esp after reverse-inc"
271
 
272
gdb_test "info reg ebx" "ebx *$predec_ebx\t.*" "ebx before reverse-inc"
273
gdb_test "reverse-step" "inc .ebx.*" "reverse-step to inc ebx"
274
gdb_test "info reg ebx" "ebx *$preinc_ebx\t.*" "ebx after reverse-inc"
275
 
276
gdb_test "info reg edx" "edx *$predec_edx\t.*" "edx before reverse-inc"
277
gdb_test "reverse-step" "inc .edx.*" "reverse-step to inc edx"
278
gdb_test "info reg edx" "edx *$preinc_edx\t.*" "edx after reverse-inc"
279
 
280
gdb_test "info reg ecx" "ecx *$predec_ecx\t.*" "ecx before reverse-inc"
281
gdb_test "reverse-step" "inc .ecx.*" "reverse-step to inc ecx"
282
gdb_test "info reg ecx" "ecx *$preinc_ecx\t.*" "ecx after reverse-inc"
283
 
284
gdb_test "info reg eax" "eax *$predec_eax\t.*" "eax before reverse-inc"
285
gdb_test "reverse-step" "inc .eax.*" "reverse-step to inc eax"
286
gdb_test "info reg eax" "eax *$preinc_eax\t.*" "eax after reverse-inc"
287
 
288
 

powered by: WebSVN 2.1.0

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