forked from Imagelibrary/binutils-gdb
This commit is the result of the following actions:
- Running gdb/copyright.py to update all of the copyright headers to
include 2024,
- Manually updating a few files the copyright.py script told me to
update, these files had copyright headers embedded within the
file,
- Regenerating gdbsupport/Makefile.in to refresh it's copyright
date,
- Using grep to find other files that still mentioned 2023. If
these files were updated last year from 2022 to 2023 then I've
updated them this year to 2024.
I'm sure I've probably missed some dates. Feel free to fix them up as
you spot them.
118 lines
5.5 KiB
Plaintext
118 lines
5.5 KiB
Plaintext
# Copyright 2009-2024 Free Software Foundation, Inc.
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
# This file was written by Pierre Muller. (muller@ics.u-strasbg.fr)
|
|
|
|
# The allow_hw_watchpoint_tests checks if watchpoints are supported by the
|
|
# processor. On PowerPC, the check runs a small test program under gdb
|
|
# to determine if the Power processor supports HW watchpoints. The check
|
|
# must be done before starting the test so as to not disrupt the execution
|
|
# of the actual test.
|
|
|
|
set allow_hw_watchpoint_tests_p [allow_hw_watchpoint_tests]
|
|
|
|
|
|
standard_testfile
|
|
|
|
set wp_set 1
|
|
|
|
if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
|
|
return -1
|
|
}
|
|
|
|
with_test_prefix "before inferior start" {
|
|
# Ensure that if we turn off hardware watchpoints and set a watch point
|
|
# before starting the inferior the watchpoint created will not be a
|
|
# hardware watchpoint.
|
|
gdb_test_no_output "set can-use-hw-watchpoints 0" ""
|
|
gdb_test "watch ival1" "Watchpoint \[0-9\]+: ival1" \
|
|
"create watchpoint"
|
|
|
|
# The next tests are written to match the current state of gdb: access
|
|
# and read watchpoints require hardware watchpoint support, with this
|
|
# turned off these can't be created.
|
|
gdb_test "awatch ival1" \
|
|
"Can't set read/access watchpoint when hardware watchpoints are disabled." \
|
|
"create access watchpoint"
|
|
gdb_test "rwatch ival1" \
|
|
"Can't set read/access watchpoint when hardware watchpoints are disabled." \
|
|
"create read watchpoint"
|
|
}
|
|
|
|
# This will turn hardware watchpoints back on and delete the watchpoint
|
|
# we just created.
|
|
clean_restart ${binfile}
|
|
|
|
# Disable hardware watchpoints if necessary.
|
|
if {!$allow_hw_watchpoint_tests_p} {
|
|
gdb_test_no_output "set can-use-hw-watchpoints 0" ""
|
|
}
|
|
|
|
runto_main
|
|
gdb_test "watch ival1" ".*" ""
|
|
gdb_test "watch ival3" ".*" ""
|
|
|
|
set prev_timeout $timeout
|
|
set timeout 600
|
|
|
|
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival1.*Old value = -1.*New value = 0.*ival1 = count; ival2 = count;.*" "watchpoint ival1 hit, first time"
|
|
|
|
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count; ival4 = count;.*" "watchpoint ival3 hit, first time"
|
|
|
|
# Check that the ival3 hit count is reported correctly
|
|
gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 1 time.*" "watchpoint hit count is 1"
|
|
|
|
# Continue until the next change for ival1, from 0 to 1.
|
|
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival1.*Old value = 0.*New value = 1.*ival1 = count; ival2 = count;.*" "watchpoint ival1 hit, second time"
|
|
|
|
# Check that the hit count for ival1 is reported correctly
|
|
gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival1\r\n\[ \t]+breakpoint already hit 2 times.*" "watchpoint ival1 hit count is 2"
|
|
|
|
# Continue until the next change for ival3, from 0 to 1.
|
|
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = 1.*ival3 = count; ival4 = count;.*" "watchpoint hit, second time"
|
|
|
|
# Check that the hit count is reported correctly
|
|
gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 2 times.*" "watchpoint hit count is 2"
|
|
|
|
# Continue until the next change, from 1 to 2.
|
|
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival1.*Old value = 1.*New value = 2.*ival1 = count; ival2 = count;.*" "watchpoint ival1 hit, third time"
|
|
|
|
# Check that the hit count is reported correctly
|
|
gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival1\r\n\[ \t]+breakpoint already hit 3 times.*" "watchpoint ival1 hit count is 3"
|
|
# Disable ival1 watchpoint
|
|
gdb_test_no_output "disable 2" ""
|
|
|
|
# Continue until the next change, from 1 to 2.
|
|
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 2.*ival3 = count; ival4 = count;.*" "watchpoint hit, third time"
|
|
|
|
# Check that the hit count is reported correctly
|
|
gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 3 times.*" "watchpoint hit count is 3"
|
|
|
|
# Continue until the next change, from 2 to 3.
|
|
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 3.*ival3 = count; ival4 = count;.*" "watchpoint hit, fourth time"
|
|
|
|
# Check that the hit count is reported correctly
|
|
gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 4 times.*" "watchpoint hit count is 4"
|
|
|
|
# Continue until the next change, from 3 to 4.
|
|
# Note that this one is outside the loop.
|
|
|
|
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 3.*New value = 4.*ival3 = count; ival4 = count;.*" "watchpoint hit, fifth time"
|
|
|
|
# Check that the hit count is reported correctly
|
|
gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 5 times.*" "watchpoint hit count is 5"
|
|
|
|
set timeout $prev_timeout
|