Skip to contentSkip to conversation

PATCH: add xc_domain_setdebugging in xenctrl API

PATCH Applied Tristan Gingold 3 participants 3 messages Jun 23, 2007 – Jul 2, 2007

lore
Share & tools
lore
#0 lore raw

Hi,

for ia64, I'd like to add xc_domain_setdebugging() in the xenctrl API. This patch implements it and modifies xc_ptrace.c to use it.

The rationnal is enabling debugging tool not based on the ptrace API. The ptrace API is based on Linux ptrace which (at least on ia64) doesn't have many privilegied registers.

I'd prefer this patch being integrated on xen-ia64-unstable tree but we need the OK from non-ia64 maintainers.

Tristan.

# HG changeset patch
# User Tristan Gingold <[email protected]> # Date 1182617932 -7200
# Node ID 675ccf45dc630166ad374023e119a68c48918088 # Parent 8a6a6d4afcb31c24ee87a5d30bebec41e8d38126 Add xc_domain_setdebugging in the xenctrl API. Use it in xc_ptrace.c

tools/libxc/xc_domain.c +12 -0
diff -r 8a6a6d4afcb3 -r 675ccf45dc63 tools/libxc/xc_domain.c
@@ -696,6 +696,18 @@ int xc_get_hvm_param(int handle, domid_t
     return rc;
 }
 
+int xc_domain_setdebugging(int xc_handle,
+                           uint32_t domid,
+                           unsigned int enable)
+{
+    DECLARE_DOMCTL;
+
+    domctl.cmd = XEN_DOMCTL_setdebugging;
+    domctl.domain = domid;
+    domctl.u.setdebugging.enable = enable;
+    return do_domctl(xc_handle, &domctl);
+}
+
 /*
  * Local variables:
  * mode: C
tools/libxc/xc_ptrace.c +2 -8
diff -r 8a6a6d4afcb3 -r 675ccf45dc63 tools/libxc/xc_ptrace.c
@@ -566,10 +566,7 @@ xc_ptrace(
         }
         if ( request == PTRACE_DETACH )
         {
-            domctl.cmd = XEN_DOMCTL_setdebugging;
-            domctl.domain = current_domid;
-            domctl.u.setdebugging.enable = 0;
-            if ((retval = do_domctl(xc_handle, &domctl)))
+            if ((retval = xc_domain_setdebugging(xc_handle, current_domid, 0)))
                 goto out_error_domctl;
         }
         regs_valid = 0;
@@ -593,10 +590,7 @@ xc_ptrace(
         else if ((retval = xc_domain_pause(xc_handle, current_domid)))
             goto out_error_domctl;
         current_is_hvm = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_hvm_guest);
-        domctl.cmd = XEN_DOMCTL_setdebugging;
-        domctl.domain = current_domid;
-        domctl.u.setdebugging.enable = 1;
-        if ((retval = do_domctl(xc_handle, &domctl)))
+        if ((retval = xc_domain_setdebugging(xc_handle, current_domid, 1)))
             goto out_error_domctl;
 
         if (get_online_cpumap(xc_handle, &domctl.u.getdomaininfo, &cpumap))
tools/libxc/xenctrl.h +12 -0
diff -r 8a6a6d4afcb3 -r 675ccf45dc63 tools/libxc/xenctrl.h
@@ -433,6 +433,18 @@ int xc_domain_send_trigger(int xc_handle
                            uint32_t trigger,
                            uint32_t vcpu);
 
+/**
+ * This function enables or disable debugging of a domain.
+ *
+ * @parm xc_handle a handle to an open hypervisor interface
+ * @parm domid the domain id to send trigger
+ * @parm enable true to enable debugging
+ * return 0 on success, -1 on failure
+ */
+int xc_domain_setdebugging(int xc_handle,
+                           uint32_t domid,
+                           unsigned int enable);
+
 /*
  * EVENT CHANNEL FUNCTIONS
  */

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

I don't understand your rationale, but I guess this is okay anyway.

-- Keir

Quoted 17 lines · Tristan Gingold

Hi,

for ia64, I'd like to add xc_domain_setdebugging() in the xenctrl API. This patch implements it and modifies xc_ptrace.c to use it.

The rationnal is enabling debugging tool not based on the ptrace API. The ptrace API is based on Linux ptrace which (at least on ia64) doesn't have many privilegied registers.

I'd prefer this patch being integrated on xen-ia64-unstable tree but we need the OK from non-ia64 maintainers.

Tristan.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw
In reply to Tristan Gingold
Quoted 11 lines · Tristan Gingold

Hi,

for ia64, I'd like to add xc_domain_setdebugging() in the xenctrl API. This patch implements it and modifies xc_ptrace.c to use it.

The rationnal is enabling debugging tool not based on the ptrace API. The ptrace API is based on Linux ptrace which (at least on ia64) doesn't have many privilegied registers.

I'd prefer this patch being integrated on xen-ia64-unstable tree but we need the OK from non-ia64 maintainers.

Applied. Thanks,

Alex

Signature · 1 line
Alex Williamson                             HP Open Source & Linux Org.