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] Allow debugging of SVM guests with gdbserver-xen

To: "Keir Fraser" <Keir.Fraser@xxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] Allow debugging of SVM guests with gdbserver-xen
From: "Travis Betak" <travis.betak@xxxxxxx>
Date: Fri, 25 Aug 2006 15:26:28 -0500 (CDT)
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Fri, 25 Aug 2006 13:27:22 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Keir,

This patch provides (or at least provided) SVM similar functionality to
what VMX has by allowing source-level debugging of unmodified guests.

I did my development and testing against changeset 11131 and all worked
fine.  However, recent changesets have broken gdbserver-xen's memory
read/write interface with the guest --- at least with respect to SVM
guests.  I haven't examined the problem too closely yet, but I think
this is a side effect from the shadow2 merge.

Anyway, if acceptable, please apply to -unstable.  I'm going to look
at the libxc/ptrace code a little more closely to see if I can root
cause the problem.

  --travis


---


[HVM][SVM] Allow debugging of SVM guests with gdbserver-xen

Signed-off-by: Travis Betak <travis.betak@xxxxxxx>

diff -r bfb710d768eb -r 113730d1bfc5 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Fri Aug 25 11:57:57 2006 -0500
+++ b/xen/arch/x86/hvm/svm/svm.c        Fri Aug 25 11:58:10 2006 -0500
@@ -2705,19 +2705,48 @@ asmlinkage void svm_vmexit_handler(struc

     switch (exit_reason)
     {
+
+#ifdef XEN_DEBUGGER
+
     case VMEXIT_EXCEPTION_DB:
-    {
-#ifdef XEN_DEBUGGER
         svm_debug_save_cpu_user_regs(&regs);
         pdb_handle_exception(1, &regs, 1);
         svm_debug_restore_cpu_user_regs(&regs);
-#else
-        svm_store_cpu_user_regs(&regs, v);
- domain_pause_for_debugger(); -#endif
-    }
-    break;
-
+        break;
+
+    case VMEXIT_EXCEPTION_BP:
+        svm_debug_save_cpu_user_regs(&regs);
+        pdb_handle_exception(3, &regs, 1);
+        svm_debug_restore_cpu_user_regs(&regs);
+        break;
+
+#else /* XEN_DEBUGGER */
+
+    case VMEXIT_EXCEPTION_DB:
+
+        if (test_bit(_DOMF_debugging, &v->domain->domain_flags))
+        {
+            svm_store_cpu_user_regs(&regs, v);
+            domain_pause_for_debugger();
+        }
+        else
+        {
+            svm_inject_exception(v, TRAP_debug, 0, 0);
+        }
+
+        break;
+
+    case VMEXIT_EXCEPTION_BP:
+ + if (test_bit(_DOMF_debugging, &v->domain->domain_flags))
+            domain_pause_for_debugger();
+ else + svm_inject_exception(v, TRAP_int3, 0, 0);
+
+        break;
+
+#endif /* ! XEN_DEBUGGER */
+
     case VMEXIT_NMI:
         do_nmi(&regs, 0);
         break;
@@ -2735,19 +2764,6 @@ asmlinkage void svm_vmexit_handler(struc
         /*
          * Nothing to do, in fact we should never get to this point.
          */
-        break;
-
-    case VMEXIT_EXCEPTION_BP:
-#ifdef XEN_DEBUGGER
-        svm_debug_save_cpu_user_regs(&regs);
-        pdb_handle_exception(3, &regs, 1);
-        svm_debug_restore_cpu_user_regs(&regs);
-#else
-        if ( test_bit(_DOMF_debugging, &v->domain->domain_flags) )
-            domain_pause_for_debugger();
- else - svm_inject_exception(v, TRAP_int3, 0, 0);
-#endif
         break;

     case VMEXIT_EXCEPTION_NM:



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>