ia64/xen-unstable

changeset 15411:2a7339251e4d

libxc: Add xc_domain_setdebugging in xenctrl API

Use it in xc_ptrace.c

Signed-off-by: Tristan Gingold <tgingold@free.fr>
Acked-by: Keir Fraser <keir@xensource.com>
author Alex Williamson <alex.williamson@hp.com>
date Tue Jun 26 16:18:28 2007 -0600 (2007-06-26)
parents 8a6a6d4afcb3
children 1fd90169f268
files tools/libxc/xc_domain.c tools/libxc/xc_ptrace.c tools/libxc/xenctrl.h
line diff
     1.1 --- a/tools/libxc/xc_domain.c	Fri Jun 22 11:48:49 2007 -0600
     1.2 +++ b/tools/libxc/xc_domain.c	Tue Jun 26 16:18:28 2007 -0600
     1.3 @@ -696,6 +696,18 @@ int xc_get_hvm_param(int handle, domid_t
     1.4      return rc;
     1.5  }
     1.6  
     1.7 +int xc_domain_setdebugging(int xc_handle,
     1.8 +                           uint32_t domid,
     1.9 +                           unsigned int enable)
    1.10 +{
    1.11 +    DECLARE_DOMCTL;
    1.12 +
    1.13 +    domctl.cmd = XEN_DOMCTL_setdebugging;
    1.14 +    domctl.domain = domid;
    1.15 +    domctl.u.setdebugging.enable = enable;
    1.16 +    return do_domctl(xc_handle, &domctl);
    1.17 +}
    1.18 +
    1.19  /*
    1.20   * Local variables:
    1.21   * mode: C
     2.1 --- a/tools/libxc/xc_ptrace.c	Fri Jun 22 11:48:49 2007 -0600
     2.2 +++ b/tools/libxc/xc_ptrace.c	Tue Jun 26 16:18:28 2007 -0600
     2.3 @@ -566,10 +566,7 @@ xc_ptrace(
     2.4          }
     2.5          if ( request == PTRACE_DETACH )
     2.6          {
     2.7 -            domctl.cmd = XEN_DOMCTL_setdebugging;
     2.8 -            domctl.domain = current_domid;
     2.9 -            domctl.u.setdebugging.enable = 0;
    2.10 -            if ((retval = do_domctl(xc_handle, &domctl)))
    2.11 +            if ((retval = xc_domain_setdebugging(xc_handle, current_domid, 0)))
    2.12                  goto out_error_domctl;
    2.13          }
    2.14          regs_valid = 0;
    2.15 @@ -593,10 +590,7 @@ xc_ptrace(
    2.16          else if ((retval = xc_domain_pause(xc_handle, current_domid)))
    2.17              goto out_error_domctl;
    2.18          current_is_hvm = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_hvm_guest);
    2.19 -        domctl.cmd = XEN_DOMCTL_setdebugging;
    2.20 -        domctl.domain = current_domid;
    2.21 -        domctl.u.setdebugging.enable = 1;
    2.22 -        if ((retval = do_domctl(xc_handle, &domctl)))
    2.23 +        if ((retval = xc_domain_setdebugging(xc_handle, current_domid, 1)))
    2.24              goto out_error_domctl;
    2.25  
    2.26          if (get_online_cpumap(xc_handle, &domctl.u.getdomaininfo, &cpumap))
     3.1 --- a/tools/libxc/xenctrl.h	Fri Jun 22 11:48:49 2007 -0600
     3.2 +++ b/tools/libxc/xenctrl.h	Tue Jun 26 16:18:28 2007 -0600
     3.3 @@ -433,6 +433,18 @@ int xc_domain_send_trigger(int xc_handle
     3.4                             uint32_t trigger,
     3.5                             uint32_t vcpu);
     3.6  
     3.7 +/**
     3.8 + * This function enables or disable debugging of a domain.
     3.9 + *
    3.10 + * @parm xc_handle a handle to an open hypervisor interface
    3.11 + * @parm domid the domain id to send trigger
    3.12 + * @parm enable true to enable debugging
    3.13 + * return 0 on success, -1 on failure
    3.14 + */
    3.15 +int xc_domain_setdebugging(int xc_handle,
    3.16 +                           uint32_t domid,
    3.17 +                           unsigned int enable);
    3.18 +
    3.19  /*
    3.20   * EVENT CHANNEL FUNCTIONS
    3.21   */