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

[Xen-changelog] [xen-unstable] [XEN][POWERPC] show symbols in backtrace



# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Node ID 3a195d95c61570240322e9643093168d2003783f
# Parent  20c988c92bee7afb2438952c520721213ce278b1
[XEN][POWERPC] show symbols in backtrace

This was already there, just had to hook it up.

Signed-off-by: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>
---
 .hgignore                       |    2 ++
 xen/arch/powerpc/Makefile       |   18 +++++++++++++++---
 xen/arch/powerpc/backtrace.c    |   33 ++++++++++++++++-----------------
 xen/include/asm-powerpc/types.h |   19 ++++++++++++-------
 4 files changed, 45 insertions(+), 27 deletions(-)

diff -r 20c988c92bee -r 3a195d95c615 .hgignore
--- a/.hgignore Wed Aug 23 04:59:10 2006 -0400
+++ b/.hgignore Wed Aug 23 05:44:46 2006 -0400
@@ -203,6 +203,8 @@
 ^xen/arch/powerpc/firmware$
 ^xen/arch/powerpc/firmware_image$
 ^xen/arch/powerpc/xen\.lds$
+^xen/arch/powerpc/.xen-syms$
+^xen/arch/powerpc/xen-syms.S$
 ^unmodified_drivers/linux-2.6/\.tmp_versions
 ^unmodified_drivers/linux-2.6/.*\.cmd$
 ^unmodified_drivers/linux-2.6/.*\.ko$
diff -r 20c988c92bee -r 3a195d95c615 xen/arch/powerpc/Makefile
--- a/xen/arch/powerpc/Makefile Wed Aug 23 04:59:10 2006 -0400
+++ b/xen/arch/powerpc/Makefile Wed Aug 23 05:44:46 2006 -0400
@@ -95,8 +95,20 @@ start.o: boot/start.S
 start.o: boot/start.S
        $(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $@
 
-$(TARGET)-syms: start.o $(ALL_OBJS) xen.lds
-       $(CC) $(CFLAGS) $(OMAGIC) -Wl,-Ttext,$(xen_link_base),-T,xen.lds 
start.o $(ALL_OBJS) -o $@
+TARGET_OPTS = $(OMAGIC) -Wl,-Ttext,$(xen_link_base),-T,xen.lds
+TARGET_OPTS += start.o $(ALL_OBJS)
+
+.xen-syms: start.o $(ALL_OBJS) xen.lds
+       $(CC) $(CFLAGS) $(TARGET_OPTS) -o $@
+
+xen-syms.S: .xen-syms
+       $(CROSS_COMPILE)nm --synthetic -n $^ | $(BASEDIR)/tools/symbols > $@
+
+xen-syms.o: xen-syms.S
+       $(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $@
+
+$(TARGET)-syms: start.o $(ALL_OBJS) xen-syms.o xen.lds
+       $(CC) $(CFLAGS) $(TARGET_OPTS) xen-syms.o -o $@
 
 $(TARGET).bin: $(TARGET)-syms
        $(CROSS_COMPILE)objcopy --output-target=binary $< $@
@@ -126,4 +138,4 @@ dom0.bin: $(DOM0_IMAGE)
 
 clean::
        $(MAKE) -f $(BASEDIR)/Rules.mk -C of_handler clean
-       rm -f firmware firmware_image dom0.bin
+       rm -f firmware firmware_image dom0.bin .xen-syms
diff -r 20c988c92bee -r 3a195d95c615 xen/arch/powerpc/backtrace.c
--- a/xen/arch/powerpc/backtrace.c      Wed Aug 23 04:59:10 2006 -0400
+++ b/xen/arch/powerpc/backtrace.c      Wed Aug 23 05:44:46 2006 -0400
@@ -13,6 +13,9 @@
 #include <xen/lib.h>
 #include <xen/console.h>
 #include <xen/sched.h>
+#include <xen/symbols.h>
+
+static char namebuf[KSYM_NAME_LEN+1];
 
 /* Shamelessly lifted from Linux Xmon try to keep pristene */
 #ifdef __powerpc64__
@@ -69,36 +72,32 @@ static void get_function_bounds(unsigned
 static void get_function_bounds(unsigned long pc, unsigned long *startp,
                                unsigned long *endp)
 {
-    *startp = pc;
-    *endp = pc;
+    unsigned long size, offset;
+       const char *name;
+
+    *startp = *endp = 0;
+       if (pc == 0)
+               return;
+
+    name = symbols_lookup(pc, &size, &offset, namebuf);
+    if (name != NULL) {
+                       *startp = pc - offset;
+                       *endp = pc - offset + size;
+    }
 }
     
 /* Print an address in numeric and symbolic form (if possible) */
 static void xmon_print_symbol(unsigned long address, const char *mid,
                               const char *after)
 {
-       char *modname;
        const char *name = NULL;
        unsigned long offset, size;
 
        printf(REG, address);
-#if 0
-       if (setjmp(bus_error_jmp) == 0) {
-               catch_memory_errors = 1;
-               sync();
-               name = kallsyms_lookup(address, &size, &offset, &modname,
-                                      tmpstr);
-               sync();
-               /* wait a little while to see if we get a machine check */
-               __delay(200);
-       }
 
-       catch_memory_errors = 0;
-#endif
+    name = symbols_lookup(address, &size, &offset, namebuf);
        if (name) {
                printf("%s%s+%#lx/%#lx", mid, name, offset, size);
-               if (modname)
-                       printf(" [%s]", modname);
        }
        printf("%s", after);
 }
diff -r 20c988c92bee -r 3a195d95c615 xen/include/asm-powerpc/types.h
--- a/xen/include/asm-powerpc/types.h   Wed Aug 23 04:59:10 2006 -0400
+++ b/xen/include/asm-powerpc/types.h   Wed Aug 23 05:44:46 2006 -0400
@@ -3,8 +3,18 @@
 #ifndef _PPC_TYPES_H
 #define _PPC_TYPES_H
 
+#include <xen/config.h>
+
+#if defined(__ppc__)
+#define BYTES_PER_LONG 4
+#define BITS_PER_LONG 32
+#elif defined(__PPC64__)
+#define BYTES_PER_LONG 8
+#define BITS_PER_LONG 64
+#endif
+
+#ifndef __ASSEMBLY__
 typedef unsigned short umode_t;
-
 
 /*
  * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
@@ -31,8 +41,6 @@ typedef unsigned long __u64;
 #endif
 #endif
 
-#include <xen/config.h>
-
 typedef signed char s8;
 typedef unsigned char u8;
 
@@ -45,14 +53,10 @@ typedef unsigned int u32;
 #if defined(__ppc__)
 typedef signed long long s64;
 typedef unsigned long long u64;
-#define BYTES_PER_LONG 4
-#define BITS_PER_LONG 32
 typedef unsigned int size_t;
 #elif defined(__PPC64__)
 typedef signed long s64;
 typedef unsigned long u64;
-#define BYTES_PER_LONG 8
-#define BITS_PER_LONG 64
 typedef unsigned long size_t;
 #endif
 
@@ -66,4 +70,5 @@ typedef u64 dma64_addr_t;
 
 typedef unsigned short xmem_bufctl_t;
 
+#endif  /* __ASSEMBLY__ */
 #endif

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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