]>
Commit | Line | Data |
---|---|---|
7f5ef605 PA |
1 | # This testcase is part of GDB, the GNU debugger. |
2 | ||
b811d2c2 | 3 | # Copyright 2014-2020 Free Software Foundation, Inc. |
7f5ef605 PA |
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 | |
93df4a1d | 35 | global GDBFLAGS |
7f5ef605 | 36 | |
93df4a1d SM |
37 | save_vars { GDBFLAGS } { |
38 | set GDBFLAGS "$GDBFLAGS -ex \"set non-stop $non_stop\"" | |
39 | clean_restart $binfile | |
40 | } | |
7f5ef605 | 41 | |
7f5ef605 PA |
42 | gdb_test_no_output "set displaced-stepping $displaced" |
43 | gdb_test_no_output "set breakpoint always-inserted $always_inserted" | |
44 | ||
45 | if ![runto_main] { | |
46 | return -1 | |
47 | } | |
48 | ||
49 | with_test_prefix "user bp" { | |
50 | delete_breakpoints | |
51 | ||
52 | gdb_breakpoint $linenum_for_user_bp | |
53 | gdb_continue_to_breakpoint "continue to breakpoint" | |
54 | ||
55 | # If breakpoint always-inserted is on, this makes the location | |
56 | # moribund. | |
57 | delete_breakpoints | |
58 | ||
59 | gdb_test "si" "INSN.*insn1.*" "si advances" | |
60 | } | |
61 | ||
62 | with_test_prefix "step-resume" { | |
63 | delete_breakpoints | |
64 | ||
65 | gdb_breakpoint $linenum_for_step_resume | |
66 | gdb_continue_to_breakpoint "continue to breakpoint" | |
67 | ||
68 | gdb_test "next" "insn1.*" | |
69 | ||
70 | # We're now stopped where the step-resume breakpoint for the | |
71 | # previous "next" was. That breakpoint was removed and is now | |
72 | # on the moribund locations list. | |
73 | gdb_test "si" "INSN.*insn2.*" "si advances" | |
74 | ||
75 | delete_breakpoints | |
76 | } | |
77 | } | |
78 | ||
7f5ef605 PA |
79 | foreach_with_prefix non_stop { "off" "on" } { |
80 | foreach_with_prefix displaced_step { "off" "on" } { | |
81 | foreach_with_prefix always_inserted { "off" "on" } { | |
82 | test $non_stop $displaced_step $always_inserted | |
83 | } | |
84 | } | |
85 | } |