ia64/xen-unstable

changeset 11378:3a195d95c615

[XEN][POWERPC] show symbols in backtrace

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

Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author Jimi Xenidis <jimix@watson.ibm.com>
date Wed Aug 23 05:44:46 2006 -0400 (2006-08-23)
parents 20c988c92bee
children 0caf1a74fecd
files .hgignore xen/arch/powerpc/Makefile xen/arch/powerpc/backtrace.c xen/include/asm-powerpc/types.h
line diff
     1.1 --- a/.hgignore	Wed Aug 23 04:59:10 2006 -0400
     1.2 +++ b/.hgignore	Wed Aug 23 05:44:46 2006 -0400
     1.3 @@ -203,6 +203,8 @@
     1.4  ^xen/arch/powerpc/firmware$
     1.5  ^xen/arch/powerpc/firmware_image$
     1.6  ^xen/arch/powerpc/xen\.lds$
     1.7 +^xen/arch/powerpc/.xen-syms$
     1.8 +^xen/arch/powerpc/xen-syms.S$
     1.9  ^unmodified_drivers/linux-2.6/\.tmp_versions
    1.10  ^unmodified_drivers/linux-2.6/.*\.cmd$
    1.11  ^unmodified_drivers/linux-2.6/.*\.ko$
     2.1 --- a/xen/arch/powerpc/Makefile	Wed Aug 23 04:59:10 2006 -0400
     2.2 +++ b/xen/arch/powerpc/Makefile	Wed Aug 23 05:44:46 2006 -0400
     2.3 @@ -95,8 +95,20 @@ boot_of.o: CFLAGS += -DCMDLINE="\"$(IMAG
     2.4  start.o: boot/start.S
     2.5  	$(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $@
     2.6  
     2.7 -$(TARGET)-syms: start.o $(ALL_OBJS) xen.lds
     2.8 -	$(CC) $(CFLAGS) $(OMAGIC) -Wl,-Ttext,$(xen_link_base),-T,xen.lds start.o $(ALL_OBJS) -o $@
     2.9 +TARGET_OPTS = $(OMAGIC) -Wl,-Ttext,$(xen_link_base),-T,xen.lds
    2.10 +TARGET_OPTS += start.o $(ALL_OBJS)
    2.11 +
    2.12 +.xen-syms: start.o $(ALL_OBJS) xen.lds
    2.13 +	$(CC) $(CFLAGS) $(TARGET_OPTS) -o $@
    2.14 +
    2.15 +xen-syms.S: .xen-syms
    2.16 +	$(CROSS_COMPILE)nm --synthetic -n $^ | $(BASEDIR)/tools/symbols > $@
    2.17 +
    2.18 +xen-syms.o: xen-syms.S
    2.19 +	$(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $@
    2.20 +
    2.21 +$(TARGET)-syms: start.o $(ALL_OBJS) xen-syms.o xen.lds
    2.22 +	$(CC) $(CFLAGS) $(TARGET_OPTS) xen-syms.o -o $@
    2.23  
    2.24  $(TARGET).bin: $(TARGET)-syms
    2.25  	$(CROSS_COMPILE)objcopy --output-target=binary $< $@
    2.26 @@ -126,4 +138,4 @@ dom0.bin: $(DOM0_IMAGE)
    2.27  
    2.28  clean::
    2.29  	$(MAKE) -f $(BASEDIR)/Rules.mk -C of_handler clean
    2.30 -	rm -f firmware firmware_image dom0.bin
    2.31 +	rm -f firmware firmware_image dom0.bin .xen-syms
     3.1 --- a/xen/arch/powerpc/backtrace.c	Wed Aug 23 04:59:10 2006 -0400
     3.2 +++ b/xen/arch/powerpc/backtrace.c	Wed Aug 23 05:44:46 2006 -0400
     3.3 @@ -13,6 +13,9 @@
     3.4  #include <xen/lib.h>
     3.5  #include <xen/console.h>
     3.6  #include <xen/sched.h>
     3.7 +#include <xen/symbols.h>
     3.8 +
     3.9 +static char namebuf[KSYM_NAME_LEN+1];
    3.10  
    3.11  /* Shamelessly lifted from Linux Xmon try to keep pristene */
    3.12  #ifdef __powerpc64__
    3.13 @@ -69,36 +72,32 @@ static int mread(unsigned long adrs, voi
    3.14  static void get_function_bounds(unsigned long pc, unsigned long *startp,
    3.15  				unsigned long *endp)
    3.16  {
    3.17 -    *startp = pc;
    3.18 -    *endp = pc;
    3.19 +    unsigned long size, offset;
    3.20 +	const char *name;
    3.21 +
    3.22 +    *startp = *endp = 0;
    3.23 +	if (pc == 0)
    3.24 +		return;
    3.25 +
    3.26 +    name = symbols_lookup(pc, &size, &offset, namebuf);
    3.27 +    if (name != NULL) {
    3.28 +			*startp = pc - offset;
    3.29 +			*endp = pc - offset + size;
    3.30 +    }
    3.31  }
    3.32      
    3.33  /* Print an address in numeric and symbolic form (if possible) */
    3.34  static void xmon_print_symbol(unsigned long address, const char *mid,
    3.35                                const char *after)
    3.36  {
    3.37 -	char *modname;
    3.38  	const char *name = NULL;
    3.39  	unsigned long offset, size;
    3.40  
    3.41  	printf(REG, address);
    3.42 -#if 0
    3.43 -	if (setjmp(bus_error_jmp) == 0) {
    3.44 -		catch_memory_errors = 1;
    3.45 -		sync();
    3.46 -		name = kallsyms_lookup(address, &size, &offset, &modname,
    3.47 -				       tmpstr);
    3.48 -		sync();
    3.49 -		/* wait a little while to see if we get a machine check */
    3.50 -		__delay(200);
    3.51 -	}
    3.52  
    3.53 -	catch_memory_errors = 0;
    3.54 -#endif
    3.55 +    name = symbols_lookup(address, &size, &offset, namebuf);
    3.56  	if (name) {
    3.57  		printf("%s%s+%#lx/%#lx", mid, name, offset, size);
    3.58 -		if (modname)
    3.59 -			printf(" [%s]", modname);
    3.60  	}
    3.61  	printf("%s", after);
    3.62  }
     4.1 --- a/xen/include/asm-powerpc/types.h	Wed Aug 23 04:59:10 2006 -0400
     4.2 +++ b/xen/include/asm-powerpc/types.h	Wed Aug 23 05:44:46 2006 -0400
     4.3 @@ -3,9 +3,19 @@
     4.4  #ifndef _PPC_TYPES_H
     4.5  #define _PPC_TYPES_H
     4.6  
     4.7 +#include <xen/config.h>
     4.8 +
     4.9 +#if defined(__ppc__)
    4.10 +#define BYTES_PER_LONG 4
    4.11 +#define BITS_PER_LONG 32
    4.12 +#elif defined(__PPC64__)
    4.13 +#define BYTES_PER_LONG 8
    4.14 +#define BITS_PER_LONG 64
    4.15 +#endif
    4.16 +
    4.17 +#ifndef __ASSEMBLY__
    4.18  typedef unsigned short umode_t;
    4.19  
    4.20 -
    4.21  /*
    4.22   * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
    4.23   * header files exported to user space
    4.24 @@ -31,8 +41,6 @@ typedef unsigned long __u64;
    4.25  #endif
    4.26  #endif
    4.27  
    4.28 -#include <xen/config.h>
    4.29 -
    4.30  typedef signed char s8;
    4.31  typedef unsigned char u8;
    4.32  
    4.33 @@ -45,14 +53,10 @@ typedef unsigned int u32;
    4.34  #if defined(__ppc__)
    4.35  typedef signed long long s64;
    4.36  typedef unsigned long long u64;
    4.37 -#define BYTES_PER_LONG 4
    4.38 -#define BITS_PER_LONG 32
    4.39  typedef unsigned int size_t;
    4.40  #elif defined(__PPC64__)
    4.41  typedef signed long s64;
    4.42  typedef unsigned long u64;
    4.43 -#define BYTES_PER_LONG 8
    4.44 -#define BITS_PER_LONG 64
    4.45  typedef unsigned long size_t;
    4.46  #endif
    4.47  
    4.48 @@ -66,4 +70,5 @@ typedef u64 dma64_addr_t;
    4.49  
    4.50  typedef unsigned short xmem_bufctl_t;
    4.51  
    4.52 +#endif  /* __ASSEMBLY__ */
    4.53  #endif