From: Paul M. <le...@Ch...> - 2002-02-28 08:16:32
|
Hello, As I continue looking through some of my local pending changes, this was the next one that popped up.. The current implementation of show_trace_task() is a bit on the .. uneventf= ul side of things. This patch removes the old dump_stack() in favor of a new show_task() which happily either recieves a stack pointer, or reads it in in the existing manner that dump_stack() did. I haven't had the chance to do any extensive testing on this.. so any comme= nts on the patch would be appreciated. Regards, --=20 Paul Mundt <le...@ch...> Index: ChangeLog =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/linuxsh/linux/ChangeLog,v retrieving revision 1.32 diff -u -r1.32 ChangeLog --- ChangeLog 26 Feb 2002 09:15:15 -0000 1.32 +++ ChangeLog 28 Feb 2002 08:05:20 -0000 @@ -1,3 +1,10 @@ +2002-02-27 Paul Mundt <le...@ch...> + + * arch/sh/kernel/traps.c (dump_stack): Removed. + (show_task): Added. + (show_trace_task): Hand off actual stack pointer to show_task() + to do a real backtrace. + 2002-02-26 NIIBE Yutaka <gn...@m1...> =20 Updated to 2.5.3. Index: arch/sh/kernel/traps.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/linuxsh/linux/arch/sh/kernel/traps.c,v retrieving revision 1.3.2.2 diff -u -r1.3.2.2 traps.c --- arch/sh/kernel/traps.c 19 Jan 2002 23:55:14 -0000 1.3.2.2 +++ arch/sh/kernel/traps.c 25 Feb 2002 08:42:48 -0000 @@ -5,6 +5,7 @@ * SuperH version: Copyright (C) 1999 Niibe Yutaka * Copyright (C) 2000 Philipp Rumpf * Copyright (C) 2000 David Howells + * Copyright (C) 2002 Paul Mundt */ =20 /* @@ -560,29 +561,51 @@ : "memory"); } =20 -void dump_stack(void) +void show_task(unsigned long *sp) { - unsigned long *start; - unsigned long *end; - unsigned long *p; - - asm("mov r15, %0" : "=3Dr" (start)); - asm("stc r7_bank, %0" : "=3Dr" (end)); - end +=3D 8192/4; - - printk("%08lx:%08lx\n", (unsigned long)start, (unsigned long)end); - for (p=3Dstart; p < end; p++) { - extern long _text, _etext; - unsigned long v=3D*p; - - if ((v >=3D (unsigned long )&_text) - && (v <=3D (unsigned long )&_etext)) { - printk("%08lx\n", v); + unsigned long *stack, addr; + unsigned long module_start =3D VMALLOC_START; + unsigned long module_end =3D VMALLOC_END; + extern long _text, _etext; + int i =3D 1; + + if (!sp) { + __asm__ __volatile__ ( + "mov r15, %0\n\t" + "stc r7_bank, %1\n\t" + : "=3Dr" (module_start), + "=3Dr" (module_end) + ); + =09 + sp =3D (unsigned long *)module_start; + } + + stack =3D sp; + + printk("\nCall trace: "); + + while (((long)stack & (THREAD_SIZE - 1))) { + if (__get_user(addr, stack)) { + printk("Failing address 0x%lx\n", *stack); + break; + } + stack++; + + if (((addr >=3D (unsigned long)&_text) && + (addr <=3D (unsigned long)&_etext)) || + ((addr >=3D module_start) && (addr <=3D module_end))) { + if (i && ((i % 8) =3D=3D 0)) + printk("\n "); + + printk("[<%08lx>] ", addr); + i++; } } + + printk("\n"); } =20 void show_trace_task(struct task_struct *tsk) { - printk("Backtrace not yet implemented for SH.\n"); + show_task((unsigned long *)tsk->thread.sp); } |