Commit e889d78f authored by Atsushi Nemoto's avatar Atsushi Nemoto Committed by Ralf Baechle

[MIPS] Rearrange show_stack, show_trace

Print call-trace in show_stack() (like on other archs).  Also make
show_trace() static and simplify its argument list.
Signed-off-by: default avatarAtsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent e7dee3ce
...@@ -79,6 +79,25 @@ void (*board_bind_eic_interrupt)(int irq, int regset); ...@@ -79,6 +79,25 @@ void (*board_bind_eic_interrupt)(int irq, int regset);
*/ */
#define MODULE_RANGE (8*1024*1024) #define MODULE_RANGE (8*1024*1024)
static void show_trace(unsigned long *stack)
{
const int field = 2 * sizeof(unsigned long);
unsigned long addr;
printk("Call Trace:");
#ifdef CONFIG_KALLSYMS
printk("\n");
#endif
while (!kstack_end(stack)) {
addr = *stack++;
if (__kernel_text_address(addr)) {
printk(" [<%0*lx>] ", field, addr);
print_symbol("%s\n", addr);
}
}
printk("\n");
}
/* /*
* This routine abuses get_user()/put_user() to reference pointers * This routine abuses get_user()/put_user() to reference pointers
* with at least a bit of error checking ... * with at least a bit of error checking ...
...@@ -88,6 +107,7 @@ void show_stack(struct task_struct *task, unsigned long *sp) ...@@ -88,6 +107,7 @@ void show_stack(struct task_struct *task, unsigned long *sp)
const int field = 2 * sizeof(unsigned long); const int field = 2 * sizeof(unsigned long);
long stackdata; long stackdata;
int i; int i;
unsigned long *stack;
if (!sp) { if (!sp) {
if (task && task != current) if (task && task != current)
...@@ -95,6 +115,7 @@ void show_stack(struct task_struct *task, unsigned long *sp) ...@@ -95,6 +115,7 @@ void show_stack(struct task_struct *task, unsigned long *sp)
else else
sp = (unsigned long *) &sp; sp = (unsigned long *) &sp;
} }
stack = sp;
printk("Stack :"); printk("Stack :");
i = 0; i = 0;
...@@ -115,32 +136,7 @@ void show_stack(struct task_struct *task, unsigned long *sp) ...@@ -115,32 +136,7 @@ void show_stack(struct task_struct *task, unsigned long *sp)
i++; i++;
} }
printk("\n"); printk("\n");
} show_trace(stack);
void show_trace(struct task_struct *task, unsigned long *stack)
{
const int field = 2 * sizeof(unsigned long);
unsigned long addr;
if (!stack) {
if (task && task != current)
stack = (unsigned long *) task->thread.reg29;
else
stack = (unsigned long *) &stack;
}
printk("Call Trace:");
#ifdef CONFIG_KALLSYMS
printk("\n");
#endif
while (!kstack_end(stack)) {
addr = *stack++;
if (__kernel_text_address(addr)) {
printk(" [<%0*lx>] ", field, addr);
print_symbol("%s\n", addr);
}
}
printk("\n");
} }
/* /*
...@@ -150,7 +146,7 @@ void dump_stack(void) ...@@ -150,7 +146,7 @@ void dump_stack(void)
{ {
unsigned long stack; unsigned long stack;
show_trace(current, &stack); show_trace(&stack);
} }
EXPORT_SYMBOL(dump_stack); EXPORT_SYMBOL(dump_stack);
...@@ -270,7 +266,6 @@ void show_registers(struct pt_regs *regs) ...@@ -270,7 +266,6 @@ void show_registers(struct pt_regs *regs)
printk("Process %s (pid: %d, threadinfo=%p, task=%p)\n", printk("Process %s (pid: %d, threadinfo=%p, task=%p)\n",
current->comm, current->pid, current_thread_info(), current); current->comm, current->pid, current_thread_info(), current);
show_stack(current, (long *) regs->regs[29]); show_stack(current, (long *) regs->regs[29]);
show_trace(current, (long *) regs->regs[29]);
show_code((unsigned int *) regs->cp0_epc); show_code((unsigned int *) regs->cp0_epc);
printk("\n"); printk("\n");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment