# HG changeset patch
# User Alex Williamson <alex.williamson@xxxxxx>
# Date 1182896308 21600
# Node ID 2a7339251e4db9fda18c249651d958d651906a69
# Parent 8a6a6d4afcb31c24ee87a5d30bebec41e8d38126
libxc: Add xc_domain_setdebugging in xenctrl API
Use it in xc_ptrace.c
Signed-off-by: Tristan Gingold <tgingold@xxxxxxx>
Acked-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
tools/libxc/xc_domain.c | 12 ++++++++++++
tools/libxc/xc_ptrace.c | 10 ++--------
tools/libxc/xenctrl.h | 12 ++++++++++++
3 files changed, 26 insertions(+), 8 deletions(-)
diff -r 8a6a6d4afcb3 -r 2a7339251e4d tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c Fri Jun 22 11:48:49 2007 -0600
+++ b/tools/libxc/xc_domain.c Tue Jun 26 16:18:28 2007 -0600
@@ -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
diff -r 8a6a6d4afcb3 -r 2a7339251e4d tools/libxc/xc_ptrace.c
--- a/tools/libxc/xc_ptrace.c Fri Jun 22 11:48:49 2007 -0600
+++ b/tools/libxc/xc_ptrace.c Tue Jun 26 16:18:28 2007 -0600
@@ -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))
diff -r 8a6a6d4afcb3 -r 2a7339251e4d tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h Fri Jun 22 11:48:49 2007 -0600
+++ b/tools/libxc/xenctrl.h Tue Jun 26 16:18:28 2007 -0600
@@ -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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|