aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJason Wessel <jason.wessel@windriver.com>2010-05-20 22:04:21 -0400
committerJason Wessel <jason.wessel@windriver.com>2010-05-20 22:04:21 -0400
commitdcc7871128e99458ca86186b7bc8bf27ff0c47b5 (patch)
treee10d252ccc4e990aac7dd09f44b94cfe045adc6b /arch
parent67fc4e0cb931d6b4ccf21248e4199b154478ecea (diff)
kgdb: core changes to support kdb
These are the minimum changes to the kgdb core in order to enable an API to connect a new front end (kdb) to the debug core. This patch introduces the dbg_kdb_mode variable controls where the user level I/O is routed. It will be routed to the gdbstub (kgdb) or to the kdb front end which is a simple shell available over the kgdboc connection. You can switch back and forth between kdb or the gdb stub mode of operation dynamically. From gdb stub mode you can blindly type "$3#33", or from the kdb mode you can enter "kgdb" to switch to the gdb stub. The logic in the debug core depends on kdb to look for the typical gdb connection sequences and return immediately with KGDB_PASS_EVENT if a gdb serial command sequence is detected. That should allow a reasonably seamless transition between kdb -> gdb without leaving the kernel exception state. The two gdb serial queries that kdb is responsible for detecting are the "?" and "qSupported" packets. CC: Ingo Molnar <mingo@elte.hu> Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Acked-by: Martin Hicks <mort@sgi.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/kernel/kgdb.c5
-rw-r--r--arch/mips/kernel/kgdb.c5
-rw-r--r--arch/powerpc/kernel/kgdb.c5
-rw-r--r--arch/x86/kernel/kgdb.c5
4 files changed, 20 insertions, 0 deletions
diff --git a/arch/arm/kernel/kgdb.c b/arch/arm/kernel/kgdb.c
index a5b846b9895d..c868a8864117 100644
--- a/arch/arm/kernel/kgdb.c
+++ b/arch/arm/kernel/kgdb.c
@@ -98,6 +98,11 @@ sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *task)
98 gdb_regs[_CPSR] = thread_regs->ARM_cpsr; 98 gdb_regs[_CPSR] = thread_regs->ARM_cpsr;
99} 99}
100 100
101void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc)
102{
103 regs->ARM_pc = pc;
104}
105
101static int compiled_break; 106static int compiled_break;
102 107
103int kgdb_arch_handle_exception(int exception_vector, int signo, 108int kgdb_arch_handle_exception(int exception_vector, int signo,
diff --git a/arch/mips/kernel/kgdb.c b/arch/mips/kernel/kgdb.c
index 50c9bb880667..6ed4c83c869b 100644
--- a/arch/mips/kernel/kgdb.c
+++ b/arch/mips/kernel/kgdb.c
@@ -180,6 +180,11 @@ void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
180 *(ptr++) = regs->cp0_epc; 180 *(ptr++) = regs->cp0_epc;
181} 181}
182 182
183void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc)
184{
185 regs->cp0_epc = pc;
186}
187
183/* 188/*
184 * Calls linux_debug_hook before the kernel dies. If KGDB is enabled, 189 * Calls linux_debug_hook before the kernel dies. If KGDB is enabled,
185 * then try to fall into the debugger 190 * then try to fall into the debugger
diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
index 41bada0298c8..c81e3de1306e 100644
--- a/arch/powerpc/kernel/kgdb.c
+++ b/arch/powerpc/kernel/kgdb.c
@@ -309,6 +309,11 @@ void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
309 (unsigned long)(((void *)gdb_regs) + NUMREGBYTES)); 309 (unsigned long)(((void *)gdb_regs) + NUMREGBYTES));
310} 310}
311 311
312void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc)
313{
314 regs->nip = pc;
315}
316
312/* 317/*
313 * This function does PowerPC specific procesing for interfacing to gdb. 318 * This function does PowerPC specific procesing for interfacing to gdb.
314 */ 319 */
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c
index b2258ca91003..f95a2c0b915c 100644
--- a/arch/x86/kernel/kgdb.c
+++ b/arch/x86/kernel/kgdb.c
@@ -690,6 +690,11 @@ unsigned long kgdb_arch_pc(int exception, struct pt_regs *regs)
690 return instruction_pointer(regs); 690 return instruction_pointer(regs);
691} 691}
692 692
693void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long ip)
694{
695 regs->ip = ip;
696}
697
693struct kgdb_arch arch_kgdb_ops = { 698struct kgdb_arch arch_kgdb_ops = {
694 /* Breakpoint instruction: */ 699 /* Breakpoint instruction: */
695 .gdb_bpt_instr = { 0xcc }, 700 .gdb_bpt_instr = { 0xcc },