Messages in this thread Patch in this message | | | Subject | [RFC PATCH -tip 08/16] x86/kprobes: Recover breakpoint instruction if KGDB knows | From | Masami Hiramatsu <> | Date | Mon, 02 Apr 2012 01:03:41 +0900 |
| |
Recover a breakpoint instruction which KGDB has put.
Signed-off-by: Masami Hiramatsu <masami.hiramatsu@gmail.com> --- arch/x86/kernel/kprobes.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c index e213fc8..ddd21b8 100644 --- a/arch/x86/kernel/kprobes.c +++ b/arch/x86/kernel/kprobes.c @@ -49,6 +49,7 @@ #include <linux/kdebug.h> #include <linux/kallsyms.h> #include <linux/ftrace.h> +#include <linux/kgdb.h> #include <asm/cacheflush.h> #include <asm/desc.h> @@ -252,6 +253,14 @@ unsigned long recover_probed_instruction(kprobe_opcode_t *buf, unsigned long add { unsigned long __addr; +#ifdef CONFIG_KGDB + /* Recover if kgdb has put a breakpoint */ + if (kgdb_get_saved_instr(addr, buf)) { + memcpy(buf + BREAK_INSTR_SIZE, (void *)addr + BREAK_INSTR_SIZE, + (MAX_INSN_SIZE - BREAK_INSTR_SIZE) * sizeof(kprobe_opcode_t)); + return (unsigned long)buf; + } +#endif __addr = __recover_optprobed_insn(buf, addr); if (__addr != addr) return __addr;
| |