aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/kgdb.c
diff options
context:
space:
mode:
authorJason Wessel <jason.wessel@windriver.com>2010-05-20 22:04:26 -0400
committerJason Wessel <jason.wessel@windriver.com>2010-05-20 22:04:26 -0400
commit5dd11d5d47d248850c58292513f0e164ba98b01e (patch)
treefd3c5f27dd40d6a483483de3644ca060a5cafd75 /arch/mips/kernel/kgdb.c
parentba797b28131b1f1367b662936ea370239d603cff (diff)
mips,kgdb: kdb low level trap catch and stack trace
The only way the debugger can handle a trap in inside rcu_lock, notify_die, or atomic_notifier_call_chain without a recursive fault is to have a low level "first opportunity handler" do_trap_or_bp() handler. Generally this will be something the vast majority of folks will not need, but for those who need it, it is added as a kernel .config option called KGDB_LOW_LEVEL_TRAP. Also added was a die notification for oops such that kdb can catch an oops for analysis. There appeared to be no obvious way to pass the struct pt_regs from the original exception back to the stack back tracer, so a special case was added to show_stack() for when kdb is active because you generally desire to generally look at the back trace of the original exception. Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Acked-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/kgdb.c')
-rw-r--r--arch/mips/kernel/kgdb.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/arch/mips/kernel/kgdb.c b/arch/mips/kernel/kgdb.c
index 6ed4c83c869b..9b78ff6e9b84 100644
--- a/arch/mips/kernel/kgdb.c
+++ b/arch/mips/kernel/kgdb.c
@@ -203,7 +203,7 @@ static int kgdb_mips_notify(struct notifier_block *self, unsigned long cmd,
203 if (atomic_read(&kgdb_active) != -1) 203 if (atomic_read(&kgdb_active) != -1)
204 kgdb_nmicallback(smp_processor_id(), regs); 204 kgdb_nmicallback(smp_processor_id(), regs);
205 205
206 if (kgdb_handle_exception(trap, compute_signal(trap), 0, regs)) 206 if (kgdb_handle_exception(trap, compute_signal(trap), cmd, regs))
207 return NOTIFY_DONE; 207 return NOTIFY_DONE;
208 208
209 if (atomic_read(&kgdb_setting_breakpoint)) 209 if (atomic_read(&kgdb_setting_breakpoint))
@@ -217,6 +217,26 @@ static int kgdb_mips_notify(struct notifier_block *self, unsigned long cmd,
217 return NOTIFY_STOP; 217 return NOTIFY_STOP;
218} 218}
219 219
220#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
221int kgdb_ll_trap(int cmd, const char *str,
222 struct pt_regs *regs, long err, int trap, int sig)
223{
224 struct die_args args = {
225 .regs = regs,
226 .str = str,
227 .err = err,
228 .trapnr = trap,
229 .signr = sig,
230
231 };
232
233 if (!kgdb_io_module_registered)
234 return NOTIFY_DONE;
235
236 return kgdb_mips_notify(NULL, cmd, &args);
237}
238#endif /* CONFIG_KGDB_LOW_LEVEL_TRAP */
239
220static struct notifier_block kgdb_notifier = { 240static struct notifier_block kgdb_notifier = {
221 .notifier_call = kgdb_mips_notify, 241 .notifier_call = kgdb_mips_notify,
222}; 242};