[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 4/5] Report exact PC on watchpoint hit
From: |
Jan Kiszka |
Subject: |
[Qemu-devel] [PATCH 4/5] Report exact PC on watchpoint hit |
Date: |
Sat, 31 May 2008 15:26:00 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 |
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 <address@hidden>
---
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;
}