[PATCH] allow xmon=nobt to not print a backtrace by default

Olaf Hering olh at suse.de
Wed Jul 6 06:47:36 EST 2005


(untested)

xmon does not print a backtrace per default. This is bad on systems with
USB keyboard, the most needed info about the crash is lost.
print a backtrace during the very first xmon entry.

Booting with xmon=nobt disables the autobacktrace functionality.


Signed-off-by: Olaf Hering <olh at suse.de>

 arch/ppc64/kernel/setup.c |    4 ++++
 arch/ppc64/xmon/xmon.c    |    5 +++++
 2 files changed, 9 insertions(+)

Index: linux-2.6.12-olh/arch/ppc64/kernel/setup.c
===================================================================
--- linux-2.6.12-olh.orig/arch/ppc64/kernel/setup.c
+++ linux-2.6.12-olh/arch/ppc64/kernel/setup.c
@@ -91,6 +91,8 @@ extern void udbg_init_maple_realmode(voi
 	do { ppc_md.udbg_putc = call_rtas_display_status_delay; } while(0)
 #endif
 
+extern int xmon_no_auto_backtrace;
+
 /* extern void *stab; */
 extern unsigned long klimit;
 
@@ -1318,6 +1320,8 @@ static int __init early_xmon(char *p)
 {
 	/* ensure xmon is enabled */
 	if (p) {
+		if (strncmp(p, "nobt", 4) == 0)
+			xmon_no_auto_backtrace++;
 		if (strncmp(p, "on", 2) == 0)
 			xmon_init();
 		if (strncmp(p, "early", 5) != 0)
Index: linux-2.6.12-olh/arch/ppc64/xmon/xmon.c
===================================================================
--- linux-2.6.12-olh.orig/arch/ppc64/xmon/xmon.c
+++ linux-2.6.12-olh/arch/ppc64/xmon/xmon.c
@@ -132,11 +132,13 @@ static void csum(void);
 static void bootcmds(void);
 void dump_segments(void);
 static void symbol_lookup(void);
+static void xmon_show_stack(unsigned long sp, unsigned long lr, unsigned long pc);
 static void xmon_print_symbol(unsigned long address, const char *mid,
 			      const char *after);
 static const char *getvecname(unsigned long vec);
 
 static void debug_trace(void);
+int xmon_no_auto_backtrace;
 
 extern int print_insn_powerpc(unsigned long, unsigned long, int);
 extern void printf(const char *fmt, ...);
@@ -768,6 +770,9 @@ cmds(struct pt_regs *excp)
 
 	last_cmd = NULL;
 	xmon_regs = excp;
+	if (!xmon_no_auto_backtrace++)
+		xmon_show_stack(excp->gpr[1], excp->link, excp->nip);
+
 	for(;;) {
 #ifdef CONFIG_SMP
 		printf("%x:", smp_processor_id());



More information about the Linuxppc64-dev mailing list