qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [6321] Adopt cpu_copy to new breakpoint API (Jan Kaszka)
@ 2009-01-15 20:16 Anthony Liguori
  0 siblings, 0 replies; only message in thread
From: Anthony Liguori @ 2009-01-15 20:16 UTC (permalink / raw)
  To: qemu-devel

Revision: 6321
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6321
Author:   aliguori
Date:     2009-01-15 20:16:51 +0000 (Thu, 15 Jan 2009)

Log Message:
-----------
Adopt cpu_copy to new breakpoint API (Jan Kaszka)

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>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

Modified Paths:
--------------
    trunk/exec.c

Modified: trunk/exec.c
===================================================================
--- trunk/exec.c	2009-01-15 20:11:34 UTC (rev 6320)
+++ trunk/exec.c	2009-01-15 20:16:51 UTC (rev 6321)
@@ -1654,12 +1654,34 @@
 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] only message in thread

only message in thread, other threads:[~2009-01-15 20:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-15 20:16 [Qemu-devel] [6321] Adopt cpu_copy to new breakpoint API (Jan Kaszka) 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).