[PATCH v2] ARM: Adjust backtrace messages to line up with x86 kernel

From: Simon Glass
Date: Wed Jan 18 2012 - 02:03:58 EST


It is nice to print the backtrace message on its own line, and also
regardless of the setting of CONFIG_ARM_UNWIND. This means that tools
which parse the backtrace don't need a special case for the first line.
It also makes it more like the x86 kernel output.

I believe we should also put KERN_EMERG at the start of this. Otherwise
it won't appear in console output (although it will appear in the logs
after a reboot).

Signed-off-by: Simon Glass <sjg@xxxxxxxxxxxx>
---
Changes in v2:
- Fix typo and remove \n from non CONFIG_ARM_UNWIND path
- Remove __func__ from the unwind_backtrace() function

arch/arm/kernel/traps.c | 3 ++-
arch/arm/kernel/unwind.c | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 99a5727..3d3cae2 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -165,6 +165,7 @@ static void dump_instr(const char *lvl, struct pt_regs *regs)
#ifdef CONFIG_ARM_UNWIND
static inline void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
{
+ printk(KERN_EMERG "Backtrace:\n");
unwind_backtrace(regs, tsk);
}
#else
@@ -173,7 +174,7 @@ static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
unsigned int fp, mode;
int ok = 1;

- printk("Backtrace: ");
+ printk(KERN_EMERG "Backtrace: ");

if (!tsk)
tsk = current;
diff --git a/arch/arm/kernel/unwind.c b/arch/arm/kernel/unwind.c
index 00df012..451852a 100644
--- a/arch/arm/kernel/unwind.c
+++ b/arch/arm/kernel/unwind.c
@@ -410,7 +410,7 @@ void unwind_backtrace(struct pt_regs *regs, struct task_struct *tsk)
struct stackframe frame;
register unsigned long current_sp asm ("sp");

- pr_debug("%s(regs = %p tsk = %p)\n", __func__, regs, tsk);
+ pr_debug("(regs = %p tsk = %p)\n", regs, tsk);

if (!tsk)
tsk = current;
--
1.7.7.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/