The patch titled kgdbts: unify/generalize gdb breakpoint adjustment has been added to the -mm tree. Its filename is kgdbts-unify-generalize-gdb-breakpoint-adjustment.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: kgdbts: unify/generalize gdb breakpoint adjustment From: Mike Frysinger <vapier@xxxxxxxxxx> 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@xxxxxxxxxx> Cc: Oleg Nesterov <oleg@xxxxxxxxxx> Cc: Jason Wessel <jason.wessel@xxxxxxxxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxxxxx> Cc: "H. Peter Anvin" <hpa@xxxxxxxxx> Acked-by: Paul Mundt <lethal@xxxxxxxxxxxx> Acked-by: Dongdong Deng <dongdong.deng@xxxxxxxxxxxxx> Cc: Sergei Shtylyov <sshtylyov@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- arch/blackfin/include/asm/kgdb.h | 1 + arch/sh/include/asm/kgdb.h | 1 + arch/x86/include/asm/kgdb.h | 1 + drivers/misc/kgdbts.c | 29 +++++++++++------------------ 4 files changed, 14 insertions(+), 18 deletions(-) diff -puN arch/blackfin/include/asm/kgdb.h~kgdbts-unify-generalize-gdb-breakpoint-adjustment arch/blackfin/include/asm/kgdb.h --- a/arch/blackfin/include/asm/kgdb.h~kgdbts-unify-generalize-gdb-breakpoint-adjustment +++ a/arch/blackfin/include/asm/kgdb.h @@ -108,6 +108,7 @@ static inline void arch_kgdb_breakpoint( #else # define CACHE_FLUSH_IS_SAFE 1 #endif +#define GDB_ADJUSTS_BREAK_OFFSET #define HW_INST_WATCHPOINT_NUM 6 #define HW_WATCHPOINT_NUM 8 #define TYPE_INST_WATCHPOINT 0 diff -puN arch/sh/include/asm/kgdb.h~kgdbts-unify-generalize-gdb-breakpoint-adjustment arch/sh/include/asm/kgdb.h --- a/arch/sh/include/asm/kgdb.h~kgdbts-unify-generalize-gdb-breakpoint-adjustment +++ a/arch/sh/include/asm/kgdb.h @@ -34,5 +34,6 @@ static inline void arch_kgdb_breakpoint( #define CACHE_FLUSH_IS_SAFE 1 #define BREAK_INSTR_SIZE 2 +#define GDB_ADJUSTS_BREAK_OFFSET #endif /* __ASM_SH_KGDB_H */ diff -puN arch/x86/include/asm/kgdb.h~kgdbts-unify-generalize-gdb-breakpoint-adjustment arch/x86/include/asm/kgdb.h --- a/arch/x86/include/asm/kgdb.h~kgdbts-unify-generalize-gdb-breakpoint-adjustment +++ a/arch/x86/include/asm/kgdb.h @@ -77,6 +77,7 @@ static inline void arch_kgdb_breakpoint( } #define BREAK_INSTR_SIZE 1 #define CACHE_FLUSH_IS_SAFE 1 +#define GDB_ADJUSTS_BREAK_OFFSET extern int kgdb_ll_trap(int cmd, const char *str, struct pt_regs *regs, long err, int trap, int sig); diff -puN drivers/misc/kgdbts.c~kgdbts-unify-generalize-gdb-breakpoint-adjustment drivers/misc/kgdbts.c --- a/drivers/misc/kgdbts.c~kgdbts-unify-generalize-gdb-breakpoint-adjustment +++ a/drivers/misc/kgdbts.c @@ -285,33 +285,26 @@ static void hw_break_val_write(void) static int check_and_rewind_pc(char *put_str, char *arg) { unsigned long addr = lookup_addr(arg); + unsigned long ip; int offset = 0; kgdb_hex2mem(&put_str[1], (char *)kgdbts_gdb_regs, NUMREGBYTES); gdb_regs_to_pt_regs(kgdbts_gdb_regs, &kgdbts_regs); - v2printk("Stopped at IP: %lx\n", instruction_pointer(&kgdbts_regs)); -#ifdef CONFIG_X86 - /* On x86 a breakpoint stop requires it to be decremented */ - if (addr + 1 == kgdbts_regs.ip) - offset = -1; -#elif defined(CONFIG_SUPERH) - /* On SUPERH a breakpoint stop requires it to be decremented */ - if (addr + 2 == kgdbts_regs.pc) - offset = -2; + ip = instruction_pointer(&kgdbts_regs); + v2printk("Stopped at IP: %lx\n", ip); +#ifdef GDB_ADJUSTS_BREAK_OFFSET + /* On some arches, a breakpoint stop requires it to be decremented */ + if (addr + BREAK_INSTR_SIZE == ip) + offset = -BREAK_INSTR_SIZE; #endif - if (strcmp(arg, "silent") && - instruction_pointer(&kgdbts_regs) + offset != addr) { + if (strcmp(arg, "silent") && ip + offset != addr) { eprintk("kgdbts: BP mismatch %lx expected %lx\n", - instruction_pointer(&kgdbts_regs) + offset, addr); + ip + offset, addr); return 1; } -#ifdef CONFIG_X86 - /* On x86 adjust the instruction pointer if needed */ - kgdbts_regs.ip += offset; -#elif defined(CONFIG_SUPERH) - kgdbts_regs.pc += offset; -#endif + /* Readjust the instruction pointer if needed */ + instruction_pointer_set(&kgdbts_regs, ip + offset); return 0; } _ Patches currently in -mm which might be from vapier@xxxxxxxxxx are backlight-new-driver-for-the-adp8870-backlight-devices.patch linux-next.patch net-irda-convert-bfin_sir-to-common-blackfin-uart-header.patch backlight-add-backlight-type-fix.patch backlight-add-backlight-type-fix-fix.patch asm-generic-ptraceh-start-a-common-low-level-ptrace-helper.patch blackfin-convert-to-asm-generic-ptraceh.patch x86-convert-to-asm-generic-ptraceh.patch sh-convert-to-asm-generic-ptraceh.patch kgdbts-unify-generalize-gdb-breakpoint-adjustment.patch proc-constify-status-array.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html