From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LNYe8-00082S-Dh for qemu-devel@nongnu.org; Thu, 15 Jan 2009 15:16:56 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LNYe7-00081a-HM for qemu-devel@nongnu.org; Thu, 15 Jan 2009 15:16:55 -0500 Received: from [199.232.76.173] (port=45561 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LNYe7-00081E-2v for qemu-devel@nongnu.org; Thu, 15 Jan 2009 15:16:55 -0500 Received: from savannah.gnu.org ([199.232.41.3]:40728 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LNYe6-0002Uq-Rm for qemu-devel@nongnu.org; Thu, 15 Jan 2009 15:16:54 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1LNYe5-0002nE-8A for qemu-devel@nongnu.org; Thu, 15 Jan 2009 20:16:53 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1LNYe4-0002nA-Qu for qemu-devel@nongnu.org; Thu, 15 Jan 2009 20:16:52 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Thu, 15 Jan 2009 20:16:52 +0000 Subject: [Qemu-devel] [6321] Adopt cpu_copy to new breakpoint API (Jan Kaszka) 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 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 Signed-off-by: Anthony Liguori 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; }