Commit dde2367e209681cb606e137d15e10f976a6e2787

Authored by aliguori
1 parent 6e140f28

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
Showing 2 changed files with 17 additions and 0 deletions
cpu-exec.c
... ... @@ -183,6 +183,16 @@ static inline TranslationBlock *tb_find_fast(void)
183 183 return tb;
184 184 }
185 185  
  186 +static CPUDebugExcpHandler *debug_excp_handler;
  187 +
  188 +CPUDebugExcpHandler *cpu_set_debug_excp_handler(CPUDebugExcpHandler *handler)
  189 +{
  190 + CPUDebugExcpHandler *old_handler = debug_excp_handler;
  191 +
  192 + debug_excp_handler = handler;
  193 + return old_handler;
  194 +}
  195 +
186 196 static void cpu_handle_debug_exception(CPUState *env)
187 197 {
188 198 CPUWatchpoint *wp;
... ... @@ -190,6 +200,9 @@ static void cpu_handle_debug_exception(CPUState *env)
190 200 if (!env->watchpoint_hit)
191 201 for (wp = env->watchpoints; wp != NULL; wp = wp->next)
192 202 wp->flags &= ~BP_WATCHPOINT_HIT;
  203 +
  204 + if (debug_excp_handler)
  205 + debug_excp_handler(env);
193 206 }
194 207  
195 208 /* main execution loop */
... ...
exec-all.h
... ... @@ -387,4 +387,8 @@ static inline int kqemu_is_ok(CPUState *env)
387 387 }
388 388  
389 389 #endif
  390 +
  391 +typedef void (CPUDebugExcpHandler)(CPUState *env);
  392 +
  393 +CPUDebugExcpHandler *cpu_set_debug_excp_handler(CPUDebugExcpHandler *handler);
390 394 #endif
... ...