Update copyright year range in all GDB files.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / step-sw-breakpoint-adjust-pc.exp
1 # This testcase is part of GDB, the GNU debugger.
2
3 # Copyright 2014-2020 Free Software Foundation, Inc.
4
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.
9 #
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.
14 #
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/>.
17
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.
21
22 standard_testfile
23
24 if [build_executable "failed to build" ${testfile} ${srcfile} {debug}] {
25 return -1
26 }
27
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"]
30
31 proc test {non_stop displaced always_inserted} {
32 global binfile
33 global linenum_for_user_bp
34 global linenum_for_step_resume
35
36 clean_restart $binfile
37
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"
41
42 if ![runto_main] {
43 return -1
44 }
45
46 with_test_prefix "user bp" {
47 delete_breakpoints
48
49 gdb_breakpoint $linenum_for_user_bp
50 gdb_continue_to_breakpoint "continue to breakpoint"
51
52 # If breakpoint always-inserted is on, this makes the location
53 # moribund.
54 delete_breakpoints
55
56 gdb_test "si" "INSN.*insn1.*" "si advances"
57 }
58
59 with_test_prefix "step-resume" {
60 delete_breakpoints
61
62 gdb_breakpoint $linenum_for_step_resume
63 gdb_continue_to_breakpoint "continue to breakpoint"
64
65 gdb_test "next" "insn1.*"
66
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"
71
72 delete_breakpoints
73 }
74 }
75
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
80 }
81 }
82 }
This page took 0.031302 seconds and 4 git commands to generate.