[5745] Add debug exception hook (Jan Kiszka)
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 <[email protected]>
Signed-off-by Anthony Liguori <[email protected]>
Modified Paths:
--------------
trunk/cpu-exec.c
trunk/exec-all.h
Modified: trunk/cpu-exec.c
===================================================================
cpu-exec.c +13 -0
@@ -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
===================================================================
exec-all.h +4 -0
@@ -387,4 +387,8 @@ }#endif + +typedef void (CPUDebugExcpHandler )(CPUState *env); + +CPUDebugExcpHandler *cpu_set_debug_excp_handler (CPUDebugExcpHandler *handler);#endif