Imported Upstream version 7.9
[platform/upstream/gdb.git] / gdb / testsuite / gdb.arch / i386-disp-step.exp
1 # Copyright 2009-2015 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 <http://www.gnu.org/licenses/>.
15
16 # This file is part of the gdb testsuite.
17
18 # Test i386 displaced stepping.
19
20
21 if { ![is_x86_like_target] } then {
22     verbose "Skipping x86 displaced stepping tests."
23     return
24 }
25
26 standard_testfile .S
27
28 set additional_flags "-Wa,-g"
29
30 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } {
31     untested i386-disp-step.exp
32     return -1
33 }
34
35 # Get things started.
36
37 gdb_exit
38 gdb_start
39 gdb_reinitialize_dir $srcdir/$subdir
40 gdb_load ${binfile}
41
42 gdb_test "set displaced-stepping on" ""
43 gdb_test "show displaced-stepping" ".* displaced stepping .* is on.*"
44
45 if ![runto_main] then {
46     fail "Can't run to main"
47     return 0
48 }
49
50 ##########################################
51
52 # Test call/ret.
53
54 gdb_test "break test_call" \
55     "Breakpoint.*at.* file .*$srcfile, line.*" \
56     "break test_call"
57 gdb_test "break test_call_end" \
58     "Breakpoint.*at.* file .*$srcfile, line.*" \
59     "break test_call_end"
60
61 gdb_test "break test_ret" \
62     "Breakpoint.*at.* file .*$srcfile, line.*" \
63     "break test_ret"
64 gdb_test "break test_ret_end" \
65     "Breakpoint.*at.* file .*$srcfile, line.*" \
66     "break test_ret_end"
67
68 gdb_test "continue" \
69     "Continuing.*Breakpoint.*, test_call ().*" \
70     "continue to test_call"
71 gdb_test "continue" \
72     "Continuing.*Breakpoint.*, test_call_end ().*" \
73     "continue to test_call_end"
74
75 gdb_test "continue" \
76     "Continuing.*Breakpoint.*, test_ret ().*" \
77     "continue to test_ret"
78 gdb_test "continue" \
79     "Continuing.*Breakpoint.*, test_ret_end ().*" \
80     "continue to test_ret_end"
81
82 ##########################################
83
84 # Absolute jump with leading prefixes.
85 # These don't occur in normal code, but gdb should still DTRT.
86
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"
93
94 gdb_test "continue" \
95     "Continuing.*Breakpoint.*, test_prefixed_abs_jump ().*" \
96     "continue to test_prefixed_abs_jump"
97 gdb_test "continue" \
98     "Continuing.*Breakpoint.*, test_prefixed_abs_jump_end ().*" \
99     "continue to test_prefixed_abs_jump_end"
100
101 ##########################################
102
103 # Test syscall.
104
105 gdb_test "break test_syscall" \
106     "Breakpoint.*at.* file .*$srcfile, line.*" \
107     "break test_syscall"
108 gdb_test "break test_syscall_end" \
109     "Breakpoint.*at.* file .*$srcfile, line.*" \
110     "break test_syscall_end"
111
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"
118
119 ##########################################
120
121 # Test prefixed syscall.
122 # These don't occur in normal code, but gdb should still DTRT.
123
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"
130
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"
137
138 ##########################################
139
140 # int3 (with prefixes)
141 # These don't occur in normal code, but gdb should still DTRT.
142
143 gdb_test "break test_int3" \
144     "Breakpoint.*at.* file .*$srcfile, line.*" \
145     "break test_int3"
146 gdb_test "break test_int3_end" \
147     "Breakpoint.*at.* file .*$srcfile, line.*" \
148     "break test_int3_end"
149
150 gdb_test "continue" \
151     "Continuing.*Breakpoint.*, test_int3 ().*" \
152     "continue to test_int3"
153
154 gdb_test "continue" \
155     "Continuing.*Breakpoint.*, test_int3_end ().*" \
156     "continue to test_int3_end"
157
158 ##########################################
159
160 # Done, run program to exit.
161
162 gdb_continue_to_end "i386-disp-step"