[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120401160332.4502.8291.stgit@shimauta>
Date: Mon, 02 Apr 2012 01:03:32 +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 07/16] kdb: Provide original instruction modified by
sw breakpoint
Add kdb_get_saved_instr() for someone who needs to know
the original instruction in kernel text.
Signed-off-by: Masami Hiramatsu <masami.hiramatsu@...il.com>
---
include/linux/kgdb.h | 1 +
kernel/debug/debug_core.c | 14 ++++++++++++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index fa39183..e1eb57c 100644
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -209,6 +209,7 @@ extern void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc);
extern int kgdb_validate_break_address(unsigned long addr);
extern int kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr);
extern int kgdb_arch_remove_breakpoint(unsigned long addr, char *bundle);
+extern int kgdb_get_saved_instr(unsigned long addr, unsigned char *buf);
/**
* kgdb_arch_late - Perform any architecture specific initalization.
diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c
index 1dc53ba..8982ba0 100644
--- a/kernel/debug/debug_core.c
+++ b/kernel/debug/debug_core.c
@@ -349,6 +349,20 @@ int kgdb_isremovedbreak(unsigned long addr)
return 0;
}
+int kgdb_get_saved_instr(unsigned long addr, unsigned char *buf)
+{
+ int i;
+ for (i = 0; i < KGDB_MAX_BREAKPOINTS; i++) {
+ if (kgdb_break[i].bpt_addr == addr &&
+ kgdb_break[i].state == BP_ACTIVE) {
+ memcpy(buf, kgdb_break[i].saved_instr,
+ BREAK_INSTR_SIZE);
+ return 1;
+ }
+ }
+ return 0;
+}
+
int dbg_remove_all_break(void)
{
unsigned long 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