diff options
Diffstat (limited to 'drivers/misc')
-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 | ||