qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [RESEND][PATCH] Adopt cpu_copy to new breakpoint API
@ 2009-01-14 13:19 Jan Kiszka
  2009-01-14 18:38 ` Lionel Landwerlin
  2009-01-15 20:16 ` Anthony Liguori
  0 siblings, 2 replies; 3+ messages in thread
From: Jan Kiszka @ 2009-01-14 13:19 UTC (permalink / raw)
  To: qemu-devel@nongnu.org

[ Also available via git://git.kiszka.org/qemu.git queue/gdb ]

Latest changes to the cpu_breakpoint/watchpoint API broke cpu_copy. This
patch fixes it by cloning the breakpoint and watchpoint lists
appropriately.

Thanks to Lionel Landwerlin for pointing out.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
---

 exec.c |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/exec.c b/exec.c
index e633b74..d6fa977 100644
--- a/exec.c
+++ b/exec.c
@@ -1654,12 +1654,34 @@ void cpu_abort(CPUState *env, const char *fmt, ...)
 CPUState *cpu_copy(CPUState *env)
 {
     CPUState *new_env = cpu_init(env->cpu_model_str);
-    /* preserve chaining and index */
     CPUState *next_cpu = new_env->next_cpu;
     int cpu_index = new_env->cpu_index;
+#if defined(TARGET_HAS_ICE)
+    CPUBreakpoint *bp;
+    CPUWatchpoint *wp;
+#endif
+
     memcpy(new_env, env, sizeof(CPUState));
+
+    /* Preserve chaining and index. */
     new_env->next_cpu = next_cpu;
     new_env->cpu_index = cpu_index;
+
+    /* Clone all break/watchpoints.
+       Note: Once we support ptrace with hw-debug register access, make sure
+       BP_CPU break/watchpoints are handled correctly on clone. */
+    TAILQ_INIT(&env->breakpoints);
+    TAILQ_INIT(&env->watchpoints);
+#if defined(TARGET_HAS_ICE)
+    TAILQ_FOREACH(bp, &env->breakpoints, entry) {
+        cpu_breakpoint_insert(new_env, bp->pc, bp->flags, NULL);
+    }
+    TAILQ_FOREACH(wp, &env->watchpoints, entry) {
+        cpu_watchpoint_insert(new_env, wp->vaddr, (~wp->len_mask) + 1,
+                              wp->flags, NULL);
+    }
+#endif
+
     return new_env;
 }
 

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

* Re: [Qemu-devel] [RESEND][PATCH] Adopt cpu_copy to new breakpoint API
  2009-01-14 13:19 [Qemu-devel] [RESEND][PATCH] Adopt cpu_copy to new breakpoint API Jan Kiszka
@ 2009-01-14 18:38 ` Lionel Landwerlin
  2009-01-15 20:16 ` Anthony Liguori
  1 sibling, 0 replies; 3+ messages in thread
From: Lionel Landwerlin @ 2009-01-14 18:38 UTC (permalink / raw)
  To: qemu-devel

Le mercredi 14 janvier 2009 à 14:19 +0100, Jan Kiszka a écrit :
> [ Also available via git://git.kiszka.org/qemu.git queue/gdb ]
> 
> Latest changes to the cpu_breakpoint/watchpoint API broke cpu_copy. This
> patch fixes it by cloning the breakpoint and watchpoint lists
> appropriately.
> 
> Thanks to Lionel Landwerlin for pointing out.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@web.de>

Thanks for resending

Acked-by: Lionel Landwerlin <lionel.landwerlin@openwide.fr


> ---
> 
>  exec.c |   24 +++++++++++++++++++++++-
>  1 files changed, 23 insertions(+), 1 deletions(-)
> 
> diff --git a/exec.c b/exec.c
> index e633b74..d6fa977 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -1654,12 +1654,34 @@ void cpu_abort(CPUState *env, const char *fmt, ...)
>  CPUState *cpu_copy(CPUState *env)
>  {
>      CPUState *new_env = cpu_init(env->cpu_model_str);
> -    /* preserve chaining and index */
>      CPUState *next_cpu = new_env->next_cpu;
>      int cpu_index = new_env->cpu_index;
> +#if defined(TARGET_HAS_ICE)
> +    CPUBreakpoint *bp;
> +    CPUWatchpoint *wp;
> +#endif
> +
>      memcpy(new_env, env, sizeof(CPUState));
> +
> +    /* Preserve chaining and index. */
>      new_env->next_cpu = next_cpu;
>      new_env->cpu_index = cpu_index;
> +
> +    /* Clone all break/watchpoints.
> +       Note: Once we support ptrace with hw-debug register access, make sure
> +       BP_CPU break/watchpoints are handled correctly on clone. */
> +    TAILQ_INIT(&env->breakpoints);
> +    TAILQ_INIT(&env->watchpoints);
> +#if defined(TARGET_HAS_ICE)
> +    TAILQ_FOREACH(bp, &env->breakpoints, entry) {
> +        cpu_breakpoint_insert(new_env, bp->pc, bp->flags, NULL);
> +    }
> +    TAILQ_FOREACH(wp, &env->watchpoints, entry) {
> +        cpu_watchpoint_insert(new_env, wp->vaddr, (~wp->len_mask) + 1,
> +                              wp->flags, NULL);
> +    }
> +#endif
> +
>      return new_env;
>  }
>  
> 
> 

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

* Re: [Qemu-devel] [RESEND][PATCH] Adopt cpu_copy to new breakpoint API
  2009-01-14 13:19 [Qemu-devel] [RESEND][PATCH] Adopt cpu_copy to new breakpoint API Jan Kiszka
  2009-01-14 18:38 ` Lionel Landwerlin
@ 2009-01-15 20:16 ` Anthony Liguori
  1 sibling, 0 replies; 3+ messages in thread
From: Anthony Liguori @ 2009-01-15 20:16 UTC (permalink / raw)
  To: qemu-devel

Jan Kiszka wrote:
> [ Also available via git://git.kiszka.org/qemu.git queue/gdb ]
>
> Latest changes to the cpu_breakpoint/watchpoint API broke cpu_copy. This
> patch fixes it by cloning the breakpoint and watchpoint lists
> appropriately.
>
> Thanks to Lionel Landwerlin for pointing out.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
>   

Applied.  Thanks.

Regards,

Anthony Liguori

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

end of thread, other threads:[~2009-01-15 20:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-14 13:19 [Qemu-devel] [RESEND][PATCH] Adopt cpu_copy to new breakpoint API Jan Kiszka
2009-01-14 18:38 ` Lionel Landwerlin
2009-01-15 20:16 ` Anthony Liguori

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 NNTP newsgroup(s).