1 # Copyright (C) 2008-2024 Free Software Foundation, Inc.
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.
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.
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/>.
17 # This file is part of the gdb testsuite.
19 # Test stepping over permanent breakpoints on i386.
21 require {is_any_target "i?86-*-*" "x86_64-*-*"}
25 # some targets have leading underscores on assembly symbols.
26 set additional_flags [gdb_target_symbol_prefix_flags]
28 # Don't use "debug", so that we don't have line information for the assembly
30 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list $additional_flags]] != "" } {
31 untested "failed to compile"
36 clean_restart $binfile
39 # Run to `main' where we begin our tests.
46 set function "standard"
48 set retcode [gdb_test_multiple "disassemble $function" "disassemble function '$function'" {
49 -re "($hex) <\\+0>.*($hex) <\\+$decimal>.*int3.*($hex) <\\+$decimal>.*leave.*$gdb_prompt $" {
50 set address_bp $expect_out(2,string)
51 set address_after_bp $expect_out(3,string)
56 fail "disassemble failed, skipping entire test."
60 gdb_breakpoint "*$address_bp"
62 gdb_test "continue" "Breakpoint .*, $address_bp in $function.*" \
63 "stop at permanent breakpoint"
65 # We want to fetch the stack pointer at the start of '$function'
66 # function to make sure the skip_permanent_breakpoint implementation
67 # really skips only the permanent breakpoint. If, for whatever
68 # reason, the 'leave' instruction executes, the stack pointer will not
71 gdb_test_multiple "print \$sp" "fetch stack pointer value" {
72 -re "\\\$1.*($hex).*$gdb_prompt $" {
73 set start_sp $expect_out(1,string)
77 gdb_test "stepi" "$address_after_bp in $function.*" \
78 "single-step past permanent breakpoint"
80 gdb_test "print \$sp" ".*$start_sp.*" \
81 "stack pointer value matches"