1# Copyright 2011-2023 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 16if [skip_hw_watchpoint_tests] { 17 return -1 18} 19 20if { ![support_displaced_stepping] } { 21 unsupported "displaced stepping" 22 return -1 23} 24 25load_lib mi-support.exp 26set MIFLAGS "-i=mi" 27 28proc mi_nonstop_resume { command test } { 29 if { [mi_send_resuming_command $command $test] != 0 } { 30 # If a resume fails, assume non-stop is broken or unsupported 31 # for this target. We have logged a FAIL or UNSUPPORTED; skip 32 # the remaining tests to limit timeouts. 33 return -code continue 34 } 35} 36 37# 38# Start here 39# 40standard_testfile watch-nonstop.c 41 42if {[gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable {debug}] != "" } { 43 return -1 44} 45 46save_vars { GDBFLAGS } { 47 append GDBFLAGS " -ex \"set non-stop on\"" 48 mi_clean_restart $binfile 49} 50 51mi_gdb_test "-gdb-set mi-async 1" ".*" 52mi_detect_async 53 54if { [mi_runto_main] < 0 } { 55 return 56} 57 58# Set a watchpoint. 59mi_gdb_test "111-break-watch global" \ 60 "111\\^done,wpt=\{number=\"2\",exp=\"global\"\}" \ 61 "break-watch operation" 62 63# Set the target running. 64mi_nonstop_resume "exec-continue" "resume 1" 65 66# Now try deleting the watchpoint. This would fail with "Couldn't 67# write debug register: No such process." on GNU/Linux, because we'd 68# try to poke at the debug registers of a running thread. 69mi_gdb_test "777-break-delete 2" \ 70 "777\\^done" \ 71 "delete watchpoint" 72