All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 4/5] Report exact PC on watchpoint hit
Date: Sat, 31 May 2008 15:26:00 +0200	[thread overview]
Message-ID: <484151E8.6050806@web.de> (raw)
In-Reply-To: <48414AC8.7080206@web.de>

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 <jan.kiszka@web.de>
---
 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;
             }

  parent reply	other threads:[~2008-05-31 13:50 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-31 12:55 [Qemu-devel] [PATCH 0/5] Debugger enhancements Jan Kiszka
2008-05-31 13:15 ` [Qemu-devel] [PATCH 3/5] Add read watchpoint support Jan Kiszka
2008-05-31 13:15 ` [Qemu-devel] [PATCH 2/5] Watchpoint length and type awareness Jan Kiszka
2008-05-31 13:26 ` Jan Kiszka [this message]
2008-05-31 14:11   ` [Qemu-devel] [PATCH 4/5] Report exact PC on watchpoint hit Paul Brook
2008-05-31 14:42     ` Jan Kiszka
2008-05-31 15:17       ` Paul Brook
2008-05-31 13:44 ` [Qemu-devel] [PATCH 5/5] Enhance SMP guest debugging Jan Kiszka
2008-05-31 13:49 ` [Qemu-devel] [PATCH 1/5] Refactor breakpoint API and gdbstub integration Jan Kiszka
2008-05-31 16:50 ` [Qemu-devel] [PATCH 0/5] Debugger enhancements Fabrice Bellard
2008-05-31 17:05   ` Paul Brook
2008-05-31 17:29     ` [Qemu-devel] " Jan Kiszka
2008-05-31 18:33     ` [Qemu-devel] " Fabrice Bellard
2008-06-01 13:54       ` [Qemu-devel] " Jan Kiszka
2008-06-01 12:38     ` [Qemu-devel] " Jamie Lokier
2008-06-01 13:56       ` [Qemu-devel] " Jan Kiszka
2008-05-31 17:20   ` Jan Kiszka
2008-05-31 18:42     ` Fabrice Bellard
2008-06-01  0:06       ` Paul Brook
2008-06-01 13:53       ` Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=484151E8.6050806@web.de \
    --to=jan.kiszka@web.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.