qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v5 11/18] Add debug exception hook


From: Jan Kiszka
Subject: [Qemu-devel] [PATCH v5 11/18] Add debug exception hook
Date: Mon, 17 Nov 2008 17:18:59 +0100
User-agent: StGIT/0.14.2

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(+), 0 deletions(-)

diff --git a/cpu-exec.c b/cpu-exec.c
index 191d9e4..8d86527 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -183,6 +183,16 @@ static inline TranslationBlock *tb_find_fast(void)
     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;
@@ -190,6 +200,9 @@ static void cpu_handle_debug_exception(CPUState *env)
     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 */
diff --git a/exec-all.h b/exec-all.h
index e3da98a..aec318b 100644
--- a/exec-all.h
+++ b/exec-all.h
@@ -387,4 +387,8 @@ static inline int kqemu_is_ok(CPUState *env)
 }
 
 #endif
+
+typedef void (CPUDebugExcpHandler)(CPUState *env);
+
+CPUDebugExcpHandler *cpu_set_debug_excp_handler(CPUDebugExcpHandler *handler);
 #endif





reply via email to

[Prev in Thread] Current Thread [Next in Thread]