[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] Allow debugging of SVM guests with gdbserver-xen



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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.