qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [5745] Add debug exception hook (Jan Kiszka)
Date: Tue, 18 Nov 2008 20:50:38 +0000	[thread overview]
Message-ID: <E1L2XWw-0001No-CQ@cvs.savannah.gnu.org> (raw)

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 <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

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	other threads:[~2008-11-18 20:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1L2XWw-0001No-CQ@cvs.savannah.gnu.org \
    --to=anthony@codemonkey.ws \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).