qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [5745] Add debug exception hook (Jan Kiszka)


From: Anthony Liguori
Subject: [Qemu-devel] [5745] Add debug exception hook (Jan Kiszka)
Date: Tue, 18 Nov 2008 20:50:38 +0000

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 <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>

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






reply via email to

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