WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ppc-devel

[XenPPC] [xenppc-unstable] [POWERPC] show symbols in backtrace

To: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Subject: [XenPPC] [xenppc-unstable] [POWERPC] show symbols in backtrace
From: Xen patchbot-xenppc-unstable <patchbot-xenppc-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 23 Aug 2006 10:30:33 +0000
Delivery-date: Wed, 23 Aug 2006 03:36:35 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Node ID ff2c736fce49fedc8057d61f13df0a79ead22871
# Parent  877560e56eabbc7f05f650fba912fd0611b930f6
[POWERPC] show symbols in backtrace

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

Signed-off-by: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
---
 .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 877560e56eab -r ff2c736fce49 .hgignore
--- a/.hgignore Wed Aug 23 04:59:10 2006 -0400
+++ b/.hgignore Wed Aug 23 05:44:46 2006 -0400
@@ -204,6 +204,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 877560e56eab -r ff2c736fce49 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 877560e56eab -r ff2c736fce49 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 877560e56eab -r ff2c736fce49 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-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel

<Prev in Thread] Current Thread [Next in Thread>