2 * Copyright (C) 2001 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
6 #include "linux/config.h"
7 #include "linux/sched.h"
8 #include "linux/kernel.h"
9 #include "linux/module.h"
10 #include "linux/kallsyms.h"
12 #include "asm/processor.h"
14 #include "user_util.h"
16 /* Catch non-i386 SUBARCH's. */
17 #if !defined(CONFIG_UML_X86) || defined(CONFIG_64BIT)
18 void show_trace(struct task_struct
*task
, unsigned long * stack
)
23 stack
= (unsigned long*) &stack
;
27 printk("Call Trace: \n");
28 while (((long) stack
& (THREAD_SIZE
-1)) != 0) {
30 if (__kernel_text_address(addr
)) {
31 printk("%08lx: [<%08lx>]", (unsigned long) stack
, addr
);
32 print_symbol(" %s", addr
);
42 * stack dumps generator - this is used by arch-independent code.
43 * And this is identical to i386 currently.
49 show_trace(current
, &stack
);
51 EXPORT_SYMBOL(dump_stack
);
53 /*Stolen from arch/i386/kernel/traps.c */
54 static int kstack_depth_to_print
= 24;
56 /* This recently started being used in arch-independent code too, as in
58 void show_stack(struct task_struct
*task
, unsigned long *esp
)
64 if (task
!= current
&& task
!= NULL
) {
65 /* XXX: Isn't this bogus? I.e. isn't this the
66 * *userspace* stack of this task? If not so, use this
67 * even when task == current (as in i386).
69 esp
= (unsigned long *) KSTK_ESP(task
);
70 /* Which one? No actual difference - just coding style.*/
71 //esp = (unsigned long *) PT_REGS_IP(&task->thread.regs);
73 esp
= (unsigned long *) &esp
;
78 for(i
= 0; i
< kstack_depth_to_print
; i
++) {
79 if (kstack_end(stack
))
81 if (i
&& ((i
% 8) == 0))
83 printk("%08lx ", *stack
++);
86 printk("Call Trace: \n");
87 show_trace(current
, esp
);