[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120401160341.4502.28323.stgit@shimauta>
Date: Mon, 02 Apr 2012 01:03:41 +0900
From: Masami Hiramatsu <masami.hiramatsu@...il.com>
To: linux-kernel@...r.kernel.org
Cc: Huang Ying <ying.huang@...el.com>,
Ananth N Mavinakayanahalli <ananth@...ibm.com>,
Frederic Weisbecker <fweisbec@...il.com>,
"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
Jason Wessel <jason.wessel@...driver.com>,
Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: [RFC PATCH -tip 08/16] x86/kprobes: Recover breakpoint instruction if
KGDB knows
Recover a breakpoint instruction which KGDB has put.
Signed-off-by: Masami Hiramatsu <masami.hiramatsu@...il.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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists