run copyright.sh for 2011.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.arch / i386-disp-step.exp
1 # Copyright 2009, 2010, 2011 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 if $tracelevel {
21 strace $tracelevel
22 }
23
24
25 if {(![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"]) || ![is_ilp32_target] } then {
26 verbose "Skipping x86 displaced stepping tests."
27 return
28 }
29
30 set testfile "i386-disp-step"
31 set srcfile ${testfile}.S
32 set binfile ${objdir}/${subdir}/${testfile}
33
34 set additional_flags "-Wa,-g"
35
36 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } {
37 untested i386-disp-step.exp
38 return -1
39 }
40
41 # Get things started.
42
43 gdb_exit
44 gdb_start
45 gdb_reinitialize_dir $srcdir/$subdir
46 gdb_load ${binfile}
47
48 gdb_test "set displaced-stepping on" ""
49 gdb_test "show displaced-stepping" ".* displaced stepping .* is on.*"
50
51 if ![runto_main] then {
52 fail "Can't run to main"
53 return 0
54 }
55
56 ##########################################
57
58 # Test call/ret.
59
60 gdb_test "break test_call" \
61 "Breakpoint.*at.* file .*$srcfile, line.*" \
62 "break test_call"
63 gdb_test "break test_call_end" \
64 "Breakpoint.*at.* file .*$srcfile, line.*" \
65 "break test_call_end"
66
67 gdb_test "break test_ret" \
68 "Breakpoint.*at.* file .*$srcfile, line.*" \
69 "break test_ret"
70 gdb_test "break test_ret_end" \
71 "Breakpoint.*at.* file .*$srcfile, line.*" \
72 "break test_ret_end"
73
74 gdb_test "continue" \
75 "Continuing.*Breakpoint.*, test_call ().*" \
76 "continue to test_call"
77 gdb_test "continue" \
78 "Continuing.*Breakpoint.*, test_call_end ().*" \
79 "continue to test_call_end"
80
81 gdb_test "continue" \
82 "Continuing.*Breakpoint.*, test_ret ().*" \
83 "continue to test_ret"
84 gdb_test "continue" \
85 "Continuing.*Breakpoint.*, test_ret_end ().*" \
86 "continue to test_ret_end"
87
88 ##########################################
89
90 # Absolute jump with leading prefixes.
91 # These don't occur in normal code, but gdb should still DTRT.
92
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"
99
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"
106
107 ##########################################
108
109 # Test syscall.
110
111 gdb_test "break test_syscall" \
112 "Breakpoint.*at.* file .*$srcfile, line.*" \
113 "break test_syscall"
114 gdb_test "break test_syscall_end" \
115 "Breakpoint.*at.* file .*$srcfile, line.*" \
116 "break test_syscall_end"
117
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"
124
125 ##########################################
126
127 # Test prefixed syscall.
128 # These don't occur in normal code, but gdb should still DTRT.
129
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"
136
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"
143
144 ##########################################
145
146 # int3 (with prefixes)
147 # These don't occur in normal code, but gdb should still DTRT.
148
149 gdb_test "break test_int3" \
150 "Breakpoint.*at.* file .*$srcfile, line.*" \
151 "break test_int3"
152 gdb_test "break test_int3_end" \
153 "Breakpoint.*at.* file .*$srcfile, line.*" \
154 "break test_int3_end"
155
156 gdb_test "continue" \
157 "Continuing.*Breakpoint.*, test_int3 ().*" \
158 "continue to test_int3"
159
160 gdb_test "continue" \
161 "Continuing.*Breakpoint.*, test_int3_end ().*" \
162 "continue to test_int3_end"
163
164 ##########################################
165
166 # Done, run program to exit.
167
168 gdb_continue_to_end "i386-disp-step"
This page took 0.055153 seconds and 4 git commands to generate.