From mboxrd@z Thu Jan 1 00:00:00 1970 From: Don Slutz Subject: Re: [PATCH] Add xentrace/xen_crash. Date: Tue, 15 Oct 2013 11:25:13 -0400 Message-ID: <525D5E59.8030102@terremark.com> References: <1381759647-29797-1-git-send-email-dslutz@verizon.com> <1381763583.24708.124.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1381763583.24708.124.camel@kazak.uk.xensource.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: Ian Campbell Cc: Stefano Stabellini , George Dunlap , Don Slutz , Ian Jackson , Don Slutz , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 10/14/13 11:13, Ian Campbell wrote: > 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. Sure. >> 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) Sure. >> 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? Ah, this needs to be changed. Something I was planning to do but forgot about it. >> + >> +#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. Will change. > 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). So far I have not found a specification. Will keep looking. I had assumed it was, will work with the crash tools person to see. > If it's not intended to be consumed like this perhaps the tool would be > better off living in the crash source base? Maybe. Since this has code that needs the XEN headers and crash is currently one program with extension modules, it does not fit as well there. > Ian. > -Don Slutz