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 20if $tracelevel { 21 strace $tracelevel 22} 23 24 25if {(![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"]) || ![is_ilp32_target] } then { 26 verbose "Skipping x86 displaced stepping tests." 27 return 28} 29 30set testfile "i386-disp-step" 31set srcfile ${testfile}.S 32set binfile ${objdir}/${subdir}/${testfile} 33 34set additional_flags "-Wa,-g" 35 36if { [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 43gdb_exit 44gdb_start 45gdb_reinitialize_dir $srcdir/$subdir 46gdb_load ${binfile} 47 48gdb_test "set displaced-stepping on" "" 49gdb_test "show displaced-stepping" ".* displaced stepping .* is on.*" 50 51if ![runto_main] then { 52 fail "Can't run to main" 53 return 0 54} 55 56########################################## 57 58# Test call/ret. 59 60gdb_test "break test_call" \ 61 "Breakpoint.*at.* file .*$srcfile, line.*" \ 62 "break test_call" 63gdb_test "break test_call_end" \ 64 "Breakpoint.*at.* file .*$srcfile, line.*" \ 65 "break test_call_end" 66 67gdb_test "break test_ret" \ 68 "Breakpoint.*at.* file .*$srcfile, line.*" \ 69 "break test_ret" 70gdb_test "break test_ret_end" \ 71 "Breakpoint.*at.* file .*$srcfile, line.*" \ 72 "break test_ret_end" 73 74gdb_test "continue" \ 75 "Continuing.*Breakpoint.*, test_call ().*" \ 76 "continue to test_call" 77gdb_test "continue" \ 78 "Continuing.*Breakpoint.*, test_call_end ().*" \ 79 "continue to test_call_end" 80 81gdb_test "continue" \ 82 "Continuing.*Breakpoint.*, test_ret ().*" \ 83 "continue to test_ret" 84gdb_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 93gdb_test "break test_prefixed_abs_jump" \ 94 "Breakpoint.*at.* file .*$srcfile, line.*" \ 95 "break test_prefixed_abs_jump" 96gdb_test "break test_prefixed_abs_jump_end" \ 97 "Breakpoint.*at.* file .*$srcfile, line.*" \ 98 "break test_prefixed_abs_jump_end" 99 100gdb_test "continue" \ 101 "Continuing.*Breakpoint.*, test_prefixed_abs_jump ().*" \ 102 "continue to test_prefixed_abs_jump" 103gdb_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 111gdb_test "break test_syscall" \ 112 "Breakpoint.*at.* file .*$srcfile, line.*" \ 113 "break test_syscall" 114gdb_test "break test_syscall_end" \ 115 "Breakpoint.*at.* file .*$srcfile, line.*" \ 116 "break test_syscall_end" 117 118gdb_test "continue" \ 119 "Continuing.*Breakpoint.*, test_syscall ().*" \ 120 "continue to test_syscall" 121gdb_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 130gdb_test "break test_prefixed_syscall" \ 131 "Breakpoint.*at.* file .*$srcfile, line.*" \ 132 "break test_prefixed_syscall" 133gdb_test "break test_prefixed_syscall_end" \ 134 "Breakpoint.*at.* file .*$srcfile, line.*" \ 135 "break test_prefixed_syscall_end" 136 137gdb_test "continue" \ 138 "Continuing.*Breakpoint.*, test_prefixed_syscall ().*" \ 139 "continue to test_prefixed_syscall" 140gdb_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 149gdb_test "break test_int3" \ 150 "Breakpoint.*at.* file .*$srcfile, line.*" \ 151 "break test_int3" 152gdb_test "break test_int3_end" \ 153 "Breakpoint.*at.* file .*$srcfile, line.*" \ 154 "break test_int3_end" 155 156gdb_test "continue" \ 157 "Continuing.*Breakpoint.*, test_int3 ().*" \ 158 "continue to test_int3" 159 160gdb_test "continue" \ 161 "Continuing.*Breakpoint.*, test_int3_end ().*" \ 162 "continue to test_int3_end" 163 164########################################## 165 166# Done, run program to exit. 167 168gdb_continue_to_end "i386-disp-step" 169