Update copyright year range in header of all files managed by GDB
[binutils-gdb.git] / gdb / testsuite / gdb.base / hbreak-unmapped.exp
blob3572452a7c6205b6016313af28ea15ce7e4c2bb1
1 # Copyright 2014-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 if {[skip_hw_breakpoint_tests]} {
17     return 0
20 standard_testfile
22 if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
23     return -1
26 if ![runto_main] {
27     return -1
30 # If we can read the memory at address 0, skip the test.
31 if { [is_address_zero_readable] } {
32     untested "memory at address 0 is readable"
33     return
36 delete_breakpoints
38 # Test whether the target supports hardware breakpoints at all.
40 set supports_hbreak 0
41 set test "probe hardware breakpoint support"
42 gdb_test_multiple "hbreak -q main" $test {
43     -re "No hardware breakpoint support in the target.*$gdb_prompt $" {
44         pass $test
45     }
46     -re "Hardware breakpoints used exceeds limit.*$gdb_prompt $" {
47         pass $test
48     }
49     -re "Hardware assisted breakpoint.*at.* file .*$srcfile, line.*$gdb_prompt $" {
50         set supports_hbreak 1
51         pass $test
52     }
55 if {!$supports_hbreak} {
56     unsupported "hardware breakpoints"
57     return
60 delete_breakpoints
62 # Force immediate breakpoint insertion.
63 gdb_test_no_output "set breakpoint always-inserted on"
65 # Hardware breakpoints are implemented using a mechanism that is not
66 # dependent on being able to modify the target's memory, we should be
67 # able to set them even in unmapped memory areas.
68 gdb_test "hbreak *0" "Hardware assisted breakpoint \[0-9\]+ at 0x0"
70 gdb_test "info break" "hw breakpoint.*y.*0x0\+\[ \t\]\+" \
71     "info break shows hw breakpoint"
73 gdb_test_no_output "delete \$bpnum" "" "delete" \
74     "delete hw breakpoint"
76 gdb_test "info break" "No breakpoints or watchpoints\." \
77     "info break shows no breakpoints"