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