diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-05-26 19:25:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-26 20:12:36 -0400 |
commit | 63ab25ebbc50f74550bd8d164a34724b498f6fb9 (patch) | |
tree | 5753779e8ba6413174ee224286eabc18c2e9c6ee /drivers | |
parent | 3cea45c6ef459b776123a4855eba6dafd506f3ce (diff) |
kgdbts: unify/generalize gdb breakpoint adjustment
The Blackfin arch, like the x86 arch, needs to adjust the PC manually
after a breakpoint is hit as normally this is handled by the remote gdb.
However, rather than starting another arch ifdef mess, create a common
GDB_ADJUSTS_BREAK_OFFSET define for any arch to opt-in via their kgdb.h.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Acked-by: Dongdong Deng <dongdong.deng@windriver.com>
Cc: Sergei Shtylyov <sshtylyov@mvista.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/misc/kgdbts.c | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/drivers/misc/kgdbts.c b/drivers/misc/kgdbts.c index 74f16f167b8e..b0c56313dbbb 100644 --- a/drivers/misc/kgdbts.c +++ b/drivers/misc/kgdbts.c | |||
@@ -285,33 +285,26 @@ static void hw_break_val_write(void) | |||
285 | static int check_and_rewind_pc(char *put_str, char *arg) | 285 | static int check_and_rewind_pc(char *put_str, char *arg) |
286 | { | 286 | { |
287 | unsigned long addr = lookup_addr(arg); | 287 | unsigned long addr = lookup_addr(arg); |
288 | unsigned long ip; | ||
288 | int offset = 0; | 289 | int offset = 0; |
289 | 290 | ||
290 | kgdb_hex2mem(&put_str[1], (char *)kgdbts_gdb_regs, | 291 | kgdb_hex2mem(&put_str[1], (char *)kgdbts_gdb_regs, |
291 | NUMREGBYTES); | 292 | NUMREGBYTES); |
292 | gdb_regs_to_pt_regs(kgdbts_gdb_regs, &kgdbts_regs); | 293 | gdb_regs_to_pt_regs(kgdbts_gdb_regs, &kgdbts_regs); |
293 | v2printk("Stopped at IP: %lx\n", instruction_pointer(&kgdbts_regs)); | 294 | ip = instruction_pointer(&kgdbts_regs); |
294 | #ifdef CONFIG_X86 | 295 | v2printk("Stopped at IP: %lx\n", ip); |
295 | /* On x86 a breakpoint stop requires it to be decremented */ | 296 | #ifdef GDB_ADJUSTS_BREAK_OFFSET |
296 | if (addr + 1 == kgdbts_regs.ip) | 297 | /* On some arches, a breakpoint stop requires it to be decremented */ |
297 | offset = -1; | 298 | if (addr + BREAK_INSTR_SIZE == ip) |
298 | #elif defined(CONFIG_SUPERH) | 299 | offset = -BREAK_INSTR_SIZE; |
299 | /* On SUPERH a breakpoint stop requires it to be decremented */ | ||
300 | if (addr + 2 == kgdbts_regs.pc) | ||
301 | offset = -2; | ||
302 | #endif | 300 | #endif |
303 | if (strcmp(arg, "silent") && | 301 | if (strcmp(arg, "silent") && ip + offset != addr) { |
304 | instruction_pointer(&kgdbts_regs) + offset != addr) { | ||
305 | eprintk("kgdbts: BP mismatch %lx expected %lx\n", | 302 | eprintk("kgdbts: BP mismatch %lx expected %lx\n", |
306 | instruction_pointer(&kgdbts_regs) + offset, addr); | 303 | ip + offset, addr); |
307 | return 1; | 304 | return 1; |
308 | } | 305 | } |
309 | #ifdef CONFIG_X86 | 306 | /* Readjust the instruction pointer if needed */ |
310 | /* On x86 adjust the instruction pointer if needed */ | 307 | instruction_pointer_set(&kgdbts_regs, ip + offset); |
311 | kgdbts_regs.ip += offset; | ||
312 | #elif defined(CONFIG_SUPERH) | ||
313 | kgdbts_regs.pc += offset; | ||
314 | #endif | ||
315 | return 0; | 308 | return 0; |
316 | } | 309 | } |
317 | 310 | ||