OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.2/] [gdb/] [testsuite/] [gdb.reverse/] [i386-reverse.exp] - Blame information for rev 357

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

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

powered by: WebSVN 2.1.0

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