[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 11/13] Add debug exception hook
From: |
Jan Kiszka |
Subject: |
[Qemu-devel] [PATCH 11/13] Add debug exception hook |
Date: |
Tue, 14 Oct 2008 11:12:34 +0200 |
User-agent: |
quilt/0.46_cvs20080326-19.1 |
This patch allows to hook into the delivery of EXCP_DEBUG so that other
use beyond guest debugging becomes possible.
Signed-off-by: Jan Kiszka <address@hidden>
---
cpu-exec.c | 13 +++++++++++++
exec-all.h | 4 ++++
2 files changed, 17 insertions(+)
Index: b/cpu-exec.c
===================================================================
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -236,6 +236,16 @@ static inline TranslationBlock *tb_find_
return tb;
}
+static CPUDebugExcpHandler *debug_excp_handler;
+
+CPUDebugExcpHandler *cpu_set_debug_excp_handler(CPUDebugExcpHandler *handler)
+{
+ CPUDebugExcpHandler *old_handler = debug_excp_handler;
+
+ debug_excp_handler = handler;
+ return old_handler;
+}
+
static void cpu_handle_debug_exception(CPUState *env)
{
CPUWatchpoint *wp;
@@ -243,6 +253,9 @@ static void cpu_handle_debug_exception(C
if (!env->watchpoint_hit)
for (wp = env->watchpoints; wp != NULL; wp = wp->next)
wp->flags &= ~BP_WATCHPOINT_HIT;
+
+ if (debug_excp_handler)
+ debug_excp_handler(env);
}
/* main execution loop */
Index: b/exec-all.h
===================================================================
--- a/exec-all.h
+++ b/exec-all.h
@@ -385,3 +385,7 @@ static inline int kqemu_is_ok(CPUState *
}
#endif
+
+typedef void (CPUDebugExcpHandler)(CPUState *env);
+
+CPUDebugExcpHandler *cpu_set_debug_excp_handler(CPUDebugExcpHandler *handler);
- [Qemu-devel] [PATCH 12/13] Introduce BP_CPU as a breakpoint type, (continued)
- [Qemu-devel] [PATCH 13/13] x86: Debug register emulation, Jan Kiszka, 2008/10/14
- [Qemu-devel] [PATCH 08/13] Remove premature memop TB terminations, Jan Kiszka, 2008/10/14
- [Qemu-devel] [PATCH 07/13] Restore pc on watchpoint hits, Jan Kiszka, 2008/10/14
- [Qemu-devel] [PATCH 11/13] Add debug exception hook,
Jan Kiszka <=
- [Qemu-devel] [PATCH 09/13] qemu: gdbstub: manage CPUs as threads, Jan Kiszka, 2008/10/14
- [Qemu-devel] [PATCH 04/13] Respect length of watchpoints, Jan Kiszka, 2008/10/14