1 # Copyright 2009-2019 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 if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
32 gdb_test "set displaced-stepping on" ""
33 gdb_test "show displaced-stepping" ".* displaced stepping .* is on.*"
35 if ![runto_main] then {
36 fail "can't run to main"
40 ##########################################
44 gdb_test "break test_call" \
45 "Breakpoint.*at.* file .*$srcfile, line.*" \
47 gdb_test "break test_call_end" \
48 "Breakpoint.*at.* file .*$srcfile, line.*" \
51 gdb_test "break test_ret" \
52 "Breakpoint.*at.* file .*$srcfile, line.*" \
54 gdb_test "break test_ret_end" \
55 "Breakpoint.*at.* file .*$srcfile, line.*" \
59 "Continuing.*Breakpoint.*, test_call ().*" \
60 "continue to test_call"
62 "Continuing.*Breakpoint.*, test_call_end ().*" \
63 "continue to test_call_end"
66 "Continuing.*Breakpoint.*, test_ret ().*" \
67 "continue to test_ret"
69 "Continuing.*Breakpoint.*, test_ret_end ().*" \
70 "continue to test_ret_end"
72 ##########################################
74 # Absolute jump with leading prefixes.
75 # These don't occur in normal code, but gdb should still DTRT.
77 gdb_test "break test_prefixed_abs_jump" \
78 "Breakpoint.*at.* file .*$srcfile, line.*" \
79 "break test_prefixed_abs_jump"
80 gdb_test "break test_prefixed_abs_jump_end" \
81 "Breakpoint.*at.* file .*$srcfile, line.*" \
82 "break test_prefixed_abs_jump_end"
85 "Continuing.*Breakpoint.*, test_prefixed_abs_jump ().*" \
86 "continue to test_prefixed_abs_jump"
88 "Continuing.*Breakpoint.*, test_prefixed_abs_jump_end ().*" \
89 "continue to test_prefixed_abs_jump_end"
91 ##########################################
95 gdb_test "break test_syscall" \
96 "Breakpoint.*at.* file .*$srcfile, line.*" \
98 gdb_test "break test_syscall_end" \
99 "Breakpoint.*at.* file .*$srcfile, line.*" \
100 "break test_syscall_end"
102 gdb_test "continue" \
103 "Continuing.*Breakpoint.*, test_syscall ().*" \
104 "continue to test_syscall"
105 gdb_test "continue" \
106 "Continuing.*Breakpoint.*, test_syscall_end ().*" \
107 "continue to test_syscall_end"
109 ##########################################
111 # Test prefixed syscall.
112 # These don't occur in normal code, but gdb should still DTRT.
114 gdb_test "break test_prefixed_syscall" \
115 "Breakpoint.*at.* file .*$srcfile, line.*" \
116 "break test_prefixed_syscall"
117 gdb_test "break test_prefixed_syscall_end" \
118 "Breakpoint.*at.* file .*$srcfile, line.*" \
119 "break test_prefixed_syscall_end"
121 gdb_test "continue" \
122 "Continuing.*Breakpoint.*, test_prefixed_syscall ().*" \
123 "continue to test_prefixed_syscall"
124 gdb_test "continue" \
125 "Continuing.*Breakpoint.*, test_prefixed_syscall_end ().*" \
126 "continue to test_prefixed_syscall_end"
128 ##########################################
130 # int3 (with prefixes)
131 # These don't occur in normal code, but gdb should still DTRT.
133 gdb_test "break test_int3" \
134 "Breakpoint.*at.* file .*$srcfile, line.*" \
136 gdb_test "break test_int3_end" \
137 "Breakpoint.*at.* file .*$srcfile, line.*" \
138 "break test_int3_end"
140 gdb_test "continue" \
141 "Continuing.*Breakpoint.*, test_int3 ().*" \
142 "continue to test_int3"
144 gdb_test "continue" \
145 "Continuing.*Breakpoint.*, test_int3_end ().*" \
146 "continue to test_int3_end"
148 ##########################################
150 # Done, run program to exit.
152 gdb_continue_to_end "i386-disp-step"