1 # Copyright
2014-2019 Free Software Foundation
, Inc.
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.
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.
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
/>.
17 # Regression test
for a bug where GDB would internal error
if a thread
18 # runs into a breakpoint that needs stepping over
, just after stepping
19 # over another breakpoint
, without a user visible stop in between.
23 if {[prepare_for_testing
"failed to prepare" $testfile $srcfile debug]} {
27 if ![runto_main
] then {
28 fail
"can't run to main"
32 # Make sure the target doesn
't hide the breakpoint hits (that don't
33 # cause a user visible stop
) from GDB.
34 gdb_test_no_output
"set breakpoint condition-evaluation host"
36 set up_to_nl
"\[^\r\n\]+\[\r\n\]+"
38 # Number of consecutive breakpoints in a
row to try.
41 # Extract addresses of a few consecutive instructions.
42 set test
"get breakpoint addresses"
43 if { [gdb_test_multiple
"x /[expr $n_insns + 1]i \$pc" $test {
44 -re
"=> $hex${up_to_nl} ($hex)${up_to_nl} ($hex)${up_to_nl} ($hex)${up_to_nl}$gdb_prompt $" {
45 for {set i
1} {$i
<= $n_insns
} {incr i
} {
46 set bp_addrs
($i
) $expect_out
($i
,string
)
51 # No use proceeding
if bp_addrs wasn
't set.
55 for {set i 1} {$i <= $n_insns} {incr i} {
56 with_test_prefix "insn $i" {
57 gdb_test "break \*$bp_addrs($i)" \
58 "Breakpoint $decimal at $bp_addrs($i): file .*" \
61 # Give the breakpoint a condition that always fails, so that
62 # the thread is immediately re-resumed.
63 gdb_test_no_output "condition \$bpnum condition" \
68 set lineno [gdb_get_line_number "break here"]
69 gdb_breakpoint $lineno
70 gdb_continue_to_breakpoint "break here" ".*break here.*"