Skip to content

Commit 489022c

Browse files
committed
kgdb,sh: update superh kgdb exception handling
Implement kgdb_arch_pc() which adjusts the pc if it needs to be adjusted after a software breakpoint trap. Implement kgdb_arch_set_pc() which is a new required function in the kgdb debug core. When processing a single step return zero in the error exception field so that the debug core can distinguish between a single step trap and a breakpoint trap generically. Signed-off-by: Jason Wessel <[email protected]> Acked-by: Paul Mundt <[email protected]>
1 parent c75fbb0 commit 489022c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

arch/sh/kernel/kgdb.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,18 @@ int kgdb_arch_handle_exception(int e_vector, int signo, int err_code,
237237
return -1;
238238
}
239239

240+
unsigned long kgdb_arch_pc(int exception, struct pt_regs *regs)
241+
{
242+
if (exception == 60)
243+
return instruction_pointer(regs) - 2;
244+
return instruction_pointer(regs);
245+
}
246+
247+
void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long ip)
248+
{
249+
regs->pc = ip;
250+
}
251+
240252
/*
241253
* The primary entry points for the kgdb debug trap table entries.
242254
*/
@@ -247,7 +259,7 @@ BUILD_TRAP_HANDLER(singlestep)
247259

248260
local_irq_save(flags);
249261
regs->pc -= instruction_size(__raw_readw(regs->pc - 4));
250-
kgdb_handle_exception(vec >> 2, SIGTRAP, 0, regs);
262+
kgdb_handle_exception(0, SIGTRAP, 0, regs);
251263
local_irq_restore(flags);
252264
}
253265

0 commit comments

Comments
 (0)