From: Ian Campbell Subject: Re: [PATCH] Add xentrace/xen_crash. Date: Mon, 14 Oct 2013 16:13:03 +0100 Message-ID: <1381763583.24708.124.camel@kazak.uk.xensource.com> References: <1381759647-29797-1-git-send-email-dslutz@verizon.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1381759647-29797-1-git-send-email-dslutz@verizon.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: Don Slutz Cc: George Dunlap , Don Slutz , Stefano Stabellini , Ian Jackson , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Mon, 2013-10-14 at 10:07 -0400, Don Slutz wrote: > From: Don Slutz > > This allows crash to connect to a domU. Usage: > > usage: xen_crash [] > > xen_crash 1& > crash localhost:5001 /usr/lib/debug/lib/modules/3.8.11-100.fc17.x86_64/vmlinux > > The domU will be paused while crash is connected. Currently the code exits when crash disconnects. Could you supply some docs please, ideally a simple man page but a txt would do too. Under docs/ probably so they get published on xenbits etc. > diff --git a/tools/xentrace/Makefile b/tools/xentrace/Makefile > index 63b09c0..a2313c6 100644 > --- a/tools/xentrace/Makefile > +++ b/tools/xentrace/Makefile > @@ -7,7 +7,7 @@ CFLAGS += $(CFLAGS_libxenctrl) > LDLIBS += $(LDLIBS_libxenctrl) > > BIN = xentrace xentrace_setsize > -LIBBIN = xenctx > +LIBBIN = xenctx xen_crash It appears to be x86 specific, at least right now. So please do something like: LIBBIN-$(CONFIG_X86) += xen_crash ... LIBBIN += $(LIBBIN-y) > diff --git a/tools/xentrace/xen_crash.c b/tools/xentrace/xen_crash.c > new file mode 100644 > index 0000000..6a4bb34 > --- /dev/null > +++ b/tools/xentrace/xen_crash.c > @@ -0,0 +1,697 @@ > +/****************************************************************************** > + * tools/xentrace/xen_crash.c > + * > + * Connect crash to DOMu. > + * > + * Copyright (C) 2012 by Cloud Switch, Inc. > + * > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "xenctrl.h" > +#include > +#include > +#include > + > +xc_interface *xc_handle = 0; > +int domid = 0; > +int debug = 0; > + > +typedef unsigned long long guest_word_t; > +#define FMT_32B_WORD "%08llx" > +#define FMT_64B_WORD "%016llx" > + > +/* Word-length of the guest's own data structures */ > +int guest_word_size = sizeof (unsigned long); > +/* Word-length of the context record we get from xen */ > +int ctxt_word_size = sizeof (unsigned long); > +int guest_protected_mode = 1; > + > +#define MACHINE_TYPE "X86_64" This looks to be used regardless of the type of the guest? > + > +#define STRNEQ(A, B) (B && \ > + (strncmp((char *)(A), (char *)(B), strlen((char *)(B))) == 0)) > +#define FAILMSG "FAIL " > +#define DONEMSG "DONE " > +#define DATAMSG "DATA " > + > +#define DATA_HDRSIZE 13 /* strlen("XXXX ") + strlen("0131072") + NULL */ I think you could use the strlen calls, which should be statically evaluated directly and avoid the possibility of having miscounted. Is this some protocol defined by crash? Can you include a reference to their specification somewhere please. Is it intended for consumption externally to the crash tools -- i.e. is it a stable protocol? (it smells a bit ad-hoc is why I'm asking). If it's not intended to be consumed like this perhaps the tool would be better off living in the crash source base? Ian.