aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel/kgdb.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/kernel/kgdb.c')
-rw-r--r--arch/arm/kernel/kgdb.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/arch/arm/kernel/kgdb.c b/arch/arm/kernel/kgdb.c
index a74b53c1b7df..07db2f8a1b45 100644
--- a/arch/arm/kernel/kgdb.c
+++ b/arch/arm/kernel/kgdb.c
@@ -12,8 +12,12 @@
12#include <linux/irq.h> 12#include <linux/irq.h>
13#include <linux/kdebug.h> 13#include <linux/kdebug.h>
14#include <linux/kgdb.h> 14#include <linux/kgdb.h>
15#include <linux/uaccess.h>
16
15#include <asm/traps.h> 17#include <asm/traps.h>
16 18
19#include "patch.h"
20
17struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = 21struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] =
18{ 22{
19 { "r0", 4, offsetof(struct pt_regs, ARM_r0)}, 23 { "r0", 4, offsetof(struct pt_regs, ARM_r0)},
@@ -244,6 +248,31 @@ void kgdb_arch_exit(void)
244 unregister_die_notifier(&kgdb_notifier); 248 unregister_die_notifier(&kgdb_notifier);
245} 249}
246 250
251int kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt)
252{
253 int err;
254
255 /* patch_text() only supports int-sized breakpoints */
256 BUILD_BUG_ON(sizeof(int) != BREAK_INSTR_SIZE);
257
258 err = probe_kernel_read(bpt->saved_instr, (char *)bpt->bpt_addr,
259 BREAK_INSTR_SIZE);
260 if (err)
261 return err;
262
263 patch_text((void *)bpt->bpt_addr,
264 *(unsigned int *)arch_kgdb_ops.gdb_bpt_instr);
265
266 return err;
267}
268
269int kgdb_arch_remove_breakpoint(struct kgdb_bkpt *bpt)
270{
271 patch_text((void *)bpt->bpt_addr, *(unsigned int *)bpt->saved_instr);
272
273 return 0;
274}
275
247/* 276/*
248 * Register our undef instruction hooks with ARM undef core. 277 * Register our undef instruction hooks with ARM undef core.
249 * We regsiter a hook specifically looking for the KGB break inst 278 * We regsiter a hook specifically looking for the KGB break inst