]>
Commit | Line | Data |
---|---|---|
1d506c26 | 1 | # Copyright 2014-2024 Free Software Foundation, Inc. |
9ba6657a PA |
2 | |
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. | |
7 | # | |
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. | |
12 | # | |
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/>. | |
15 | ||
16 | # Test that removing a single-step breakpoint that is placed at the | |
17 | # same address as another regular breakpoint leaves the regular | |
18 | # breakpoint inserted. | |
19 | ||
20 | standard_testfile | |
21 | set executable ${testfile} | |
22 | ||
23 | if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { | |
24 | return -1 | |
25 | } | |
26 | ||
65a33d75 | 27 | if {![runto_main]} { |
9ba6657a PA |
28 | return 0 |
29 | } | |
30 | ||
31 | gdb_breakpoint [gdb_get_line_number "set foo break here"] | |
32 | gdb_continue_to_breakpoint "first breakpoint" ".* set foo break here .*" | |
33 | ||
03388bb7 YQ |
34 | # Get the address of the next instruction and set a breakpoint there. |
35 | set next_insn_addr "" | |
36 | set test "disassemble main" | |
37 | gdb_test_multiple $test $test { | |
38 | -re ".*=> $hex <\\+$decimal>:\[^\r\n\]+\r\n ($hex) .*$gdb_prompt $" { | |
39 | set next_insn_addr $expect_out(1,string) | |
40 | pass $test | |
41 | } | |
42 | } | |
43 | ||
44 | if { $next_insn_addr == "" } { | |
45 | return -1 | |
46 | } | |
47 | ||
48ca5676 | 48 | gdb_test "b *$next_insn_addr" "Breakpoint .*" "set breakpoint on address" |
9ba6657a PA |
49 | |
50 | # So that GDB doesn't try to remove the regular breakpoint when the | |
51 | # step finishes. | |
52 | gdb_test_no_output "set breakpoint always-inserted on" | |
53 | ||
54 | # On software single-step targets, this step will want to momentarily | |
55 | # place a single-step breakpoint over the bar breakpoint, and then | |
56 | # remove it. But, a regular breakpoint is planted there already, and | |
57 | # with always-inserted on, should remain planted when the step | |
58 | # finishes. | |
03388bb7 | 59 | gdb_test "si" "Breakpoint .*" |
9ba6657a PA |
60 | |
61 | # If the breakpoint is still correctly inserted, then this jump should | |
62 | # re-trigger it. Otherwise, GDB will lose control and the program | |
ef370185 | 63 | # will exit. See PR breakpoints/17000. |
03388bb7 | 64 | gdb_test "jump *\$pc" "Breakpoint .*" |