From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LN5ec-0005MI-0k for qemu-devel@nongnu.org; Wed, 14 Jan 2009 08:19:30 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LN5eZ-0005Ld-At for qemu-devel@nongnu.org; Wed, 14 Jan 2009 08:19:28 -0500 Received: from [199.232.76.173] (port=38180 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LN5eX-0005LT-Ic for qemu-devel@nongnu.org; Wed, 14 Jan 2009 08:19:26 -0500 Received: from fmmailgate02.web.de ([217.72.192.227]:54561) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LN5eX-0006it-3h for qemu-devel@nongnu.org; Wed, 14 Jan 2009 08:19:25 -0500 Received: from smtp07.web.de (fmsmtp07.dlan.cinetic.de [172.20.5.215]) by fmmailgate02.web.de (Postfix) with ESMTP id 07F7DF8D4711 for ; Wed, 14 Jan 2009 14:19:23 +0100 (CET) Received: from [88.64.30.173] (helo=[139.25.109.167]) by smtp07.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #273) id 1LN5eU-0006Ou-00 for qemu-devel@nongnu.org; Wed, 14 Jan 2009 14:19:22 +0100 Message-ID: <496DE65A.9050609@web.de> Date: Wed, 14 Jan 2009 14:19:22 +0100 From: Jan Kiszka MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Sender: jan.kiszka@web.de Subject: [Qemu-devel] [RESEND][PATCH] Adopt cpu_copy to new breakpoint API Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 --- 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; }