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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.arch/] [amd64-disp-step.exp] - Blame information for rev 227

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
# Test amd64 displaced stepping.
19
 
20
if $tracelevel {
21
    strace $tracelevel
22
}
23
 
24
set prms_id 0
25
set bug_id 0
26
 
27
if ![istarget "x86_64-*-linux*"] then {
28
    verbose "Skipping x86_64 displaced stepping tests."
29
    return
30
}
31
 
32
set newline "\[\r\n\]*"
33
 
34
set testfile "amd64-disp-step"
35
set srcfile ${testfile}.S
36
set binfile ${objdir}/${subdir}/${testfile}
37
 
38
set additional_flags "-Wa,-g"
39
 
40
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } {
41
    untested amd64-disp-step.exp
42
    return -1
43
}
44
 
45
# Get things started.
46
 
47
gdb_exit
48
gdb_start
49
gdb_reinitialize_dir $srcdir/$subdir
50
gdb_load ${binfile}
51
 
52
gdb_test "set displaced-stepping on" ""
53
gdb_test "show displaced-stepping" ".* displaced stepping .* is on.*"
54
 
55
if ![runto_main] then {
56
    fail "Can't run to main"
57
    return 0
58
}
59
 
60
##########################################
61
 
62
# Test call/ret.
63
 
64
gdb_test "break test_call" \
65
    "Breakpoint.*at.* file .*$srcfile, line.*" \
66
    "break test_call"
67
gdb_test "break test_call_end" \
68
    "Breakpoint.*at.* file .*$srcfile, line.*" \
69
    "break test_call_end"
70
 
71
gdb_test "break test_ret" \
72
    "Breakpoint.*at.* file .*$srcfile, line.*" \
73
    "break test_ret"
74
gdb_test "break test_ret_end" \
75
    "Breakpoint.*at.* file .*$srcfile, line.*" \
76
    "break test_ret_end"
77
 
78
gdb_test "continue" \
79
    "Continuing.*Breakpoint.*, test_call ().*" \
80
    "continue to test_call"
81
gdb_test "continue" \
82
    "Continuing.*Breakpoint.*, test_call_end ().*" \
83
    "continue to test_call_end"
84
 
85
gdb_test "continue" \
86
    "Continuing.*Breakpoint.*, test_ret ().*" \
87
    "continue to test_ret"
88
gdb_test "continue" \
89
    "Continuing.*Breakpoint.*, test_ret_end ().*" \
90
    "continue to test_ret_end"
91
 
92
##########################################
93
 
94
# Test abs-jmp/rep-ret.
95
 
96
gdb_test "break test_abs_jmp" \
97
    "Breakpoint.*at.* file .*$srcfile, line.*" \
98
    "break test_abs_jmp"
99
gdb_test "break test_abs_jmp_end" \
100
    "Breakpoint.*at.* file .*$srcfile, line.*" \
101
    "break test_abs_jmp_end"
102
 
103
gdb_test "break test_rep_ret" \
104
    "Breakpoint.*at.* file .*$srcfile, line.*" \
105
    "break test_rep_ret"
106
gdb_test "break test_rep_ret_end" \
107
    "Breakpoint.*at.* file .*$srcfile, line.*" \
108
    "break test_rep_ret_end"
109
 
110
gdb_test "continue" \
111
    "Continuing.*Breakpoint.*, test_abs_jmp ().*" \
112
    "continue to test_abs_jmp"
113
gdb_test "continue" \
114
    "Continuing.*Breakpoint.*, test_abs_jmp_end ().*" \
115
    "continue to test_abs_jmp_end"
116
 
117
gdb_test "continue" \
118
    "Continuing.*Breakpoint.*, test_rep_ret ().*" \
119
    "continue to test_rep_ret"
120
gdb_test "continue" \
121
    "Continuing.*Breakpoint.*, test_rep_ret_end ().*" \
122
    "continue to test_rep_ret_end"
123
 
124
##########################################
125
 
126
# Test syscall.
127
 
128
gdb_test "break test_syscall" \
129
    "Breakpoint.*at.* file .*$srcfile, line.*" \
130
    "break test_syscall"
131
gdb_test "break test_syscall_end" \
132
    "Breakpoint.*at.* file .*$srcfile, line.*" \
133
    "break test_syscall_end"
134
 
135
gdb_test "continue" \
136
    "Continuing.*Breakpoint.*, test_syscall ().*" \
137
    "continue to test_syscall"
138
gdb_test "continue" \
139
    "Continuing.*Breakpoint.*, test_syscall_end ().*" \
140
    "continue to test_syscall_end"
141
 
142
##########################################
143
 
144
# int3 (with prefixes)
145
# These don't occur in normal code, but gdb should still DTRT.
146
 
147
gdb_test "break test_int3" \
148
    "Breakpoint.*at.* file .*$srcfile, line.*" \
149
    "break test_int3"
150
gdb_test "break test_int3_end" \
151
    "Breakpoint.*at.* file .*$srcfile, line.*" \
152
    "break test_int3_end"
153
 
154
gdb_test "continue" \
155
    "Continuing.*Breakpoint.*, test_int3 ().*" \
156
    "continue to test_int3"
157
 
158
gdb_test "continue" \
159
    "Continuing.*Breakpoint.*, test_int3_end ().*" \
160
    "continue to test_int3_end"
161
 
162
##########################################
163
 
164
# Test rip-relative.
165
# GDB picks a spare register to hold the rip-relative address.
166
# Exercise all the possibilities (rax-rdi, sans rsp).
167
 
168
# The order must much the order in srcfile.
169
set rip_regs { "rax" "rbx" "rcx" "rdx" "rbp" "rsi" "rdi" }
170
 
171
# Assign val to all specified regs.
172
 
173
proc set_regs { regs val } {
174
    global gdb_prompt
175
 
176
    foreach reg ${regs} {
177
        # Use send_gdb/gdb_expect so that these aren't logged as pass/fail.
178
        send_gdb "set \$${reg} = ${val}\n"
179
        gdb_expect 10 {
180
            -re "$gdb_prompt $" {
181
                verbose "Setting ${reg} to ${val}." 2
182
            }
183
            timeout {
184
                warning "Couldn't set ${reg} to ${val}."
185
            }
186
        }
187
    }
188
}
189
 
190
# Verify all REGS equal VAL, except REG which equals REG_VAL.
191
 
192
proc verify_regs { test_name regs val except_reg except_reg_val } {
193
    global newline
194
 
195
    foreach reg ${regs} {
196
        set expected ${val}
197
        if { "${reg}" == "${except_reg}" } {
198
            set expected ${except_reg_val}
199
        }
200
        # The cast to (int) is because RBP is printed as a pointer.
201
        gdb_test "p (int) \$${reg}" " = ${expected}${newline}" "${test_name} ${reg} expected value"
202
    }
203
}
204
 
205
proc rip_test { reg } {
206
    global srcfile rip_regs
207
 
208
    set test_start_label "test_rip_${reg}"
209
    set test_end_label "test_rip_${reg}_end"
210
 
211
    gdb_test "break ${test_start_label}" \
212
        "Breakpoint.*at.* file .*$srcfile, line.*" \
213
        "break ${test_start_label}"
214
    gdb_test "break ${test_end_label}" \
215
        "Breakpoint.*at.* file .*$srcfile, line.*" \
216
        "break ${test_end_label}"
217
 
218
    gdb_test "continue" \
219
        "Continuing.*Breakpoint.*, ${test_start_label} ().*" \
220
        "continue to ${test_start_label}"
221
 
222
    set_regs ${rip_regs} 0
223
 
224
    gdb_test "continue" \
225
        "Continuing.*Breakpoint.*, ${test_end_label} ().*" \
226
        "continue to ${test_end_label}"
227
 
228
    verify_regs "test rip w/${reg}" ${rip_regs} 0 ${reg} 42
229
}
230
 
231
foreach reg ${rip_regs} {
232
    rip_test $reg
233
}
234
 
235
##########################################
236
 
237
# Done, run program to exit.
238
 
239
gdb_continue_to_end "amd64-disp-step"

powered by: WebSVN 2.1.0

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