gdb Power 9 add test for HW watchpoint support.

The Power 9 processor revision 2.2 has HW watchpoint support disabled due
to a HW bug.  The support is fixed in Power 9 processor revision 2.3.  This
patch add a test to lib/gdb.exp for Power to determine if the processor
supports HW watchpoints or not.  If the Power processor doesn't support HW
watchpoints the proceedure skip_hw_watchpoint_tests will return 1 to
disable the various HW watchpoint tests.

The patch has been tested on Power 9, processor revesions 2.2 and 2.3.  The
patch has also been tested on Power 10.  No regression test failures were
found.
This commit is contained in:
Carl Love 2022-01-12 11:56:58 -06:00
parent 61671e9792
commit 8d4e4d13af

View File

@ -3740,12 +3740,15 @@ proc skip_hw_watchpoint_tests {} {
}
# These targets support hardware watchpoints natively
# Note, not all Power 9 processors support hardware watchpoints due to a HW
# bug. Use has_hw_wp_support to check do a runtime check for hardware
# watchpoint support on Powerpc.
if { [istarget "i?86-*-*"]
|| [istarget "x86_64-*-*"]
|| [istarget "ia64-*-*"]
|| [istarget "arm*-*-*"]
|| [istarget "aarch64*-*-*"]
|| [istarget "powerpc*-*-linux*"]
|| ([istarget "powerpc*-*-linux*"] && [has_hw_wp_support])
|| [istarget "s390*-*-*"] } {
return 0
}
@ -8331,5 +8334,62 @@ proc target_file_exists_with_timeout { path } {
return 0
}
gdb_caching_proc has_hw_wp_support {
# Power 9, proc rev 2.2 does not support HW watchpoints due to HW bug.
# Need to use a runtime test to determine if the Power processor has
# support for HW watchpoints.
global srcdir subdir gdb_prompt inferior_exited_re
set compile_flags {debug nowarnings quiet}
set me "has_hw_wp_support"
# Compile a test program to test if HW watchpoints are supported
set src {
int main (void) {
volatile int local;
local = 1;
if (local == 1)
return 1;
return 0;
}
}
if {![gdb_simple_compile $me $src executable $compile_flags]} {
return 0
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load "$obj"
if ![runto_main] {
set has_hw_wp_support 0
return $has_hw_wp_support
}
# The goal is to determine if HW watchpoints are available in general.
# Use "watch" and then check if gdb responds with hardware watch point.
set test "watch local"
gdb_test_multiple $test "Check for HW watchpoint support" {
-re ".*Hardware watchpoint.*" {
# HW watchpoint supported by platform
verbose -log "\n$me: Hardware watchpoint detected"
set has_hw_wp_support 1
}
-re ".*$gdb_prompt $" {
set has_hw_wp_support 0
verbose -log "\n$me: Default, hardware watchpoint not deteced"
}
}
gdb_exit
remote_file build delete $obj
verbose "$me: returning $has_hw_wp_support" 2
return $has_hw_wp_support
}
# Always load compatibility stuff.
load_lib future.exp