06c5fb2cdb86a5b8013407d61fc3ea0791353d00
[binutils-gdb.git] / gdb / testsuite / gdb.arch / i386-disp-step.exp
1 # Copyright 2009 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 set prms_id 0
25 set bug_id 0
26
27 if ![istarget "i?86-*-linux*"] then {
28 verbose "Skipping x86 displaced stepping tests."
29 return
30 }
31
32 set testfile "i386-disp-step"
33 set srcfile ${testfile}.S
34 set binfile ${objdir}/${subdir}/${testfile}
35
36 set additional_flags "-Wa,-g"
37
38 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } {
39 untested i386-disp-step.exp
40 return -1
41 }
42
43 # Get things started.
44
45 gdb_exit
46 gdb_start
47 gdb_reinitialize_dir $srcdir/$subdir
48 gdb_load ${binfile}
49
50 gdb_test "set displaced-stepping on" ""
51 gdb_test "show displaced-stepping" ".* displaced stepping .* is on.*"
52
53 if ![runto_main] then {
54 fail "Can't run to main"
55 return 0
56 }
57
58 ##########################################
59
60 # Test call/ret.
61
62 gdb_test "break test_call" \
63 "Breakpoint.*at.* file .*$srcfile, line.*" \
64 "break test_call"
65 gdb_test "break test_call_end" \
66 "Breakpoint.*at.* file .*$srcfile, line.*" \
67 "break test_call_end"
68
69 gdb_test "break test_ret" \
70 "Breakpoint.*at.* file .*$srcfile, line.*" \
71 "break test_ret"
72 gdb_test "break test_ret_end" \
73 "Breakpoint.*at.* file .*$srcfile, line.*" \
74 "break test_ret_end"
75
76 gdb_test "continue" \
77 "Continuing.*Breakpoint.*, test_call ().*" \
78 "continue to test_call"
79 gdb_test "continue" \
80 "Continuing.*Breakpoint.*, test_call_end ().*" \
81 "continue to test_call_end"
82
83 gdb_test "continue" \
84 "Continuing.*Breakpoint.*, test_ret ().*" \
85 "continue to test_ret"
86 gdb_test "continue" \
87 "Continuing.*Breakpoint.*, test_ret_end ().*" \
88 "continue to test_ret_end"
89
90 ##########################################
91
92 # Test syscall.
93
94 gdb_test "break test_syscall" \
95 "Breakpoint.*at.* file .*$srcfile, line.*" \
96 "break test_syscall"
97 gdb_test "break test_syscall_end" \
98 "Breakpoint.*at.* file .*$srcfile, line.*" \
99 "break test_syscall_end"
100
101 gdb_test "continue" \
102 "Continuing.*Breakpoint.*, test_syscall ().*" \
103 "continue to test_syscall"
104 gdb_test "continue" \
105 "Continuing.*Breakpoint.*, test_syscall_end ().*" \
106 "continue to test_syscall_end"
107
108 ##########################################
109
110 # Done, run program to exit.
111
112 gdb_continue_to_end "i386-disp-step"