1 # Copyright 2012-2018 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 # Step over breakpoints with displaced stepping on, against Valgrind.
17 # We can't really use displaced stepping with Valgrind, so what this
18 # really tests is that GDB falls back to in-line stepping
19 # automatically instead of getting stuck or crashing.
23 if [is_remote target] {
24 # The test always runs locally.
29 if {[build_executable "failed to build" $testfile $srcfile {debug}] == -1} {
33 if { [vgdb_start] == -1 } {
37 gdb_test_no_output "set displaced-stepping off"
38 gdb_breakpoint "main" "breakpoint at main"
39 gdb_test "continue" " stop 0 .*" "continue to main"
43 foreach displaced { "off" "on" } {
44 with_test_prefix "displaced $displaced" {
46 gdb_test_no_output "set displaced-stepping $displaced"
48 foreach go { "once" "twice" } {
49 with_test_prefix $go {
50 gdb_test "break" "Breakpoint .* at .*" "set breakpoint"
52 # Whether we should see a warning.
53 set should_warn [expr {$go == "once" && $displaced == "on"}]
57 set msg "step over breakpoint"
58 set pattern " stop $curr_stop .*$gdb_prompt $"
59 gdb_test_multiple "next" $msg {
60 -re "warning: disabling displaced stepping.*$pattern" {
61 gdb_assert $should_warn $msg
64 gdb_assert !$should_warn $msg