Commit 87151ae3 authored by Franck Bui-Huu's avatar Franck Bui-Huu Committed by Ralf Baechle

[MIPS] Miscellaneous cleanup in prologue analysis code

We usually use backtrace term for dumping a call tree during
debug. Therefore this patch renames show_frametrace() into
show_backtrace() and show_trace() into show_raw_backtrace().

It also uses the new function print_ip_sym().
Signed-off-by: default avatarFranck Bui-Huu <vagabon.xyz@gmail.com>
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent cf495a33
...@@ -74,21 +74,18 @@ void (*board_ejtag_handler_setup)(void); ...@@ -74,21 +74,18 @@ void (*board_ejtag_handler_setup)(void);
void (*board_bind_eic_interrupt)(int irq, int regset); void (*board_bind_eic_interrupt)(int irq, int regset);
static void show_trace(unsigned long *stack) static void show_raw_backtrace(unsigned long *sp)
{ {
const int field = 2 * sizeof(unsigned long);
unsigned long addr; unsigned long addr;
printk("Call Trace:"); printk("Call Trace:");
#ifdef CONFIG_KALLSYMS #ifdef CONFIG_KALLSYMS
printk("\n"); printk("\n");
#endif #endif
while (!kstack_end(stack)) { while (!kstack_end(sp)) {
addr = *stack++; addr = *sp++;
if (__kernel_text_address(addr)) { if (__kernel_text_address(addr))
printk(" [<%0*lx>] ", field, addr); print_ip_sym(addr);
print_symbol("%s\n", addr);
}
} }
printk("\n"); printk("\n");
} }
...@@ -104,22 +101,20 @@ __setup("raw_show_trace", set_raw_show_trace); ...@@ -104,22 +101,20 @@ __setup("raw_show_trace", set_raw_show_trace);
extern unsigned long unwind_stack(struct task_struct *task, extern unsigned long unwind_stack(struct task_struct *task,
unsigned long **sp, unsigned long pc); unsigned long **sp, unsigned long pc);
static void show_frametrace(struct task_struct *task, struct pt_regs *regs) static void show_backtrace(struct task_struct *task, struct pt_regs *regs)
{ {
const int field = 2 * sizeof(unsigned long); unsigned long *sp = (long *)regs->regs[29];
unsigned long *stack = (long *)regs->regs[29];
unsigned long pc = regs->cp0_epc; unsigned long pc = regs->cp0_epc;
int top = 1; int top = 1;
if (raw_show_trace || !__kernel_text_address(pc)) { if (raw_show_trace || !__kernel_text_address(pc)) {
show_trace(stack); show_raw_backtrace(sp);
return; return;
} }
printk("Call Trace:\n"); printk("Call Trace:\n");
while (__kernel_text_address(pc)) { while (__kernel_text_address(pc)) {
printk(" [<%0*lx>] ", field, pc); print_ip_sym(pc);
print_symbol("%s\n", pc); pc = unwind_stack(task, &sp, pc);
pc = unwind_stack(task, &stack, pc);
if (top && pc == 0) if (top && pc == 0)
pc = regs->regs[31]; /* leaf? */ pc = regs->regs[31]; /* leaf? */
top = 0; top = 0;
...@@ -127,7 +122,7 @@ static void show_frametrace(struct task_struct *task, struct pt_regs *regs) ...@@ -127,7 +122,7 @@ static void show_frametrace(struct task_struct *task, struct pt_regs *regs)
printk("\n"); printk("\n");
} }
#else #else
#define show_frametrace(task, r) show_trace((long *)(r)->regs[29]); #define show_backtrace(task, r) show_raw_backtrace((long *)(r)->regs[29]);
#endif #endif
/* /*
...@@ -160,7 +155,7 @@ static void show_stacktrace(struct task_struct *task, struct pt_regs *regs) ...@@ -160,7 +155,7 @@ static void show_stacktrace(struct task_struct *task, struct pt_regs *regs)
i++; i++;
} }
printk("\n"); printk("\n");
show_frametrace(task, regs); show_backtrace(task, regs);
} }
static noinline void prepare_frametrace(struct pt_regs *regs) static noinline void prepare_frametrace(struct pt_regs *regs)
...@@ -211,11 +206,11 @@ void dump_stack(void) ...@@ -211,11 +206,11 @@ void dump_stack(void)
if (!raw_show_trace) { if (!raw_show_trace) {
struct pt_regs regs; struct pt_regs regs;
prepare_frametrace(&regs); prepare_frametrace(&regs);
show_frametrace(current, &regs); show_backtrace(current, &regs);
return; return;
} }
#endif #endif
show_trace(&stack); show_raw_backtrace(&stack);
} }
EXPORT_SYMBOL(dump_stack); EXPORT_SYMBOL(dump_stack);
......
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