1 # This testcase is part of GDB, the GNU debugger.
3 # Copyright 2014-2019 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # Test tstepping an instruction just as long as decr_pc_after_break
19 # after removing a breakpoint at PC. GDB used to get confused with
20 # this in non-stop mode, and adjust the PC incorrectly. PR gdb/12623.
24 if [build_executable "failed to build" ${testfile} ${srcfile} {debug}] {
28 set linenum_for_user_bp [gdb_get_line_number "break for user-bp test here"]
29 set linenum_for_step_resume [gdb_get_line_number "break for step-resume test here"]
31 proc test {non_stop displaced always_inserted} {
33 global linenum_for_user_bp
34 global linenum_for_step_resume
36 clean_restart $binfile
38 gdb_test_no_output "set non-stop $non_stop"
39 gdb_test_no_output "set displaced-stepping $displaced"
40 gdb_test_no_output "set breakpoint always-inserted $always_inserted"
46 with_test_prefix "user bp" {
49 gdb_breakpoint $linenum_for_user_bp
50 gdb_continue_to_breakpoint "continue to breakpoint"
52 # If breakpoint always-inserted is on, this makes the location
56 gdb_test "si" "INSN.*insn1.*" "si advances"
59 with_test_prefix "step-resume" {
62 gdb_breakpoint $linenum_for_step_resume
63 gdb_continue_to_breakpoint "continue to breakpoint"
65 gdb_test "next" "insn1.*"
67 # We're now stopped where the step-resume breakpoint for the
68 # previous "next" was. That breakpoint was removed and is now
69 # on the moribund locations list.
70 gdb_test "si" "INSN.*insn2.*" "si advances"
76 foreach_with_prefix non_stop { "off" "on" } {
77 foreach_with_prefix displaced_step { "off" "on" } {
78 foreach_with_prefix always_inserted { "off" "on" } {
79 test $non_stop $displaced_step $always_inserted