

sysrq-T currently displays the same stack trace for every process.

Teach show_stack() to look in the passed task_struct first if the caller did
not pass in a stack address.



 arch/i386/kernel/traps.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff -puN arch/i386/kernel/traps.c~show_stack-fix arch/i386/kernel/traps.c
--- 25/arch/i386/kernel/traps.c~show_stack-fix	2003-06-23 13:51:23.000000000 -0700
+++ 25-akpm/arch/i386/kernel/traps.c	2003-06-23 13:59:09.000000000 -0700
@@ -159,19 +159,20 @@ void show_trace_task(struct task_struct 
 	show_trace(tsk, (unsigned long *)esp);
 }
 
-void show_stack(struct task_struct *task, unsigned long * esp)
+void show_stack(struct task_struct *task, unsigned long *esp)
 {
 	unsigned long *stack;
 	int i;
 
-	// debugging aid: "show_stack(NULL);" prints the
-	// back trace for this cpu.
-
-	if(esp==NULL)
-		esp=(unsigned long*)&esp;
+	if (esp == NULL) {
+		if (task)
+			esp = (unsigned long*)task->thread.esp;
+		else
+			esp = (unsigned long *)&esp;
+	}
 
 	stack = esp;
-	for(i=0; i < kstack_depth_to_print; i++) {
+	for(i = 0; i < kstack_depth_to_print; i++) {
 		if (((long) stack & (THREAD_SIZE-1)) == 0)
 			break;
 		if (i && ((i % 8) == 0))

_
