1 # Copyright
2023-2024 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 # Ask GDB to
watch a large structure before the inferior has started
,
17 # GDB will assume it can place a hardware watchpoint.
19 # Once the inferior starts GDB realises that it is not able to
watch
20 # such a large structure and downgrades to a software watchpoint.
22 # This test checks that GDB emits a warnings about this downgrade
, as
23 # a software watchpoint will be significantly slower than a hardware
24 # watchpoint
, and the user probably wants to know about this.
26 require target_can_use_run_cmd is_x86_64_m64_target
28 # The remote
/extended
-remote target has its own
set of flags to
29 # control the use of s
/w vs h
/w watchpoints
, this test isn
't about
30 # those, so skip the test in these cases.
31 if {[target_info gdb_protocol] == "remote"
32 || [target_info gdb_protocol] == "extended-remote"} {
33 unsupported "using [target_info gdb_protocol] protocol"
39 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
44 # Insert the watchpoint, it should default to a h/w watchpoint.
45 gdb_test "watch global_var" \
46 "Hardware watchpoint $decimal: global_var"
47 set num [get_integer_valueof "\$bpnum" "*UNKNOWN*" \
48 "get watchpoint number"]
50 # Watchpoint should initially show as a h/w watchpoint.
51 gdb_test "info watchpoints" \
52 "\r\n$num\\s+hw watchpoint\\s+keep\\s+y\\s+global_var" \
53 "check info watchpoints before starting"
55 # Start the inferior, GDB should emit a warning that the watchpoint
59 "warning: watchpoint $num downgraded to software watchpoint" \
61 "Program stopped\\." \
64 # Watchpoint should now have downgraded to a s/w watchpoint.
65 gdb_test "info watchpoints" \
66 "\r\n$num\\s+watchpoint\\s+keep\\s+y\\s+global_var" \
67 "check info watchpoints after starting"