xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.base/watchpoint-hw.exp (revision 8e33eff89e26cf71871ead62f0d5063e1313c33a)
1# Copyright 2008-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 { [use_gdb_stub] } {
17    unsupported "test requires running"
18    return
19}
20
21if {[skip_hw_watchpoint_tests]} {
22    return 0
23}
24
25standard_testfile
26
27if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
28    return -1
29}
30
31# Create the watchpoint before the inferior gets started.  Now the native CPU
32# target is still not active and its `to_can_use_hw_breakpoint' is not
33# installed, therefore only a software watchpoint gets created.
34
35gdb_test "watch watchee" "atchpoint 1: watchee"
36
37# `runto_main' or `runto main' would delete the watchpoint created above.
38
39if { [gdb_start_cmd] < 0 } {
40    fail start
41    return -1
42}
43gdb_test "" "main .* at .*" "start"
44
45# Check it is really a `hw'-watchpoint.
46gdb_test "info watchpoints" "1 *hw watchpoint .* watchee"
47