From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L2XX1-0005Xi-LQ for qemu-devel@nongnu.org; Tue, 18 Nov 2008 15:50:43 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L2XWz-0005X3-OR for qemu-devel@nongnu.org; Tue, 18 Nov 2008 15:50:42 -0500 Received: from [199.232.76.173] (port=55713 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L2XWz-0005Wt-IE for qemu-devel@nongnu.org; Tue, 18 Nov 2008 15:50:41 -0500 Received: from savannah.gnu.org ([199.232.41.3]:34488 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L2XWz-0001sB-HN for qemu-devel@nongnu.org; Tue, 18 Nov 2008 15:50:41 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1L2XWw-0001Ns-HA for qemu-devel@nongnu.org; Tue, 18 Nov 2008 20:50:38 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1L2XWw-0001No-CQ for qemu-devel@nongnu.org; Tue, 18 Nov 2008 20:50:38 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Tue, 18 Nov 2008 20:50:38 +0000 Subject: [Qemu-devel] [5745] Add debug exception hook (Jan Kiszka) Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 Signed-off-by: Anthony Liguori 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