QTAILQ_INIT was called on the source cpu's breakpoints and watchpoints
lists, destroying them before the QTAILQ_FOREACH loops could iterate
them. Fix to initialize new_cpu's lists instead, matching linux-user.

Signed-off-by: Warner Losh <[email protected]>
---
 bsd-user/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bsd-user/main.c b/bsd-user/main.c
index a79ee52cc1..3c150b54cd 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -245,7 +245,7 @@ CPUArchState *cpu_copy(CPUArchState *env)
      * Note: Once we support ptrace with hw-debug register access, make sure
      * BP_CPU break/watchpoints are handled correctly on clone.
      */
-    QTAILQ_INIT(&cpu->breakpoints);
+    QTAILQ_INIT(&new_cpu->breakpoints);
     QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) {
         cpu_breakpoint_insert(new_cpu, bp->pc, bp->flags, NULL);
     }

-- 
2.52.0


Reply via email to