From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K2RTy-0006OI-0B for qemu-devel@nongnu.org; Sat, 31 May 2008 09:50:54 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K2RTw-0006Nc-Ux for qemu-devel@nongnu.org; Sat, 31 May 2008 09:50:53 -0400 Received: from [199.232.76.173] (port=55175 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K2RTw-0006NX-OO for qemu-devel@nongnu.org; Sat, 31 May 2008 09:50:52 -0400 Received: from fmmailgate02.web.de ([217.72.192.227]:37102) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K2RTw-00069B-33 for qemu-devel@nongnu.org; Sat, 31 May 2008 09:50:52 -0400 Received: from smtp07.web.de (fmsmtp07.dlan.cinetic.de [172.20.5.215]) by fmmailgate02.web.de (Postfix) with ESMTP id 9CF4ADF5CC11 for ; Sat, 31 May 2008 15:50:51 +0200 (CEST) Received: from [88.65.47.172] (helo=[192.168.1.198]) by smtp07.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.109 #226) id 1K2RTv-0003HH-00 for qemu-devel@nongnu.org; Sat, 31 May 2008 15:50:51 +0200 Resent-To: qemu-devel@nongnu.org Resent-Message-Id: <484157BB.3030006@web.de> Message-ID: <484151E8.6050806@web.de> Date: Sat, 31 May 2008 15:26:00 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <48414AC8.7080206@web.de> In-Reply-To: <48414AC8.7080206@web.de> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Sender: jan.kiszka@web.de Subject: [Qemu-devel] [PATCH 4/5] Report exact PC on watchpoint hit 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 Watchpoints may hit us right in the middle of a TB, but so far we complete the TB before servicing the breakpoint trap. This patch picks up the preexisting feature of QEMU to leave a TB immediately if the underlying memory page changes. The result is that the exact instruction pointer is reported back to gdb. This improves the usefulness of watchpoints significantly! Signed-off-by: Jan Kiszka --- exec.c | 6 ++++++ 1 file changed, 6 insertions(+) Index: b/exec.c =================================================================== --- a/exec.c +++ b/exec.c @@ -2382,6 +2382,7 @@ static target_ulong check_watchpoint(tar int len, int type) { CPUState *env = cpu_single_env; + target_phys_addr_t tb_addr; target_ulong watch; target_ulong retaddr; int i; @@ -2395,6 +2396,11 @@ static target_ulong check_watchpoint(tar (env->watchpoint[i].type == type || env->watchpoint[i].type == GDB_WATCHPOINT_ACCESS)) { env->watchpoint_hit = i + 1; + if (env->current_tb) { + tb_addr = env->current_tb->page_addr[0]; + tb_invalidate_phys_page_range(tb_addr, + tb_addr+TARGET_PAGE_SIZE-1, 1); + } cpu_interrupt(env, CPU_INTERRUPT_DEBUG); break; }