gdb/python: don't allow the user to delete window title attributes
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / continue-after-aborted-step-over.exp
1 # Copyright 2018-2021 Free Software Foundation, Inc.
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 # 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:
19 #
20 # (gdb) b *0
21 # Breakpoint 2 at 0x0
22 # continue
23 # Continuing.
24 # Warning:
25 # Cannot insert breakpoint 2.
26 # Cannot access memory at address 0x0
27 #
28 # Command aborted.
29 # delete breakpoints
30 # Delete all breakpoints? (y or n) y
31 # (gdb) b function
32 # Breakpoint 3 at 0x40048b: file test.c, line 33.
33 # continue
34 # Continuing.
35 # *GDB hangs forever*
36
37 standard_testfile
38
39 if {[build_executable "failed to prepare" $testfile $srcfile debug]} {
40 return -1
41 }
42
43 # DISPLACED indicates whether to use displaced-stepping.
44 proc do_test {displaced breakpoint_always_inserted} {
45 global gdb_prompt decimal
46 global srcfile binfile
47
48 clean_restart $binfile
49
50 gdb_test_no_output "set displaced-stepping $displaced"
51 gdb_test_no_output "set breakpoint always-inserted $breakpoint_always_inserted"
52
53 if ![runto_main] {
54 fail "run to main"
55 return -1
56 }
57
58 # We rely on not being able to set a breakpoint at 0, as proxy for
59 # any kind of breakpoint insertion failure. If we can examine
60 # what's at memory address 0, it is possible that we could also
61 # execute it.
62 if [is_address_zero_readable] {
63 untested "memory at address 0 is possibly executable"
64 return
65 }
66
67 # Set a breakpoint that fails to insert.
68 if { $breakpoint_always_inserted == "on" } {
69 gdb_test "b *0" "Breakpoint $decimal at 0x0.*"
70 } else {
71 gdb_test "b *0" "Breakpoint $decimal at 0x0"
72 }
73
74 gdb_test "continue" \
75 "Command aborted\\." \
76 "continue aborts"
77
78 # Delete the "bad" breakpoint and try continuing again.
79 delete_breakpoints
80 gdb_test "b function" "Breakpoint $decimal .*$srcfile.*"
81
82 gdb_test "continue" \
83 "Breakpoint $decimal, function \\(\\) at .*$srcfile:.*" \
84 "continue to function"
85 }
86
87 # This testcase exercises a regression with the in-line step-over
88 # machinery. So make sure this runs with displaced stepping disabled,
89 # and for good measure, also try with displaced stepping enabled.
90 foreach_with_prefix displaced-stepping {"off" "on"} {
91 foreach_with_prefix breakpoint-always-inserted {"off" "on"} {
92 do_test ${displaced-stepping} ${breakpoint-always-inserted}
93 }
94 }
This page took 0.046253 seconds and 4 git commands to generate.