1 # Copyright 2018-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/>.
16 # This testcase is a regression test for a regression in the in-line
17 # step-over machinery. If a resumption that starts a step-over
18 # failed, a following resumption would make GDB hang forever:
25 # Cannot insert breakpoint 2.
26 # Cannot access memory at address 0x0
30 # Delete all breakpoints? (y or n) y
32 # Breakpoint 3 at 0x40048b: file test.c, line 33.
39 if {[build_executable "failed to prepare" $testfile $srcfile debug]} {
43 # DISPLACED indicates whether to use displaced-stepping.
44 proc do_test {displaced} {
45 global gdb_prompt decimal
46 global srcfile binfile
48 clean_restart $binfile
50 gdb_test_no_output "set displaced-stepping $displaced"
57 # We rely on not being able to set a breakpoint at 0, as proxy for
58 # any kind of breakpoint insertion failure. If we can examine
59 # what's at memory address 0, it is possible that we could also
61 if [is_address_zero_readable] {
62 untested "memory at address 0 is possibly executable"
66 # Set a breakpoint that fails to insert.
67 gdb_test "b *0" "Breakpoint $decimal at 0x0"
70 "Command aborted\\." \
73 # Delete the "bad" breakpoint and try continuing again.
75 gdb_test "b function" "Breakpoint $decimal .*$srcfile.*"
78 "Breakpoint $decimal, function \\(\\) at .*$srcfile:.*" \
79 "continue to function"
82 # This testcase exercises a regression with the in-line step-over
83 # machinery. So make sure this runs with displaced stepping disabled,
84 # and for good measure, also try with displaced stepping enabled.
85 foreach_with_prefix displaced-stepping {"off" "on"} {
86 do_test ${displaced-stepping}