aboutsummaryrefslogtreecommitdiff
path: root/kernel/debug/gdbstub.c
diff options
context:
space:
mode:
authorJason Wessel <jason.wessel@windriver.com>2010-08-05 09:22:20 -0500
committerJason Wessel <jason.wessel@windriver.com>2010-08-05 09:22:20 -0500
commit534af1082329392bc29f6badf815e69ae2ae0f4c (patch)
treee163c1d5c418334538447983b7d5934e05fa4d71 /kernel/debug/gdbstub.c
parent84a0bd5b2830722cf80ff6ad33ef98101a947e14 (diff)
kgdb,kdb: individual register set and and get API
The kdb shell specification includes the ability to get and set architecture specific registers by name. For the time being individual register get and set will be implemented on a per architecture basis. If an architecture defines DBG_MAX_REG_NUM > 0 then kdb and the gdbstub will use the capability for individually getting and setting architecture specific registers. Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Diffstat (limited to 'kernel/debug/gdbstub.c')
-rw-r--r--kernel/debug/gdbstub.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/kernel/debug/gdbstub.c b/kernel/debug/gdbstub.c
index e117cfd7588..006bad8905d 100644
--- a/kernel/debug/gdbstub.c
+++ b/kernel/debug/gdbstub.c
@@ -328,6 +328,32 @@ static int kgdb_ebin2mem(char *buf, char *mem, int count)
return probe_kernel_write(mem, c, size);
}
+#if DBG_MAX_REG_NUM > 0
+void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
+{
+ int i;
+ int idx = 0;
+ char *ptr = (char *)gdb_regs;
+
+ for (i = 0; i < DBG_MAX_REG_NUM; i++) {
+ dbg_get_reg(i, ptr + idx, regs);
+ idx += dbg_reg_def[i].size;
+ }
+}
+
+void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
+{
+ int i;
+ int idx = 0;
+ char *ptr = (char *)gdb_regs;
+
+ for (i = 0; i < DBG_MAX_REG_NUM; i++) {
+ dbg_set_reg(i, ptr + idx, regs);
+ idx += dbg_reg_def[i].size;
+ }
+}
+#endif /* DBG_MAX_REG_NUM > 0 */
+
/* Write memory due to an 'M' or 'X' packet. */
static int write_mem_msg(int binary)
{