Commit 883ba69a authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Linus Torvalds

[PATCH] parisc: better stack traces

In parisc_terminate(), do the stack trace from the faulting location
instead of from the current (i.e. parisc_terminate()) location.
Committed-by: default avatarRandolph Chung <tausq@parisc-linux.org>
parent 3d005003
...@@ -135,32 +135,19 @@ void dump_stack(void) ...@@ -135,32 +135,19 @@ void dump_stack(void)
EXPORT_SYMBOL(dump_stack); EXPORT_SYMBOL(dump_stack);
void show_stack(struct task_struct *task, unsigned long *s) static void do_show_stack(struct unwind_frame_info *info)
{ {
int i = 1; int i = 1;
struct unwind_frame_info info;
if (!task) {
unsigned long sp, ip, rp;
HERE:
asm volatile ("copy %%r30, %0" : "=r"(sp));
ip = (unsigned long)&&HERE;
rp = (unsigned long)__builtin_return_address(0);
unwind_frame_init(&info, current, sp, ip, rp);
} else {
unwind_frame_init_from_blocked_task(&info, task);
}
printk("Backtrace:\n"); printk("Backtrace:\n");
while (i <= 16) { while (i <= 16) {
if (unwind_once(&info) < 0 || info.ip == 0) if (unwind_once(info) < 0 || info->ip == 0)
break; break;
if (__kernel_text_address(info.ip)) { if (__kernel_text_address(info->ip)) {
printk(" [<" RFMT ">] ", info.ip); printk(" [<" RFMT ">] ", info->ip);
#ifdef CONFIG_KALLSYMS #ifdef CONFIG_KALLSYMS
print_symbol("%s\n", info.ip); print_symbol("%s\n", info->ip);
#else #else
if ((i & 0x03) == 0) if ((i & 0x03) == 0)
printk("\n"); printk("\n");
...@@ -171,6 +158,25 @@ void show_stack(struct task_struct *task, unsigned long *s) ...@@ -171,6 +158,25 @@ void show_stack(struct task_struct *task, unsigned long *s)
printk("\n"); printk("\n");
} }
void show_stack(struct task_struct *task, unsigned long *s)
{
struct unwind_frame_info info;
if (!task) {
unsigned long sp, ip, rp;
HERE:
asm volatile ("copy %%r30, %0" : "=r"(sp));
ip = (unsigned long)&&HERE;
rp = (unsigned long)__builtin_return_address(0);
unwind_frame_init(&info, current, sp, ip, rp);
} else {
unwind_frame_init_from_blocked_task(&info, task);
}
do_show_stack(&info);
}
void die_if_kernel(char *str, struct pt_regs *regs, long err) void die_if_kernel(char *str, struct pt_regs *regs, long err)
{ {
if (user_mode(regs)) { if (user_mode(regs)) {
...@@ -407,7 +413,12 @@ void parisc_terminate(char *msg, struct pt_regs *regs, int code, unsigned long o ...@@ -407,7 +413,12 @@ void parisc_terminate(char *msg, struct pt_regs *regs, int code, unsigned long o
} }
show_stack(NULL, (unsigned long *)regs->gr[30]); {
/* show_stack(NULL, (unsigned long *)regs->gr[30]); */
struct unwind_frame_info info;
unwind_frame_init(&info, current, regs->gr[30], regs->iaoq[0], regs->gr[2]);
do_show_stack(&info);
}
printk("\n"); printk("\n");
printk(KERN_CRIT "%s: Code=%d regs=%p (Addr=" RFMT ")\n", printk(KERN_CRIT "%s: Code=%d regs=%p (Addr=" RFMT ")\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