public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [gdb/testsuite] Require hw watchpoint in gdb.ada/task_watch.exp
@ 2022-11-28 11:56 Tom de Vries
  2022-11-28 16:51 ` Carl Love
  0 siblings, 1 reply; 3+ messages in thread
From: Tom de Vries @ 2022-11-28 11:56 UTC (permalink / raw)
  To: gdb-patches; +Cc: Carl Love, Ulrich Weigand, Tom Tromey

From: Tom de Vries <tdevries@loganberry-1.arch.suse.de>

On powerpc64le-linux I run into:
...
(gdb) PASS: gdb.ada/task_watch.exp: info tasks before inserting breakpoint
watch -location value task 3^M
Watchpoint 2: -location value^M
(gdb) PASS: gdb.ada/task_watch.exp: watch -location value task 3
continue^M
Continuing.^M
[Thread 0x7ffff7ccf170 (LWP 65550) exited]^M
[Thread 0x7ffff7abf170 (LWP 65551) exited]^M
FAIL: gdb.ada/task_watch.exp: continue to watchpoint (timeout)
...

On x86_64-linux (where the test-case passes), a hardware watchpoint is used:
...
(gdb) PASS: gdb.ada/task_watch.exp: info tasks before inserting breakpoint
watch -location value task 3^M
Hardware watchpoint 2: -location value^M
...
and after forcing "set can-use-hw-watchpoints 0" we can intermittently
reproduce the same failure.

In the gdb documentation related to watchpoints in multi-threaded programs, we
read:
...
Warning: In multi-threaded programs, software watchpoints have only limited
usefulness.  If GDB creates a software watchpoint, it can only watch the value
of an expression in a single thread.  If you are confident that the expression
can only change due to the current thread’s activity (and if you are also
confident that no other thread can become current), then you can use software
watchpoints as usual.  However, GDB may not notice when a non-current thread’s
activity changes the expression.  (Hardware watchpoints, in contrast, watch an
expression in all threads.)
...

Since the ada task construct is mapped onto threads, it seems that the
same limitation holds for tasks.

Fix this by using skip_hw_watchpoint_tests.

Tested on powerpc64-linux.
---
 gdb/testsuite/gdb.ada/task_watch.exp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gdb/testsuite/gdb.ada/task_watch.exp b/gdb/testsuite/gdb.ada/task_watch.exp
index b22a6204e90..697074ac164 100644
--- a/gdb/testsuite/gdb.ada/task_watch.exp
+++ b/gdb/testsuite/gdb.ada/task_watch.exp
@@ -19,6 +19,8 @@ load_lib "ada.exp"
 
 if { [skip_ada_tests] } { return -1 }
 
+if { [skip_hw_watchpoint_tests] } { return -1 }
+
 standard_ada_testfile foo
 
 if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
-- 
2.35.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re:  [PATCH] [gdb/testsuite] Require hw watchpoint in gdb.ada/task_watch.exp
  2022-11-28 11:56 [PATCH] [gdb/testsuite] Require hw watchpoint in gdb.ada/task_watch.exp Tom de Vries
@ 2022-11-28 16:51 ` Carl Love
  2022-11-28 17:09   ` Tom de Vries
  0 siblings, 1 reply; 3+ messages in thread
From: Carl Love @ 2022-11-28 16:51 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches; +Cc: Ulrich Weigand, Tom Tromey, cel

Tom:

On Mon, 2022-11-28 at 12:56 +0100, Tom de Vries wrote:
> From: Tom de Vries <tdevries@loganberry-1.arch.suse.de>
> 
> On powerpc64le-linux I run into:
> ...
> (gdb) PASS: gdb.ada/task_watch.exp: info tasks before inserting
> breakpoint
> watch -location value task 3^M
> Watchpoint 2: -location value^M
> (gdb) PASS: gdb.ada/task_watch.exp: watch -location value task 3
> continue^M
> Continuing.^M
> [Thread 0x7ffff7ccf170 (LWP 65550) exited]^M
> [Thread 0x7ffff7abf170 (LWP 65551) exited]^M
> FAIL: gdb.ada/task_watch.exp: continue to watchpoint (timeout)
> ...
> 
> On x86_64-linux (where the test-case passes), a hardware watchpoint
> is used:
> ...
> (gdb) PASS: gdb.ada/task_watch.exp: info tasks before inserting
> breakpoint
> watch -location value task 3^M
> Hardware watchpoint 2: -location value^M
> ...
> and after forcing "set can-use-hw-watchpoints 0" we can
> intermittently
> reproduce the same failure.
> 
> In the gdb documentation related to watchpoints in multi-threaded
> programs, we
> read:
> ...
> Warning: In multi-threaded programs, software watchpoints have only
> limited
> usefulness.  If GDB creates a software watchpoint, it can only watch
> the value
> of an expression in a single thread.  If you are confident that the
> expression
> can only change due to the current thread’s activity (and if you are
> also
> confident that no other thread can become current), then you can use
> software
> watchpoints as usual.  However, GDB may not notice when a non-current 
> thread’s
> activity changes the expression.  (Hardware watchpoints, in contrast,
> watch an
> expression in all threads.)
> ...
> 
> Since the ada task construct is mapped onto threads, it seems that
> the
> same limitation holds for tasks.
> 
> Fix this by using skip_hw_watchpoint_tests.
> 
> Tested on powerpc64-linux.
> ---
>  gdb/testsuite/gdb.ada/task_watch.exp | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/gdb/testsuite/gdb.ada/task_watch.exp
> b/gdb/testsuite/gdb.ada/task_watch.exp
> index b22a6204e90..697074ac164 100644
> --- a/gdb/testsuite/gdb.ada/task_watch.exp
> +++ b/gdb/testsuite/gdb.ada/task_watch.exp
> @@ -19,6 +19,8 @@ load_lib "ada.exp"
> 
>  if { [skip_ada_tests] } { return -1 }
> 
> +if { [skip_hw_watchpoint_tests] } { return -1 }
> +
>  standard_ada_testfile foo
> 
>  if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}]
> != ""} {

Thanks for looking at the ada test failures.  I have not gotten to
working on them yet.

This test passes on Power 10 with/without your patch.

The test fails on Power 9 since the hw watchpoint support is disabled
on Power 9 due to an issue.  The patch fixes the test by not running it
on Power 9.

                       Carl 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] [gdb/testsuite] Require hw watchpoint in gdb.ada/task_watch.exp
  2022-11-28 16:51 ` Carl Love
@ 2022-11-28 17:09   ` Tom de Vries
  0 siblings, 0 replies; 3+ messages in thread
From: Tom de Vries @ 2022-11-28 17:09 UTC (permalink / raw)
  To: Carl Love, gdb-patches; +Cc: Ulrich Weigand, Tom Tromey

On 11/28/22 17:51, Carl Love wrote:
> Tom:
> 
> On Mon, 2022-11-28 at 12:56 +0100, Tom de Vries wrote:
>> From: Tom de Vries <tdevries@loganberry-1.arch.suse.de>
>>
>> On powerpc64le-linux I run into:
>> ...
>> (gdb) PASS: gdb.ada/task_watch.exp: info tasks before inserting
>> breakpoint
>> watch -location value task 3^M
>> Watchpoint 2: -location value^M
>> (gdb) PASS: gdb.ada/task_watch.exp: watch -location value task 3
>> continue^M
>> Continuing.^M
>> [Thread 0x7ffff7ccf170 (LWP 65550) exited]^M
>> [Thread 0x7ffff7abf170 (LWP 65551) exited]^M
>> FAIL: gdb.ada/task_watch.exp: continue to watchpoint (timeout)
>> ...
>>
>> On x86_64-linux (where the test-case passes), a hardware watchpoint
>> is used:
>> ...
>> (gdb) PASS: gdb.ada/task_watch.exp: info tasks before inserting
>> breakpoint
>> watch -location value task 3^M
>> Hardware watchpoint 2: -location value^M
>> ...
>> and after forcing "set can-use-hw-watchpoints 0" we can
>> intermittently
>> reproduce the same failure.
>>
>> In the gdb documentation related to watchpoints in multi-threaded
>> programs, we
>> read:
>> ...
>> Warning: In multi-threaded programs, software watchpoints have only
>> limited
>> usefulness.  If GDB creates a software watchpoint, it can only watch
>> the value
>> of an expression in a single thread.  If you are confident that the
>> expression
>> can only change due to the current thread’s activity (and if you are
>> also
>> confident that no other thread can become current), then you can use
>> software
>> watchpoints as usual.  However, GDB may not notice when a non-current
>> thread’s
>> activity changes the expression.  (Hardware watchpoints, in contrast,
>> watch an
>> expression in all threads.)
>> ...
>>
>> Since the ada task construct is mapped onto threads, it seems that
>> the
>> same limitation holds for tasks.
>>
>> Fix this by using skip_hw_watchpoint_tests.
>>
>> Tested on powerpc64-linux.
>> ---
>>   gdb/testsuite/gdb.ada/task_watch.exp | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/gdb/testsuite/gdb.ada/task_watch.exp
>> b/gdb/testsuite/gdb.ada/task_watch.exp
>> index b22a6204e90..697074ac164 100644
>> --- a/gdb/testsuite/gdb.ada/task_watch.exp
>> +++ b/gdb/testsuite/gdb.ada/task_watch.exp
>> @@ -19,6 +19,8 @@ load_lib "ada.exp"
>>
>>   if { [skip_ada_tests] } { return -1 }
>>
>> +if { [skip_hw_watchpoint_tests] } { return -1 }
>> +
>>   standard_ada_testfile foo
>>
>>   if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}]
>> != ""} {
> 
> Thanks for looking at the ada test failures.  I have not gotten to
> working on them yet.
> 
> This test passes on Power 10 with/without your patch.
> 
> The test fails on Power 9 since the hw watchpoint support is disabled
> on Power 9 due to an issue.  The patch fixes the test by not running it
> on Power 9.

Thanks Carl, pushed with a tested-by tag.

- Tom

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-28 17:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-28 11:56 [PATCH] [gdb/testsuite] Require hw watchpoint in gdb.ada/task_watch.exp Tom de Vries
2022-11-28 16:51 ` Carl Love
2022-11-28 17:09   ` Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).