1 # Copyright 2009, 2010, 2011 Free Software Foundation, Inc.
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.
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.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 # This file is part of the gdb testsuite.
18 # Test i386 displaced stepping.
25 if {(![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"]) || ![is_ilp32_target] } then {
26 verbose "Skipping x86 displaced stepping tests."
30 set testfile "i386-disp-step"
31 set srcfile ${testfile}.S
32 set binfile ${objdir}/${subdir}/${testfile}
34 set additional_flags "-Wa,-g"
36 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } {
37 untested i386-disp-step.exp
45 gdb_reinitialize_dir $srcdir/$subdir
48 gdb_test "set displaced-stepping on" ""
49 gdb_test "show displaced-stepping" ".* displaced stepping .* is on.*"
51 if ![runto_main] then {
52 fail "Can't run to main"
56 ##########################################
60 gdb_test "break test_call" \
61 "Breakpoint.*at.* file .*$srcfile, line.*" \
63 gdb_test "break test_call_end" \
64 "Breakpoint.*at.* file .*$srcfile, line.*" \
67 gdb_test "break test_ret" \
68 "Breakpoint.*at.* file .*$srcfile, line.*" \
70 gdb_test "break test_ret_end" \
71 "Breakpoint.*at.* file .*$srcfile, line.*" \
75 "Continuing.*Breakpoint.*, test_call ().*" \
76 "continue to test_call"
78 "Continuing.*Breakpoint.*, test_call_end ().*" \
79 "continue to test_call_end"
82 "Continuing.*Breakpoint.*, test_ret ().*" \
83 "continue to test_ret"
85 "Continuing.*Breakpoint.*, test_ret_end ().*" \
86 "continue to test_ret_end"
88 ##########################################
90 # Absolute jump with leading prefixes.
91 # These don't occur in normal code, but gdb should still DTRT.
93 gdb_test "break test_prefixed_abs_jump" \
94 "Breakpoint.*at.* file .*$srcfile, line.*" \
95 "break test_prefixed_abs_jump"
96 gdb_test "break test_prefixed_abs_jump_end" \
97 "Breakpoint.*at.* file .*$srcfile, line.*" \
98 "break test_prefixed_abs_jump_end"
100 gdb_test "continue" \
101 "Continuing.*Breakpoint.*, test_prefixed_abs_jump ().*" \
102 "continue to test_prefixed_abs_jump"
103 gdb_test "continue" \
104 "Continuing.*Breakpoint.*, test_prefixed_abs_jump_end ().*" \
105 "continue to test_prefixed_abs_jump_end"
107 ##########################################
111 gdb_test "break test_syscall" \
112 "Breakpoint.*at.* file .*$srcfile, line.*" \
114 gdb_test "break test_syscall_end" \
115 "Breakpoint.*at.* file .*$srcfile, line.*" \
116 "break test_syscall_end"
118 gdb_test "continue" \
119 "Continuing.*Breakpoint.*, test_syscall ().*" \
120 "continue to test_syscall"
121 gdb_test "continue" \
122 "Continuing.*Breakpoint.*, test_syscall_end ().*" \
123 "continue to test_syscall_end"
125 ##########################################
127 # Test prefixed syscall.
128 # These don't occur in normal code, but gdb should still DTRT.
130 gdb_test "break test_prefixed_syscall" \
131 "Breakpoint.*at.* file .*$srcfile, line.*" \
132 "break test_prefixed_syscall"
133 gdb_test "break test_prefixed_syscall_end" \
134 "Breakpoint.*at.* file .*$srcfile, line.*" \
135 "break test_prefixed_syscall_end"
137 gdb_test "continue" \
138 "Continuing.*Breakpoint.*, test_prefixed_syscall ().*" \
139 "continue to test_prefixed_syscall"
140 gdb_test "continue" \
141 "Continuing.*Breakpoint.*, test_prefixed_syscall_end ().*" \
142 "continue to test_prefixed_syscall_end"
144 ##########################################
146 # int3 (with prefixes)
147 # These don't occur in normal code, but gdb should still DTRT.
149 gdb_test "break test_int3" \
150 "Breakpoint.*at.* file .*$srcfile, line.*" \
152 gdb_test "break test_int3_end" \
153 "Breakpoint.*at.* file .*$srcfile, line.*" \
154 "break test_int3_end"
156 gdb_test "continue" \
157 "Continuing.*Breakpoint.*, test_int3 ().*" \
158 "continue to test_int3"
160 gdb_test "continue" \
161 "Continuing.*Breakpoint.*, test_int3_end ().*" \
162 "continue to test_int3_end"
164 ##########################################
166 # Done, run program to exit.
168 gdb_continue_to_end "i386-disp-step"