This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] aarch64: PR 19806: watchpoints: false negatives + PR 20207 contiguous ones
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Yao Qi <qiyaoltc at gmail dot com>, gdb-patches at sourceware dot org
- Date: Thu, 3 May 2018 11:15:32 +0200
- Subject: Re: [patch] aarch64: PR 19806: watchpoints: false negatives + PR 20207 contiguous ones
- References: <20170327210753.GA29656@host1.jankratochvil.net> <20171018195237.GA19714@host1.jankratochvil.net> <867evczxik.fsf@gmail.com> <20171103220437.GA13979@host1.jankratochvil.net> <20180321190316.GA32598@host1.jankratochvil.net> <1e06eb53-60f4-0800-a4f6-458e02f840bd@redhat.com> <20180426201216.GA218540@host1.jankratochvil.net> <20180501230339.GA3136080@host1.jankratochvil.net> <20180501230606.GA3138797@host1.jankratochvil.net>
Hi,
some add-on diff to prevent FAILs on s390x/ppc64/ppc64le/arm32.
Jan
diff --git a/gdb/testsuite/gdb.base/watchpoint-unaligned.c b/gdb/testsuite/gdb.base/watchpoint-unaligned.c
index 97832a05d4..8934de214e 100644
--- a/gdb/testsuite/gdb.base/watchpoint-unaligned.c
+++ b/gdb/testsuite/gdb.base/watchpoint-unaligned.c
@@ -67,18 +67,25 @@ main (void)
{
switch (size)
{
+/* __s390x__ also defines __s390__ */
+#ifdef __s390__
+# define ACCESS(var) var = ~var
+#else
+# define ACCESS(var) local = var
+#endif
case 8:
- local = data.u.size8[offset];
+ ACCESS (data.u.size8[offset]);
break;
case 4:
- local = data.u.size4[offset];
+ ACCESS (data.u.size4[offset]);
break;
case 2:
- local = data.u.size2[offset];
+ ACCESS (data.u.size2[offset]);
break;
case 1:
- local = data.u.size1[offset];
+ ACCESS (data.u.size1[offset]);
break;
+#undef ACCESS
default:
assert (0);
}
diff --git a/gdb/testsuite/gdb.base/watchpoint-unaligned.exp b/gdb/testsuite/gdb.base/watchpoint-unaligned.exp
index 25a15a89fd..6bdd4b6d05 100644
--- a/gdb/testsuite/gdb.base/watchpoint-unaligned.exp
+++ b/gdb/testsuite/gdb.base/watchpoint-unaligned.exp
@@ -32,6 +32,14 @@ gdb_breakpoint [gdb_get_line_number "start_again"] "Breakpoint $decimal at $hex"
set sizes {1 2 4 8}
array set alignedend {1 1 2 2 3 4 4 4 5 8 6 8 7 8 8 8}
+set rwatch "rwatch"
+set rwatch_exp "Hardware read watchpoint"
+if {[istarget "s390*-*-*"]} {
+ # Target does not support this type of hardware watchpoint."
+ set rwatch "watch"
+ set rwatch_exp "Hardware watchpoint"
+}
+
foreach wpsize $sizes {
for {set wpoffset 0} {$wpoffset < 8 / $wpsize} {incr wpoffset} {
set wpstart [expr $wpoffset * $wpsize]
@@ -42,19 +50,26 @@ foreach wpsize $sizes {
set rdstart [expr $rdoffset * $rdsize]
set rdend [expr ($rdoffset + 1) * $rdsize]
set expect_hit [expr max ($wpstart, $rdstart) < min ($wpend, $rdend)]
- set test "rwatch data.u.size$wpsize\[$wpoffset\]"
+ set test "$rwatch data.u.size$wpsize\[$wpoffset\]"
set wpnum ""
gdb_test_multiple $test $test {
- -re "Hardware read watchpoint (\[0-9\]+): .*\r\n$gdb_prompt $" {
+ -re "$rwatch_exp (\[0-9\]+): .*\r\n$gdb_prompt $" {
set wpnum $expect_out(1,string)
}
+ -re "Expression cannot be implemented with read/access watchpoint.\r\n$gdb_prompt $" {
+ if {$wpsize == 8 && [istarget "arm*-*-*"]} {
+ untested $test
+ continue
+ }
+ fail $test
+ }
}
gdb_test_no_output "set variable size = $rdsize" ""
gdb_test_no_output "set variable offset = $rdoffset" ""
set test "continue"
set got_hit 0
gdb_test_multiple $test $test {
- -re "Hardware read watchpoint $wpnum:.*Value = .*\r\n$gdb_prompt $" {
+ -re "$rwatch_exp $wpnum:.*alue = .*\r\n$gdb_prompt $" {
set got_hit 1
send_gdb "continue\n"
exp_continue
@@ -72,6 +87,9 @@ foreach wpsize $sizes {
if {$expect_hit == 0 && $rdstart < $wpendaligned} {
setup_xfail external/20207 "aarch64*-*-linux*"
}
+ if {!$expect_hit && [expr max ($wpstart / 8, $rdstart / 8) < min (($wpend + 7) / 8, ($rdend + 7) / 8)]} {
+ setup_xfail breakpoints/23131 "powerpc*-*-*"
+ }
fail $test
}
}
@@ -82,12 +100,20 @@ foreach wpsize $sizes {
foreach wpcount {4 7} {
array set wpoffset_to_wpnum {}
for {set wpoffset 1} {$wpoffset <= $wpcount} {incr wpoffset} {
- set test "rwatch data.u.size1\[$wpoffset\]"
+ set test "$rwatch data.u.size1\[$wpoffset\]"
set wpnum ""
gdb_test_multiple $test $test {
- -re "Hardware read watchpoint (\[0-9\]+): .*\r\n$gdb_prompt $" {
+ -re "$rwatch_exp (\[0-9\]+): .*\r\n$gdb_prompt $" {
set wpoffset_to_wpnum($wpoffset) $expect_out(1,string)
}
+ -re "There are not enough available hardware resources for this watchpoint.\r\n$gdb_prompt $" {
+ if {$wpoffset > 1} {
+ setup_xfail breakpoints/23131 "powerpc*-*-*"
+ setup_xfail breakpoints/23131 "arm*-*-*"
+ }
+ fail $test
+ set wpoffset_to_wpnum($wpoffset) 0
+ }
}
}
gdb_test_no_output "set variable size = 1" ""
@@ -97,7 +123,7 @@ foreach wpcount {4 7} {
gdb_test_multiple $test $test {
-re "\r\nCould not insert hardware watchpoint .*\r\n$gdb_prompt $" {
}
- -re "Hardware read watchpoint $wpoffset_to_wpnum(1):.*Value = .*\r\n$gdb_prompt $" {
+ -re "$rwatch_exp $wpoffset_to_wpnum(1):.*alue = .*\r\n$gdb_prompt $" {
set got_hit 1
send_gdb "continue\n"
exp_continue
@@ -106,11 +132,19 @@ foreach wpcount {4 7} {
}
}
for {set wpoffset 1} {$wpoffset <= $wpcount} {incr wpoffset} {
- gdb_test_no_output "delete $wpoffset_to_wpnum($wpoffset)" ""
+ if {$wpoffset_to_wpnum($wpoffset)} {
+ gdb_test_no_output "delete $wpoffset_to_wpnum($wpoffset)" ""
+ }
}
set test "wpcount($wpcount)"
+ if {!$wpoffset_to_wpnum([expr $wpcount - 1])} {
+ untested $test
+ continue
+ }
if {$wpcount > 4} {
- setup_kfail tdep/22389 *-*-*
+ if {![istarget "s390*-*-*"]} {
+ setup_kfail tdep/22389 *-*-*
+ }
}
gdb_assert $got_hit $test
}
@@ -125,18 +159,26 @@ gdb_test_multiple $test $test {
-re "Hardware watchpoint (\[0-9\]+): .*\r\n$gdb_prompt $" {
set wpnum $expect_out(1,string)
}
-}
-set test "continue"
-set got_hit 0
-gdb_test_multiple $test $test {
- -re "\r\nCould not insert hardware watchpoint .*\r\n$gdb_prompt $" {
- }
- -re "Hardware watchpoint $wpnum:.*New value = .*\r\n$gdb_prompt $" {
- set got_hit 1
- send_gdb "continue\n"
- exp_continue
+ -re "Watchpoint (\[0-9\]+): .*\r\n$gdb_prompt $" {
+ if {[istarget "arm*-*-*"]} {
+ untested $test
+ set wpnum 0
+ }
}
- -re " final_return .*\r\n$gdb_prompt $" {
+}
+if {$wpnum} {
+ set test "continue"
+ set got_hit 0
+ gdb_test_multiple $test $test {
+ -re "\r\nCould not insert hardware watchpoint .*\r\n$gdb_prompt $" {
+ }
+ -re "Hardware watchpoint $wpnum:.*New value = .*\r\n$gdb_prompt $" {
+ set got_hit 1
+ send_gdb "continue\n"
+ exp_continue
+ }
+ -re " final_return .*\r\n$gdb_prompt $" {
+ }
}
+ gdb_assert $got_hit "size8twice write"
}
-gdb_assert $got_hit "size8twice write"