aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/gdbstub.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2007-12-12 11:27:15 +0000
committerKeir Fraser <keir.fraser@citrix.com>2007-12-12 11:27:15 +0000
commitbfeddb6751d4cdb7337170176c1cb55230a95b18 (patch)
tree548a80cacfb6f1c9fe64fbc3a42c9d3dcff7bca3 /xen/common/gdbstub.c
parent73f67c0d9a0a3dff0fe27e977706492316126a1e (diff)
downloadxen-bfeddb6751d4cdb7337170176c1cb55230a95b18.tar.gz
xen-bfeddb6751d4cdb7337170176c1cb55230a95b18.tar.bz2
xen-bfeddb6751d4cdb7337170176c1cb55230a95b18.zip
Fix gdb debugging of hypervisor.
This patch: * enables the gdbstubs to properly access hypervisor memory; * prevents an assertion failure in __spurious_page_fault's call to map_domain_page if such accesses fail, by testing in_irq(); * prints some additional helpful messages; * fixes the endianness of register transfers from the gdbstubs so that gdb is much less confused. * fixes the documentation in docs/misc/crashdb.txt Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'xen/common/gdbstub.c')
-rw-r--r--xen/common/gdbstub.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/xen/common/gdbstub.c b/xen/common/gdbstub.c
index 51a2d6cb7d..c0b2f4c474 100644
--- a/xen/common/gdbstub.c
+++ b/xen/common/gdbstub.c
@@ -43,6 +43,7 @@
#include <xen/smp.h>
#include <xen/console.h>
#include <xen/errno.h>
+#include <asm/byteorder.h>
/* Printk isn't particularly safe just after we've trapped to the
debugger. so avoid it. */
@@ -215,8 +216,7 @@ void
gdb_write_to_packet_hex(unsigned long x, int int_size, struct gdb_context *ctx)
{
char buf[sizeof(unsigned long) * 2 + 1];
- int i = sizeof(unsigned long) * 2;
- int width = int_size * 2;
+ int i, width = int_size * 2;
buf[sizeof(unsigned long) * 2] = 0;
@@ -233,6 +233,8 @@ gdb_write_to_packet_hex(unsigned long x, int int_size, struct gdb_context *ctx)
break;
}
+#ifdef __BIG_ENDIAN
+ i = sizeof(unsigned long) * 2
do {
buf[--i] = hex2char(x & 15);
x >>= 4;
@@ -242,6 +244,17 @@ gdb_write_to_packet_hex(unsigned long x, int int_size, struct gdb_context *ctx)
buf[--i] = '0';
gdb_write_to_packet(&buf[i], width, ctx);
+#elif defined(__LITTLE_ENDIAN)
+ i = 0;
+ while (i < width) {
+ buf[i++] = hex2char(x>>4);
+ buf[i++] = hex2char(x);
+ x >>= 8;
+ }
+ gdb_write_to_packet(buf, width, ctx);
+#else
+# error unknown endian
+#endif
}
static int
@@ -512,7 +525,7 @@ __trap_to_gdb(struct cpu_user_regs *regs, unsigned long cookie)
if ( gdb_ctx->serhnd < 0 )
{
- dbg_printk("Debugger not ready yet.\n");
+ printk("Debugging connection not set up.\n");
return -EBUSY;
}