[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] Add xentrace/xen_crash.

On 10/14/13 11:13, Ian Campbell wrote:
On Mon, 2013-10-14 at 10:07 -0400, Don Slutz wrote:
From: Don Slutz <Don@xxxxxxxxxxxxxxx>

This allows crash to connect to a domU. Usage:

usage: xen_crash <domid> [<optional port>]

   xen_crash 1&
   crash localhost:5001 

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

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 <ctype.h>
+#include <time.h>
+#include <stdlib.h>
+#include <sys/mman.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+#include <sys/stat.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+#include <signal.h>
+#include <string.h>
+#include <inttypes.h>
+#include <getopt.h>
+#include "xenctrl.h"
+#include <xen/foreign/x86_32.h>
+#include <xen/foreign/x86_64.h>
+#include <xen/hvm/save.h>
+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.

  -Don Slutz

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.