1 # Copyright
2021-2023 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 # Regression test
for PR gdb
/28621. Test that GDB does not misreport
17 # a watchpoint hit when a previous watchpoint hit is immediately
18 # followed by a catchpoint hit.
20 # This test uses
"awatch".
21 require allow_hw_watchpoint_access_tests
25 if {[build_executable
"failed to prepare" $testfile $srcfile debug]} {
29 # Check that fork catchpoints are supported. Returns
1 if they are.
30 # Returns
0 and issues unsupported
if they are not supported.
If it
31 # couldn
't be determined, returns 0 (but does not call unsupported).
33 proc_with_prefix catch_fork_supported {} {
34 clean_restart $::testfile
36 if { ![runto_main] } {
40 # Verify that the system supports "catch fork".
41 gdb_test "catch fork" "Catchpoint \[0-9\]* \\(fork\\)" "insert first fork catchpoint"
42 set has_fork_catchpoints -1
43 gdb_test_multiple "continue" "continue to first fork catchpoint" {
44 -re -wrap ".*Your system does not support this type\r\nof catchpoint.*" {
45 set has_fork_catchpoints 0
48 -re -wrap ".*Catchpoint.*" {
49 set has_fork_catchpoints 1
54 if {$has_fork_catchpoints == 1} {
56 } elseif {$has_fork_catchpoints == -1} {
59 unsupported "catch fork not supported"
66 proc_with_prefix test {} {
67 clean_restart $::testfile
69 if { ![runto_main] } {
73 gdb_test "awatch global_var" \
74 "Hardware access \\(read/write\\) watchpoint .*: global_var.*" \
75 "watchpoint on global variable"
78 "Hardware access \\(read/write\\) watchpoint .*: global_var.*" \
79 "continue to watchpoint"
82 gdb_test_multiple "continue" "continue to catch fork" {
87 -re "$::gdb_prompt " {
88 gdb_assert { !$seen_watchpoint } $gdb_test_name
93 if {![catch_fork_supported] } {