diff options
author | Jason Wessel <jason.wessel@windriver.com> | 2010-05-20 22:04:25 -0400 |
---|---|---|
committer | Jason Wessel <jason.wessel@windriver.com> | 2010-05-20 22:04:25 -0400 |
commit | ba797b28131b1f1367b662936ea370239d603cff (patch) | |
tree | 3939c2cf1ced75fc9a14339cf369a32c85c7f7fe /arch/powerpc/kernel/kgdb.c | |
parent | f503b5ae53cb557ac351a668fcac1baab1cef0db (diff) |
powerpc,kgdb: Introduce low level trap catching
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 allow the kernel debugger to handle the exception first in
program_check_exception().
The other change here is to make sure that kgdb_handle_exception() is
called with correct parameters when catching an oops, because kdb
needs to know if the entry was an oops, single step, or breakpoint
exception.
[benh@kernel.crashing.org: move debugger_bpt instead of #ifdef]
CC: Paul Mackerras <paulus@samba.org>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/kgdb.c')
-rw-r--r-- | arch/powerpc/kernel/kgdb.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c index c81e3de1306e..82a7b228c81a 100644 --- a/arch/powerpc/kernel/kgdb.c +++ b/arch/powerpc/kernel/kgdb.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/smp.h> | 20 | #include <linux/smp.h> |
21 | #include <linux/signal.h> | 21 | #include <linux/signal.h> |
22 | #include <linux/ptrace.h> | 22 | #include <linux/ptrace.h> |
23 | #include <linux/kdebug.h> | ||
23 | #include <asm/current.h> | 24 | #include <asm/current.h> |
24 | #include <asm/processor.h> | 25 | #include <asm/processor.h> |
25 | #include <asm/machdep.h> | 26 | #include <asm/machdep.h> |
@@ -115,7 +116,8 @@ void kgdb_roundup_cpus(unsigned long flags) | |||
115 | /* KGDB functions to use existing PowerPC64 hooks. */ | 116 | /* KGDB functions to use existing PowerPC64 hooks. */ |
116 | static int kgdb_debugger(struct pt_regs *regs) | 117 | static int kgdb_debugger(struct pt_regs *regs) |
117 | { | 118 | { |
118 | return kgdb_handle_exception(0, computeSignal(TRAP(regs)), 0, regs); | 119 | return !kgdb_handle_exception(1, computeSignal(TRAP(regs)), |
120 | DIE_OOPS, regs); | ||
119 | } | 121 | } |
120 | 122 | ||
121 | static int kgdb_handle_breakpoint(struct pt_regs *regs) | 123 | static int kgdb_handle_breakpoint(struct pt_regs *regs) |
@@ -123,7 +125,7 @@ static int kgdb_handle_breakpoint(struct pt_regs *regs) | |||
123 | if (user_mode(regs)) | 125 | if (user_mode(regs)) |
124 | return 0; | 126 | return 0; |
125 | 127 | ||
126 | if (kgdb_handle_exception(0, SIGTRAP, 0, regs) != 0) | 128 | if (kgdb_handle_exception(1, SIGTRAP, 0, regs) != 0) |
127 | return 0; | 129 | return 0; |
128 | 130 | ||
129 | if (*(u32 *) (regs->nip) == *(u32 *) (&arch_kgdb_ops.gdb_bpt_instr)) | 131 | if (*(u32 *) (regs->nip) == *(u32 *) (&arch_kgdb_ops.gdb_bpt_instr)) |