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 void show_trace(unsigned long * stack
)
17 /* XXX: Copy the CONFIG_FRAME_POINTER stack-walking backtrace from
18 * arch/i386/kernel/traps.c, and then move this to sys-i386/sysrq.c.*/
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
);
40 * stack dumps generator - this is used by arch-independent code.
41 * And this is identical to i386 currently.
49 EXPORT_SYMBOL(dump_stack
);
51 /*Stolen from arch/i386/kernel/traps.c */
52 static int kstack_depth_to_print
= 24;
54 /* This recently started being used in arch-independent code too, as in
56 void show_stack(struct task_struct
*task
, unsigned long *esp
)
62 if (task
!= current
) {
63 esp
= (unsigned long *) KSTK_ESP(task
);
64 /* Which one? No actual difference - just coding style.*/
65 //esp = (unsigned long *) PT_REGS_IP(&task->thread.regs);
67 esp
= (unsigned long *) &esp
;
72 for(i
= 0; i
< kstack_depth_to_print
; i
++) {
73 if (kstack_end(stack
))
75 if (i
&& ((i
% 8) == 0))
77 printk("%08lx ", *stack
++);