Skip to content

Commit

Permalink
[MIPS] Simplify dump_stack()
Browse files Browse the repository at this point in the history
Make dump_stack() code not depend on CONFIG_KALLSYMS.

It also make prepare_frametrace() always inlined to get
less false entries reported by show_raw_backtrace().

Signed-off-by: Franck Bui-Huu <vagabon.xyz@gmail.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
Franck Bui-Huu authored and Ralf Baechle committed Sep 27, 2006
1 parent 6057a79 commit 1666a6f
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions arch/mips/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ static void show_stacktrace(struct task_struct *task, struct pt_regs *regs)
show_backtrace(task, regs);
}

static noinline void prepare_frametrace(struct pt_regs *regs)
static __always_inline void prepare_frametrace(struct pt_regs *regs)
{
__asm__ __volatile__(
"1: la $2, 1b\n\t"
Expand Down Expand Up @@ -200,17 +200,15 @@ void show_stack(struct task_struct *task, unsigned long *sp)
*/
void dump_stack(void)
{
unsigned long stack;
struct pt_regs regs;

#ifdef CONFIG_KALLSYMS
if (!raw_show_trace) {
struct pt_regs regs;
prepare_frametrace(&regs);
show_backtrace(current, &regs);
return;
}
#endif
show_raw_backtrace(&stack);
/*
* Remove any garbage that may be in regs (specially func
* addresses) to avoid show_raw_backtrace() to report them
*/
memset(&regs, 0, sizeof(regs));
prepare_frametrace(&regs);
show_backtrace(current, &regs);
}

EXPORT_SYMBOL(dump_stack);
Expand Down

0 comments on commit 1666a6f

Please sign in to comment.