From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: Check if gdbsx is running Date: Mon, 4 Jan 2016 11:33:23 +0000 Message-ID: <1451907203.13361.35.camel@citrix.com> References: <567F24FE.8070309@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <567F24FE.8070309@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper , Carl Patenaude Poulin , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Sat, 2015-12-26 at 23:38 +0000, Andrew Cooper wrote: > On 26/12/2015 23:27, Carl Patenaude Poulin wrote: > > Hi all, > > > > I'm writing some development tools for my team. Given a domain ID, > > is there a way to programmatically check whether gdbsx is running on > > that domain and what port it's running on? I could use something > > like `top -b -n 1 | grep gdbsx` but that seems very brittle. > With a XEN_DOMCTL_getdomaininfo hypercall, "flags & XEN_DOMINF_debugged" > (or xc_dominfo_t.debugged) will tell you whether a debugger is attached > to a domain. > > This is the closest I am aware of you being able to get. > > Whether gdbsx is running, or what port it is running on, are internal > details to the domain running the debugger and not interesting to Xen. > > If you can assume that all debuggers are run in dom0, then some process > list based approach is probably best. Or patching gdbsx to leave a dropping (akin to a pid file) pointing to the correct port for a named domain (e.g. /var/run/gdbsx.$domid.port or something in xenstore maybe?). Or even make it able to use a named pipe or Unix domain socket instead of a port (assuming the gdb client supports the same). Ian.