public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v3] Fix hardware watchpoints in replay mode
       [not found] <20231121164241.302-1-ssbssa.ref@yahoo.de>
@ 2023-11-21 16:42 ` Hannes Domani
  2023-12-05 17:57   ` Hannes Domani
  2023-12-06 12:00   ` Guinevere Larsen
  0 siblings, 2 replies; 4+ messages in thread
From: Hannes Domani @ 2023-11-21 16:42 UTC (permalink / raw)
  To: gdb-patches; +Cc: pedro

Changes introduced by commit 9e8915c6cee5c37637521b424d723e990e06d597
caused a regression that meant hardware watchpoint stops would not
trigger in reverse execution or replay mode.  This was documented in
PR breakpoints/21969.
The problem is that record_check_stopped_by_breakpoint always overwrites
record_full_stop_reason, thus loosing the TARGET_STOPPED_BY_WATCHPOINT
value which would be checked afterwards.

This commit fixes that by not overwriting the stop-reason in
record_full_stop_reason if we're not stopped at a breakpoint.

And the test for hw watchpoints in gdb.reverse/watch-reverse.exp actually
tested sw watchpoints again, since "set can-use-hw-watchpoints 1"
doesn't convert enabled watchpoints to use hardware.
This is fixed by disabling said watchpoint while enabling hw watchpoints.
The same is not done for gdb.reverse/watch-precsave.exp, since it's not
possible to use hw watchpoints in restored recordings anyways.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=21969
---
 gdb/record.c                                | 1 -
 gdb/testsuite/gdb.reverse/watch-reverse.exp | 4 ++++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/gdb/record.c b/gdb/record.c
index f7c82665b05..88235e36da7 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -248,7 +248,6 @@ record_check_stopped_by_breakpoint (const address_space *aspace,
       return 1;
     }
 
-  *reason = TARGET_STOPPED_BY_NO_REASON;
   return 0;
 }
 
diff --git a/gdb/testsuite/gdb.reverse/watch-reverse.exp b/gdb/testsuite/gdb.reverse/watch-reverse.exp
index 6b81a6fdf88..a7126ac9b1d 100644
--- a/gdb/testsuite/gdb.reverse/watch-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/watch-reverse.exp
@@ -118,8 +118,12 @@ gdb_test "continue" \
     ".*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = -1.*ival3 = count; ival4 = count;.*" \
     "watchpoint hit in reverse, fifth time"
 
+gdb_test_no_output "disable \$bpnum" "disable non-hw watchpoint"
+
 gdb_test_no_output "set can-use-hw-watchpoints 1" "enable hw watchpoints"
 
+gdb_test_no_output "enable \$bpnum" "enable hw watchpoint"
+
 ###
 ###
 ###
-- 
2.35.1


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

* Re: [PATCH v3] Fix hardware watchpoints in replay mode
  2023-11-21 16:42 ` [PATCH v3] Fix hardware watchpoints in replay mode Hannes Domani
@ 2023-12-05 17:57   ` Hannes Domani
  2023-12-06 12:00   ` Guinevere Larsen
  1 sibling, 0 replies; 4+ messages in thread
From: Hannes Domani @ 2023-12-05 17:57 UTC (permalink / raw)
  To: gdb-patches

 Ping.


Am Dienstag, 21. November 2023, 17:43:23 MEZ hat Hannes Domani <ssbssa@yahoo.de> Folgendes geschrieben:

> Changes introduced by commit 9e8915c6cee5c37637521b424d723e990e06d597
> caused a regression that meant hardware watchpoint stops would not
> trigger in reverse execution or replay mode.  This was documented in
> PR breakpoints/21969.
> The problem is that record_check_stopped_by_breakpoint always overwrites
> record_full_stop_reason, thus loosing the TARGET_STOPPED_BY_WATCHPOINT
> value which would be checked afterwards.
>
> This commit fixes that by not overwriting the stop-reason in
> record_full_stop_reason if we're not stopped at a breakpoint.
>
> And the test for hw watchpoints in gdb.reverse/watch-reverse.exp actually
> tested sw watchpoints again, since "set can-use-hw-watchpoints 1"
> doesn't convert enabled watchpoints to use hardware.
> This is fixed by disabling said watchpoint while enabling hw watchpoints.
> The same is not done for gdb.reverse/watch-precsave.exp, since it's not
> possible to use hw watchpoints in restored recordings anyways.
>
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=21969
> ---
> gdb/record.c                                | 1 -
> gdb/testsuite/gdb.reverse/watch-reverse.exp | 4 ++++
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/gdb/record.c b/gdb/record.c
> index f7c82665b05..88235e36da7 100644
> --- a/gdb/record.c
> +++ b/gdb/record.c
> @@ -248,7 +248,6 @@ record_check_stopped_by_breakpoint (const address_space *aspace,
>       return 1;
>     }
>
> -  *reason = TARGET_STOPPED_BY_NO_REASON;
>   return 0;
> }
>
> diff --git a/gdb/testsuite/gdb.reverse/watch-reverse.exp b/gdb/testsuite/gdb.reverse/watch-reverse.exp
> index 6b81a6fdf88..a7126ac9b1d 100644
> --- a/gdb/testsuite/gdb.reverse/watch-reverse.exp
> +++ b/gdb/testsuite/gdb.reverse/watch-reverse.exp
> @@ -118,8 +118,12 @@ gdb_test "continue" \
>     ".*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = -1.*ival3 = count; ival4 = count;.*" \
>     "watchpoint hit in reverse, fifth time"
>
> +gdb_test_no_output "disable \$bpnum" "disable non-hw watchpoint"
> +
> gdb_test_no_output "set can-use-hw-watchpoints 1" "enable hw watchpoints"
>
> +gdb_test_no_output "enable \$bpnum" "enable hw watchpoint"
> +
> ###
> ###
> ###
> --
> 2.35.1

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

* Re: [PATCH v3] Fix hardware watchpoints in replay mode
  2023-11-21 16:42 ` [PATCH v3] Fix hardware watchpoints in replay mode Hannes Domani
  2023-12-05 17:57   ` Hannes Domani
@ 2023-12-06 12:00   ` Guinevere Larsen
  2023-12-06 12:49     ` Hannes Domani
  1 sibling, 1 reply; 4+ messages in thread
From: Guinevere Larsen @ 2023-12-06 12:00 UTC (permalink / raw)
  To: Hannes Domani, gdb-patches; +Cc: pedro

On 21/11/2023 17:42, Hannes Domani wrote:
> Changes introduced by commit 9e8915c6cee5c37637521b424d723e990e06d597
> caused a regression that meant hardware watchpoint stops would not
> trigger in reverse execution or replay mode.  This was documented in
> PR breakpoints/21969.
> The problem is that record_check_stopped_by_breakpoint always overwrites
> record_full_stop_reason, thus loosing the TARGET_STOPPED_BY_WATCHPOINT
> value which would be checked afterwards.
>
> This commit fixes that by not overwriting the stop-reason in
> record_full_stop_reason if we're not stopped at a breakpoint.
>
> And the test for hw watchpoints in gdb.reverse/watch-reverse.exp actually
> tested sw watchpoints again, since "set can-use-hw-watchpoints 1"
> doesn't convert enabled watchpoints to use hardware.
> This is fixed by disabling said watchpoint while enabling hw watchpoints.
> The same is not done for gdb.reverse/watch-precsave.exp, since it's not
> possible to use hw watchpoints in restored recordings anyways.
>
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=21969
> ---
I checked again; this patch adds no regression, and fixes the issue that 
you described. Since this patch only relates to reverse execution, I say 
its ready for upstreaming.

Approved-by: Guinevere Larsen <blarsen@redhat.com>

-- 
Cheers,
Guinevere Larsen
She/Her/Hers

>   gdb/record.c                                | 1 -
>   gdb/testsuite/gdb.reverse/watch-reverse.exp | 4 ++++
>   2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/gdb/record.c b/gdb/record.c
> index f7c82665b05..88235e36da7 100644
> --- a/gdb/record.c
> +++ b/gdb/record.c
> @@ -248,7 +248,6 @@ record_check_stopped_by_breakpoint (const address_space *aspace,
>         return 1;
>       }
>   
> -  *reason = TARGET_STOPPED_BY_NO_REASON;
>     return 0;
>   }
>   
> diff --git a/gdb/testsuite/gdb.reverse/watch-reverse.exp b/gdb/testsuite/gdb.reverse/watch-reverse.exp
> index 6b81a6fdf88..a7126ac9b1d 100644
> --- a/gdb/testsuite/gdb.reverse/watch-reverse.exp
> +++ b/gdb/testsuite/gdb.reverse/watch-reverse.exp
> @@ -118,8 +118,12 @@ gdb_test "continue" \
>       ".*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = -1.*ival3 = count; ival4 = count;.*" \
>       "watchpoint hit in reverse, fifth time"
>   
> +gdb_test_no_output "disable \$bpnum" "disable non-hw watchpoint"
> +
>   gdb_test_no_output "set can-use-hw-watchpoints 1" "enable hw watchpoints"
>   
> +gdb_test_no_output "enable \$bpnum" "enable hw watchpoint"
> +
>   ###
>   ###
>   ###


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

* Re: [PATCH v3] Fix hardware watchpoints in replay mode
  2023-12-06 12:00   ` Guinevere Larsen
@ 2023-12-06 12:49     ` Hannes Domani
  0 siblings, 0 replies; 4+ messages in thread
From: Hannes Domani @ 2023-12-06 12:49 UTC (permalink / raw)
  To: gdb-patches, Guinevere Larsen; +Cc: pedro

 Am Mittwoch, 6. Dezember 2023, 13:00:57 MEZ hat Guinevere Larsen <blarsen@redhat.com> Folgendes geschrieben:

> On 21/11/2023 17:42, Hannes Domani wrote:
> > Changes introduced by commit 9e8915c6cee5c37637521b424d723e990e06d597
> > caused a regression that meant hardware watchpoint stops would not
> > trigger in reverse execution or replay mode.  This was documented in
> > PR breakpoints/21969.
> > The problem is that record_check_stopped_by_breakpoint always overwrites
> > record_full_stop_reason, thus loosing the TARGET_STOPPED_BY_WATCHPOINT
> > value which would be checked afterwards.
> >
> > This commit fixes that by not overwriting the stop-reason in
> > record_full_stop_reason if we're not stopped at a breakpoint.
> >
> > And the test for hw watchpoints in gdb.reverse/watch-reverse.exp actually
> > tested sw watchpoints again, since "set can-use-hw-watchpoints 1"
> > doesn't convert enabled watchpoints to use hardware.
> > This is fixed by disabling said watchpoint while enabling hw watchpoints.
> > The same is not done for gdb.reverse/watch-precsave.exp, since it's not
> > possible to use hw watchpoints in restored recordings anyways.
> >
> > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=21969
> > ---
> I checked again; this patch adds no regression, and fixes the issue that
> you described. Since this patch only relates to reverse execution, I say
> its ready for upstreaming.
>
> Approved-by: Guinevere Larsen <blarsen@redhat.com>

Pushed, thanks.

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

end of thread, other threads:[~2023-12-06 12:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20231121164241.302-1-ssbssa.ref@yahoo.de>
2023-11-21 16:42 ` [PATCH v3] Fix hardware watchpoints in replay mode Hannes Domani
2023-12-05 17:57   ` Hannes Domani
2023-12-06 12:00   ` Guinevere Larsen
2023-12-06 12:49     ` Hannes Domani

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).