]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/consecutive-step-over.exp
Update copyright year range in all GDB files.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / consecutive-step-over.exp
CommitLineData
42a4f53d 1# Copyright 2014-2019 Free Software Foundation, Inc.
483805cf
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#
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.
20#
21standard_testfile
22
23if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
24 return -1
25}
26
27if ![runto_main] then {
bc6c7af4 28 fail "can't run to main"
483805cf
PA
29 return 0
30}
31
32# Make sure the target doesn't hide the breakpoint hits (that don't
33# cause a user visible stop) from GDB.
34gdb_test_no_output "set breakpoint condition-evaluation host"
35
36set up_to_nl "\[^\r\n\]+\[\r\n\]+"
37
38# Number of consecutive breakpoints in a row to try.
39set n_insns 3
40
41# Extract addresses of a few consecutive instructions.
42set test "get breakpoint addresses"
43if { [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)
47 }
48 pass $test
49 }
50}] != 0 } {
51 # No use proceeding if bp_addrs wasn't set.
52 return
53}
54
55for {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 .*" \
59 "set breakpoint"
60
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" \
64 "set condition"
65 }
66}
67
68set lineno [gdb_get_line_number "break here"]
69gdb_breakpoint $lineno
70gdb_continue_to_breakpoint "break here" ".*break here.*"