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