qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [5745] Add debug exception hook (Jan Kiszka)
@ 2008-11-18 20:50 Anthony Liguori
  0 siblings, 0 replies; only message in thread
From: Anthony Liguori @ 2008-11-18 20:50 UTC (permalink / raw)
  To: qemu-devel

Revision: 5745
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5745
Author:   aliguori
Date:     2008-11-18 20:50:36 +0000 (Tue, 18 Nov 2008)

Log Message:
-----------
Add debug exception hook (Jan Kiszka)

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 <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

Modified Paths:
--------------
    trunk/cpu-exec.c
    trunk/exec-all.h

Modified: trunk/cpu-exec.c
===================================================================
--- trunk/cpu-exec.c	2008-11-18 20:37:55 UTC (rev 5744)
+++ trunk/cpu-exec.c	2008-11-18 20:50:36 UTC (rev 5745)
@@ -183,6 +183,16 @@
     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 @@
     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 */

Modified: trunk/exec-all.h
===================================================================
--- trunk/exec-all.h	2008-11-18 20:37:55 UTC (rev 5744)
+++ trunk/exec-all.h	2008-11-18 20:50:36 UTC (rev 5745)
@@ -387,4 +387,8 @@
 }
 
 #endif
+
+typedef void (CPUDebugExcpHandler)(CPUState *env);
+
+CPUDebugExcpHandler *cpu_set_debug_excp_handler(CPUDebugExcpHandler *handler);
 #endif

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-11-18 20:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-18 20:50 [Qemu-devel] [5745] Add debug exception hook (Jan Kiszka) Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).