aboutsummaryrefslogtreecommitdiff
path: root/cpu-exec.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-03-21 17:42:20 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2011-03-21 17:42:20 -0500
commit31b7c261a207e1e670d737ec78a87dd031bd8f73 (patch)
treeef070dd56c118c8761df7baf0a457fc2c5ff9dfa /cpu-exec.c
parent8b06c62ae48b67b320f7420dcd4854c5559e1532 (diff)
parentdc7a09cfe47679d89289101cc9eb387c45e48fe7 (diff)
Merge remote branch 'qemu-kvm/uq/master' into staging
Diffstat (limited to 'cpu-exec.c')
-rw-r--r--cpu-exec.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/cpu-exec.c b/cpu-exec.c
index 34eaedca04..5cc937904a 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -196,6 +196,30 @@ 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;
+
+ if (!env->watchpoint_hit) {
+ QTAILQ_FOREACH(wp, &env->watchpoints, entry) {
+ wp->flags &= ~BP_WATCHPOINT_HIT;
+ }
+ }
+ if (debug_excp_handler) {
+ debug_excp_handler(env);
+ }
+}
+
/* main execution loop */
volatile sig_atomic_t exit_request;
@@ -269,6 +293,9 @@ int cpu_exec(CPUState *env1)
if (env->exception_index >= EXCP_INTERRUPT) {
/* exit request from the cpu execution loop */
ret = env->exception_index;
+ if (ret == EXCP_DEBUG) {
+ cpu_handle_debug_exception(env);
+ }
break;
} else {
#if defined(CONFIG_USER_ONLY)