1 # Copyright 2009-2014 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.
21 if { ![is_x86_like_target] } then {
22 verbose "Skipping x86 displaced stepping tests."
28 set additional_flags "-Wa,-g"
30 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } {
31 untested i386-disp-step.exp
39 gdb_reinitialize_dir $srcdir/$subdir
42 gdb_test "set displaced-stepping on" ""
43 gdb_test "show displaced-stepping" ".* displaced stepping .* is on.*"
45 if ![runto_main] then {
46 fail "Can't run to main"
50 ##########################################
54 gdb_test "break test_call" \
55 "Breakpoint.*at.* file .*$srcfile, line.*" \
57 gdb_test "break test_call_end" \
58 "Breakpoint.*at.* file .*$srcfile, line.*" \
61 gdb_test "break test_ret" \
62 "Breakpoint.*at.* file .*$srcfile, line.*" \
64 gdb_test "break test_ret_end" \
65 "Breakpoint.*at.* file .*$srcfile, line.*" \
69 "Continuing.*Breakpoint.*, test_call ().*" \
70 "continue to test_call"
72 "Continuing.*Breakpoint.*, test_call_end ().*" \
73 "continue to test_call_end"
76 "Continuing.*Breakpoint.*, test_ret ().*" \
77 "continue to test_ret"
79 "Continuing.*Breakpoint.*, test_ret_end ().*" \
80 "continue to test_ret_end"
82 ##########################################
84 # Absolute jump with leading prefixes.
85 # These don't occur in normal code, but gdb should still DTRT.
87 gdb_test "break test_prefixed_abs_jump" \
88 "Breakpoint.*at.* file .*$srcfile, line.*" \
89 "break test_prefixed_abs_jump"
90 gdb_test "break test_prefixed_abs_jump_end" \
91 "Breakpoint.*at.* file .*$srcfile, line.*" \
92 "break test_prefixed_abs_jump_end"
95 "Continuing.*Breakpoint.*, test_prefixed_abs_jump ().*" \
96 "continue to test_prefixed_abs_jump"
98 "Continuing.*Breakpoint.*, test_prefixed_abs_jump_end ().*" \
99 "continue to test_prefixed_abs_jump_end"
101 ##########################################
105 gdb_test "break test_syscall" \
106 "Breakpoint.*at.* file .*$srcfile, line.*" \
108 gdb_test "break test_syscall_end" \
109 "Breakpoint.*at.* file .*$srcfile, line.*" \
110 "break test_syscall_end"
112 gdb_test "continue" \
113 "Continuing.*Breakpoint.*, test_syscall ().*" \
114 "continue to test_syscall"
115 gdb_test "continue" \
116 "Continuing.*Breakpoint.*, test_syscall_end ().*" \
117 "continue to test_syscall_end"
119 ##########################################
121 # Test prefixed syscall.
122 # These don't occur in normal code, but gdb should still DTRT.
124 gdb_test "break test_prefixed_syscall" \
125 "Breakpoint.*at.* file .*$srcfile, line.*" \
126 "break test_prefixed_syscall"
127 gdb_test "break test_prefixed_syscall_end" \
128 "Breakpoint.*at.* file .*$srcfile, line.*" \
129 "break test_prefixed_syscall_end"
131 gdb_test "continue" \
132 "Continuing.*Breakpoint.*, test_prefixed_syscall ().*" \
133 "continue to test_prefixed_syscall"
134 gdb_test "continue" \
135 "Continuing.*Breakpoint.*, test_prefixed_syscall_end ().*" \
136 "continue to test_prefixed_syscall_end"
138 ##########################################
140 # int3 (with prefixes)
141 # These don't occur in normal code, but gdb should still DTRT.
143 gdb_test "break test_int3" \
144 "Breakpoint.*at.* file .*$srcfile, line.*" \
146 gdb_test "break test_int3_end" \
147 "Breakpoint.*at.* file .*$srcfile, line.*" \
148 "break test_int3_end"
150 gdb_test "continue" \
151 "Continuing.*Breakpoint.*, test_int3 ().*" \
152 "continue to test_int3"
154 gdb_test "continue" \
155 "Continuing.*Breakpoint.*, test_int3_end ().*" \
156 "continue to test_int3_end"
158 ##########################################
160 # Done, run program to exit.
162 gdb_continue_to_end "i386-disp-step"