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

[Xen-devel] FW: [Xen-changelog] Enable the setting and trapping of breakpoints forhvm guest.



We can set breakpoints inside a vmx domain now !

Thanks & Regards,
Nitin
------------------------------------------------------------------------
-----------
Open Source Technology Center, Intel Corp

-----Original Message-----
From: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
[mailto:xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of Xen
patchbot -unstable
Sent: Friday, March 31, 2006 3:22 AM
To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Enable the setting and trapping of breakpoints
forhvm guest.

# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID e08dcff87bb298a34e8358fab7cbaa24d21dbf82
# Parent  4943372c14f6bc52e365f293c8460f087d47e471
Enable the setting and trapping of breakpoints for hvm guest.
Catch Ctrl-C for gdbserver and let gdb break from continue command.

Signed-Off-By: Nitin A Kamble <nitin.a.kamble@xxxxxxxxx>

diff -r 4943372c14f6 -r e08dcff87bb2
tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/server.c
--- a/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/server.c
Fri Mar 31 09:06:20 2006
+++ b/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/server.c
Fri Mar 31 09:07:55 2006
@@ -287,6 +287,21 @@
 }
 
 void
+handle_breakpoint_requests (char *own_buf, char *status, unsigned char
*signal)
+{
+  /*  Currently we only support software breakpoints */
+    switch (own_buf[1]) {
+        case '0': /* software breakpoint, int3 based */
+             own_buf[0] = '\0';
+            break;
+        case '1': /* hardware breakpoint */
+        default:
+                 write_enn (own_buf);
+            break;
+    }
+}
+
+void
 myresume (int step, int sig)
 {
   struct thread_resume resume_info[2];
@@ -321,6 +336,18 @@
         "COMM may either be a tty device (for serial debugging), or \n"
         "HOST:PORT to listen for a TCP connection.\n");
 }
+
+extern control_c_pressed_flag;
+#include <signal.h>
+
+void ctrl_c_handler(int signo)
+{
+    printf("Ctrl-C pressed: Quit from the attached gdb first\n");
+    control_c_pressed_flag = 1;
+}
+
+struct sigaction ctrl_c_sigaction = { .sa_handler = ctrl_c_handler };
+struct sigaction old_sigaction;
 
 int
 main (int argc, char *argv[])
@@ -396,9 +423,11 @@
        }
     }
 
+
   while (1)
     {
       remote_open (argv[1]);
+      sigaction(SIGINT, &ctrl_c_sigaction, &old_sigaction);
 
     restart:
       setjmp (toplevel);
@@ -586,6 +615,9 @@
            case 'v':
              /* Extended (long) request.  */
              handle_v_requests (own_buf, &status, &signal);
+             break;
+           case 'Z':
+             handle_breakpoint_requests (own_buf, &status, &signal);
              break;
            default:
              /* It is a request we don't understand.  Respond with an
@@ -643,5 +675,6 @@
                           "GDBserver will reopen the connection.\n");
          remote_close ();
        }
-    }
-}
+    sigaction(SIGINT, &old_sigaction, NULL);
+    }
+}
diff -r 4943372c14f6 -r e08dcff87bb2 tools/libxc/xc_ptrace.c
--- a/tools/libxc/xc_ptrace.c   Fri Mar 31 09:06:20 2006
+++ b/tools/libxc/xc_ptrace.c   Fri Mar 31 09:07:55 2006
@@ -401,6 +401,8 @@
     return map_domain_va_32(xc_handle, cpu, guest_va, perm);
 }
 
+int control_c_pressed_flag = 0;
+
 static int 
 __xc_waitdomain(
     int xc_handle,
@@ -419,7 +421,6 @@
     op.cmd = DOM0_GETDOMAININFO;
     op.u.getdomaininfo.domain = domain;
     
-    
  retry:
     retval = do_dom0_op(xc_handle, &op);
     if ( retval || (op.u.getdomaininfo.domain != domain) )
@@ -432,12 +433,17 @@
     if ( options & WNOHANG )
         goto done;
 
+    if (control_c_pressed_flag) {
+        xc_domain_pause(xc_handle, domain);
+        control_c_pressed_flag = 0;
+        goto done;
+    }
+
     if ( !(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED) )
     {
         nanosleep(&ts,NULL);
         goto retry;
     }
-    /* XXX check for ^C here */
  done:
     if (get_online_cpumap(xc_handle, &op.u.getdomaininfo, &cpumap))
         printf("get_online_cpumap failed\n");
diff -r 4943372c14f6 -r e08dcff87bb2 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Fri Mar 31 09:06:20 2006
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Fri Mar 31 09:07:55 2006
@@ -2130,6 +2130,14 @@
 
             break;
         }
+        case TRAP_int3:
+        {
+            if ( test_bit(_DOMF_debugging, &v->domain->domain_flags) )
+                domain_pause_for_debugger();
+            else 
+                vmx_inject_exception(v, TRAP_int3,
VMX_DELIVER_NO_ERROR_CODE);
+            break;
+        }
 #endif
         case TRAP_no_device:
         {
diff -r 4943372c14f6 -r e08dcff87bb2 xen/include/asm-x86/hvm/support.h
--- a/xen/include/asm-x86/hvm/support.h Fri Mar 31 09:06:20 2006
+++ b/xen/include/asm-x86/hvm/support.h Fri Mar 31 09:07:55 2006
@@ -94,6 +94,7 @@
 #else
 #define MONITOR_DEFAULT_EXCEPTION_BITMAP        \
     ( EXCEPTION_BITMAP_PG |                     \
+      EXCEPTION_BITMAP_BP |                     \
       EXCEPTION_BITMAP_GP )
 #endif
 

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

_______________________________________________
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®.