linux-mips
[Top] [All Lists]

show_stack, show_trace does not work for other process

To: linux-mips@linux-mips.org
Subject: show_stack, show_trace does not work for other process
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Fri, 10 Dec 2004 14:12:26 +0900 (JST)
Cc: ralf@linux-mips.org
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
On kernel 2.6, SysRq-T (show_task()) can not show correct stack dump
because show_stack() ignores an 'task' argument.  Here is a patch.  I
fixed show_trace too.

--- linux-mips/arch/mips/kernel/traps.c 2004-11-29 11:23:20.000000000 +0900
+++ linux/arch/mips/kernel/traps.c      2004-12-10 14:01:09.078969122 +0900
@@ -82,7 +82,12 @@
        long stackdata;
        int i;
 
-       sp = sp ? sp : (unsigned long *) &sp;
+       if (!sp) {
+               if (task && task != current)
+                       sp = (unsigned long *) task->thread.reg29;
+               else
+                       sp = (unsigned long *) &sp;
+       }
 
        printk("Stack :");
        i = 0;
@@ -110,8 +115,12 @@
        const int field = 2 * sizeof(unsigned long);
        unsigned long addr;
 
-       if (!stack)
-               stack = (unsigned long*)&stack;
+       if (!stack) {
+               if (task && task != current)
+                       stack = (unsigned long *) task->thread.reg29;
+               else
+                       stack = (unsigned long *) &stack;
+       }
 
        printk("Call Trace:");
 #ifdef CONFIG_KALLSYMS

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