diff options
author | Olaf Hering <olaf@aepfle.de> | 2006-09-08 10:29:21 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-09-13 04:39:53 -0400 |
commit | 26c8af5f01dfb91f709cc2ba07fb650949aae13e (patch) | |
tree | dbaa11641da7348bb2fbde3c75429449c7ca4104 | |
parent | 87fd7724d4022913ae8dbee3ed55cd04f2c316a6 (diff) |
[POWERPC] print backtrace when entering xmon
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 <olaf@aepfle.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | arch/powerpc/Kconfig.debug | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/setup-common.c | 4 | ||||
-rw-r--r-- | arch/powerpc/xmon/xmon.c | 10 |
3 files changed, 16 insertions, 0 deletions
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug index d7b2aedd89aa..5ad149b47e34 100644 --- a/arch/powerpc/Kconfig.debug +++ b/arch/powerpc/Kconfig.debug | |||
@@ -88,6 +88,8 @@ config XMON | |||
88 | very early during boot. 'xmon=on' will just enable the xmon | 88 | very early during boot. 'xmon=on' will just enable the xmon |
89 | debugger hooks. 'xmon=off' will disable the debugger hooks | 89 | debugger hooks. 'xmon=off' will disable the debugger hooks |
90 | if CONFIG_XMON_DEFAULT is set. | 90 | if CONFIG_XMON_DEFAULT is set. |
91 | xmon will print a backtrace on the very first invocation. | ||
92 | 'xmon=nobt' will disable this autobacktrace. | ||
91 | 93 | ||
92 | config XMON_DEFAULT | 94 | config XMON_DEFAULT |
93 | bool "Enable xmon by default" | 95 | bool "Enable xmon by default" |
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index d57930d86faa..465e7435efbc 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c | |||
@@ -441,6 +441,8 @@ void __init smp_setup_cpu_maps(void) | |||
441 | 441 | ||
442 | int __initdata do_early_xmon; | 442 | int __initdata do_early_xmon; |
443 | #ifdef CONFIG_XMON | 443 | #ifdef CONFIG_XMON |
444 | extern int xmon_no_auto_backtrace; | ||
445 | |||
444 | static int __init early_xmon(char *p) | 446 | static int __init early_xmon(char *p) |
445 | { | 447 | { |
446 | /* ensure xmon is enabled */ | 448 | /* ensure xmon is enabled */ |
@@ -449,6 +451,8 @@ static int __init early_xmon(char *p) | |||
449 | xmon_init(1); | 451 | xmon_init(1); |
450 | if (strncmp(p, "off", 3) == 0) | 452 | if (strncmp(p, "off", 3) == 0) |
451 | xmon_init(0); | 453 | xmon_init(0); |
454 | if (strncmp(p, "nobt", 4) == 0) | ||
455 | xmon_no_auto_backtrace = 1; | ||
452 | if (strncmp(p, "early", 5) != 0) | 456 | if (strncmp(p, "early", 5) != 0) |
453 | return 0; | 457 | return 0; |
454 | } | 458 | } |
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index 179b10ced8c7..8adad1444a51 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c | |||
@@ -137,10 +137,14 @@ static void bootcmds(void); | |||
137 | static void proccall(void); | 137 | static void proccall(void); |
138 | void dump_segments(void); | 138 | void dump_segments(void); |
139 | static void symbol_lookup(void); | 139 | static void symbol_lookup(void); |
140 | static void xmon_show_stack(unsigned long sp, unsigned long lr, | ||
141 | unsigned long pc); | ||
140 | static void xmon_print_symbol(unsigned long address, const char *mid, | 142 | static void xmon_print_symbol(unsigned long address, const char *mid, |
141 | const char *after); | 143 | const char *after); |
142 | static const char *getvecname(unsigned long vec); | 144 | static const char *getvecname(unsigned long vec); |
143 | 145 | ||
146 | int xmon_no_auto_backtrace; | ||
147 | |||
144 | extern int print_insn_powerpc(unsigned long, unsigned long, int); | 148 | extern int print_insn_powerpc(unsigned long, unsigned long, int); |
145 | 149 | ||
146 | extern void xmon_enter(void); | 150 | extern void xmon_enter(void); |
@@ -736,6 +740,12 @@ cmds(struct pt_regs *excp) | |||
736 | 740 | ||
737 | last_cmd = NULL; | 741 | last_cmd = NULL; |
738 | xmon_regs = excp; | 742 | xmon_regs = excp; |
743 | |||
744 | if (!xmon_no_auto_backtrace) { | ||
745 | xmon_no_auto_backtrace = 1; | ||
746 | xmon_show_stack(excp->gpr[1], excp->link, excp->nip); | ||
747 | } | ||
748 | |||
739 | for(;;) { | 749 | for(;;) { |
740 | #ifdef CONFIG_SMP | 750 | #ifdef CONFIG_SMP |
741 | printf("%x:", smp_processor_id()); | 751 | printf("%x:", smp_processor_id()); |