WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] vmx: fix single stepping on debugger

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] vmx: fix single stepping on debugger
From: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
Date: Tue, 11 Nov 2008 10:28:05 +0900
Delivery-date: Mon, 10 Nov 2008 17:28:35 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
The debuggee domain will die with unexpected trap
on single stepping of emulated instruction.

Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>

diff -r 5fd51e1e9c79 xen/arch/x86/hvm/vmx/realmode.c
--- a/xen/arch/x86/hvm/vmx/realmode.c   Wed Nov 05 10:57:21 2008 +0000
+++ b/xen/arch/x86/hvm/vmx/realmode.c   Tue Nov 11 09:45:52 2008 +0900
@@ -148,6 +148,14 @@ static void realmode_emulate_one(struct 
             hvmemul_ctxt->exn_insn_len = 0;
         }
 
+        if ( curr->domain->debugger_attached &&
+            ( hvmemul_ctxt->exn_vector == TRAP_debug ||
+              hvmemul_ctxt->exn_vector == TRAP_int3 ) )
+        {
+            domain_pause_for_debugger();
+            return;
+        }
+
         if ( curr->arch.hvm_vcpu.guest_cr[0] & X86_CR0_PE )
         {
             gdprintk(XENLOG_ERR, "Exception %02x in protected mode.\n",
diff -r 5fd51e1e9c79 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Wed Nov 05 10:57:21 2008 +0000
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Tue Nov 11 09:45:52 2008 +0900
@@ -1154,8 +1154,6 @@ static void vmx_inject_exception(
 {
     struct vcpu *curr = current;
 
-    vmx_inject_hw_exception(curr, trapnr, errcode);
-
     if ( trapnr == TRAP_page_fault )
         curr->arch.hvm_vcpu.guest_cr[2] = cr2;
 
@@ -1164,7 +1162,14 @@ static void vmx_inject_exception(
     {
         __restore_debug_registers(curr);
         write_debugreg(6, read_debugreg(6) | 0x4000);
+        if ( curr->domain->debugger_attached )
+        {
+            domain_pause_for_debugger();
+            return;
+        }
     }
+
+    vmx_inject_hw_exception(curr, trapnr, errcode);
 }
 
 static int vmx_event_pending(struct vcpu *v)
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] vmx: fix single stepping on debugger, Kouya Shimura <=