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