All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] replay: fix watchpoint processing for reverse debugging
@ 2021-05-11  9:11 Pavel Dovgalyuk
  2021-05-25  6:40 ` Pavel Dovgalyuk
  2021-05-25 23:11 ` Richard Henderson
  0 siblings, 2 replies; 3+ messages in thread
From: Pavel Dovgalyuk @ 2021-05-11  9:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee, pbonzini, pavel.dovgalyuk

This patch enables reverse debugging with watchpoints.
Reverse continue scans the execution to find the breakpoints
and watchpoints that should fire. It uses helper function
replay_breakpoint() for that. But this function needs to access
icount, which can't be correct in the middle of TB.
Therefore, in case of watchpoint, we have to retranslate the block
to allow this access.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
---
 softmmu/physmem.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index 5232696571..2826d60cef 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -904,6 +904,16 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
         if (watchpoint_address_matches(wp, addr, len)
             && (wp->flags & flags)) {
             if (replay_running_debug()) {
+                /*
+                 * replay_breakpoint reads icount.
+                 * Force recompile to succeed, because icount may
+                 * be read only at the end of the block.
+                 */
+                if (!cpu->can_do_io) {
+                    /* Force execution of one insn next time.  */
+                    cpu->cflags_next_tb = 1 | CF_LAST_IO | curr_cflags(cpu);
+                    cpu_loop_exit_restore(cpu, ra);
+                }
                 /*
                  * Don't process the watchpoints when we are
                  * in a reverse debugging operation.



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

* Re: [PATCH] replay: fix watchpoint processing for reverse debugging
  2021-05-11  9:11 [PATCH] replay: fix watchpoint processing for reverse debugging Pavel Dovgalyuk
@ 2021-05-25  6:40 ` Pavel Dovgalyuk
  2021-05-25 23:11 ` Richard Henderson
  1 sibling, 0 replies; 3+ messages in thread
From: Pavel Dovgalyuk @ 2021-05-25  6:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, alex.bennee

ping

On 11.05.2021 12:11, Pavel Dovgalyuk wrote:
> This patch enables reverse debugging with watchpoints.
> Reverse continue scans the execution to find the breakpoints
> and watchpoints that should fire. It uses helper function
> replay_breakpoint() for that. But this function needs to access
> icount, which can't be correct in the middle of TB.
> Therefore, in case of watchpoint, we have to retranslate the block
> to allow this access.
> 
> Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
> ---
>   softmmu/physmem.c |   10 ++++++++++
>   1 file changed, 10 insertions(+)
> 
> diff --git a/softmmu/physmem.c b/softmmu/physmem.c
> index 5232696571..2826d60cef 100644
> --- a/softmmu/physmem.c
> +++ b/softmmu/physmem.c
> @@ -904,6 +904,16 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
>           if (watchpoint_address_matches(wp, addr, len)
>               && (wp->flags & flags)) {
>               if (replay_running_debug()) {
> +                /*
> +                 * replay_breakpoint reads icount.
> +                 * Force recompile to succeed, because icount may
> +                 * be read only at the end of the block.
> +                 */
> +                if (!cpu->can_do_io) {
> +                    /* Force execution of one insn next time.  */
> +                    cpu->cflags_next_tb = 1 | CF_LAST_IO | curr_cflags(cpu);
> +                    cpu_loop_exit_restore(cpu, ra);
> +                }
>                   /*
>                    * Don't process the watchpoints when we are
>                    * in a reverse debugging operation.
> 



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

* Re: [PATCH] replay: fix watchpoint processing for reverse debugging
  2021-05-11  9:11 [PATCH] replay: fix watchpoint processing for reverse debugging Pavel Dovgalyuk
  2021-05-25  6:40 ` Pavel Dovgalyuk
@ 2021-05-25 23:11 ` Richard Henderson
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2021-05-25 23:11 UTC (permalink / raw)
  To: Pavel Dovgalyuk, qemu-devel; +Cc: pbonzini, alex.bennee

On 5/11/21 2:11 AM, Pavel Dovgalyuk wrote:
> This patch enables reverse debugging with watchpoints.
> Reverse continue scans the execution to find the breakpoints
> and watchpoints that should fire. It uses helper function
> replay_breakpoint() for that. But this function needs to access
> icount, which can't be correct in the middle of TB.
> Therefore, in case of watchpoint, we have to retranslate the block
> to allow this access.
> 
> Signed-off-by: Pavel Dovgalyuk<Pavel.Dovgalyuk@ispras.ru>
> ---
>   softmmu/physmem.c |   10 ++++++++++
>   1 file changed, 10 insertions(+)

Queued to tcg-next, thanks.


r~


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

end of thread, other threads:[~2021-05-25 23:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-11  9:11 [PATCH] replay: fix watchpoint processing for reverse debugging Pavel Dovgalyuk
2021-05-25  6:40 ` Pavel Dovgalyuk
2021-05-25 23:11 ` Richard Henderson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.