156893Sfenner# This testcase is part of GDB, the GNU debugger. 256893Sfenner 356893Sfenner# Copyright 2014-2020 Free Software Foundation, Inc. 4127668Sbms 556893Sfenner# This program is free software; you can redistribute it and/or modify 656893Sfenner# it under the terms of the GNU General Public License as published by 756893Sfenner# the Free Software Foundation; either version 3 of the License, or 856893Sfenner# (at your option) any later version. 956893Sfenner# 1056893Sfenner# This program is distributed in the hope that it will be useful, 1156893Sfenner# but WITHOUT ANY WARRANTY; without even the implied warranty of 1256893Sfenner# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1356893Sfenner# GNU General Public License for more details. 1456893Sfenner# 1556893Sfenner# You should have received a copy of the GNU General Public License 16127668Sbms# along with this program. If not, see <http://www.gnu.org/licenses/>. 1756893Sfenner 1856893Sfenner# Test tstepping an instruction just as long as decr_pc_after_break 1956893Sfenner# after removing a breakpoint at PC. GDB used to get confused with 2056893Sfenner# this in non-stop mode, and adjust the PC incorrectly. PR gdb/12623. 2156893Sfenner 2256893Sfennerstandard_testfile 2356893Sfenner 2456893Sfennerif [build_executable "failed to build" ${testfile} ${srcfile} {debug}] { 2556893Sfenner return -1 2656893Sfenner} 2756893Sfenner 2856893Sfennerset linenum_for_user_bp [gdb_get_line_number "break for user-bp test here"] 29214478Srpauloset linenum_for_step_resume [gdb_get_line_number "break for step-resume test here"] 3056893Sfenner 3156893Sfennerproc test {non_stop displaced always_inserted} { 3256893Sfenner global binfile 3356893Sfenner global linenum_for_user_bp 3456893Sfenner global linenum_for_step_resume 3556893Sfenner 3656893Sfenner clean_restart $binfile 3756893Sfenner 3856893Sfenner gdb_test_no_output "set non-stop $non_stop" 3956893Sfenner gdb_test_no_output "set displaced-stepping $displaced" 4056893Sfenner gdb_test_no_output "set breakpoint always-inserted $always_inserted" 4156893Sfenner 4256893Sfenner if ![runto_main] { 4356893Sfenner return -1 4456893Sfenner } 4556893Sfenner 4656893Sfenner with_test_prefix "user bp" { 4756893Sfenner delete_breakpoints 4856893Sfenner 4956893Sfenner gdb_breakpoint $linenum_for_user_bp 5056893Sfenner gdb_continue_to_breakpoint "continue to breakpoint" 5156893Sfenner 5256893Sfenner # If breakpoint always-inserted is on, this makes the location 5356893Sfenner # moribund. 5456893Sfenner delete_breakpoints 5556893Sfenner 5656893Sfenner gdb_test "si" "INSN.*insn1.*" "si advances" 5756893Sfenner } 5856893Sfenner 5956893Sfenner with_test_prefix "step-resume" { 6056893Sfenner delete_breakpoints 6156893Sfenner 6256893Sfenner gdb_breakpoint $linenum_for_step_resume 6356893Sfenner gdb_continue_to_breakpoint "continue to breakpoint" 6456893Sfenner 6556893Sfenner gdb_test "next" "insn1.*" 6656893Sfenner 6756893Sfenner # We're now stopped where the step-resume breakpoint for the 6856893Sfenner # previous "next" was. That breakpoint was removed and is now 6956893Sfenner # on the moribund locations list. 7056893Sfenner gdb_test "si" "INSN.*insn2.*" "si advances" 7156893Sfenner 7256893Sfenner delete_breakpoints 7356893Sfenner } 7456893Sfenner} 7556893Sfenner 7656893Sfennerforeach_with_prefix non_stop { "off" "on" } { 7756893Sfenner foreach_with_prefix displaced_step { "off" "on" } { 7856893Sfenner foreach_with_prefix always_inserted { "off" "on" } { 7956893Sfenner test $non_stop $displaced_step $always_inserted 8056893Sfenner } 8156893Sfenner } 8256893Sfenner} 8356893Sfenner