2 * Copyright (C) 2001 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
6 #include "linux/sched.h"
7 #include "linux/kernel.h"
8 #include "linux/module.h"
9 #include "linux/kallsyms.h"
11 #include "asm/processor.h"
13 #include "user_util.h"
15 /* Catch non-i386 SUBARCH's. */
16 #if !defined(CONFIG_UML_X86) || defined(CONFIG_64BIT)
17 void show_trace(struct task_struct
*task
, unsigned long * stack
)
22 stack
= (unsigned long*) &stack
;
26 printk("Call Trace: \n");
27 while (((long) stack
& (THREAD_SIZE
-1)) != 0) {
29 if (__kernel_text_address(addr
)) {
30 printk("%08lx: [<%08lx>]", (unsigned long) stack
, addr
);
31 print_symbol(" %s", addr
);
41 * stack dumps generator - this is used by arch-independent code.
42 * And this is identical to i386 currently.
48 show_trace(current
, &stack
);
50 EXPORT_SYMBOL(dump_stack
);
52 /*Stolen from arch/i386/kernel/traps.c */
53 static int kstack_depth_to_print
= 24;
55 /* This recently started being used in arch-independent code too, as in
57 void show_stack(struct task_struct
*task
, unsigned long *esp
)
63 if (task
!= current
&& task
!= NULL
) {
64 esp
= (unsigned long *) KSTK_ESP(task
);
66 esp
= (unsigned long *) &esp
;
71 for(i
= 0; i
< kstack_depth_to_print
; i
++) {
72 if (kstack_end(stack
))
74 if (i
&& ((i
% 8) == 0))
76 printk("%08lx ", *stack
++);
79 printk("Call Trace: \n");
80 show_trace(task
, esp
);