summaryrefslogtreecommitdiff
path: root/cpu-exec.c
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2008-11-18 20:50:36 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2008-11-18 20:50:36 +0000
commit2a5be1136a55008f6dcf1f29c3158c8c5524406e (patch)
treed447a347838067af681c4411892f632b80de78c5 /cpu-exec.c
parent6bbf2910c80d813fa60dc12bc55e08f44e9c479c (diff)
downloadqemu-2a5be1136a55008f6dcf1f29c3158c8c5524406e.tar.gz
qemu-2a5be1136a55008f6dcf1f29c3158c8c5524406e.tar.bz2
qemu-2a5be1136a55008f6dcf1f29c3158c8c5524406e.zip
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> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5745 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'cpu-exec.c')
-rw-r--r--cpu-exec.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/cpu-exec.c b/cpu-exec.c
index 191d9e4288..8d86527b80 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 */