summaryrefslogtreecommitdiff
path: root/kernel/debug/gdbstub.c
diff options
context:
space:
mode:
authorJason Wessel <jason.wessel@windriver.com>2010-05-20 21:04:24 -0500
committerJason Wessel <jason.wessel@windriver.com>2010-05-20 21:04:24 -0500
commita0de055cf61338549b13079a5677ef2e1b6472ef (patch)
tree6191bbd6b3d567350b12ad973356995dbeffeeb3 /kernel/debug/gdbstub.c
parent6d45a1aed34b0cd7b298967eb9cb72b77afcb33b (diff)
kgdb: gdb "monitor" -> kdb passthrough
One of the driving forces behind integrating another front end (kdb) to the debug core is to allow front end commands to be accessible via gdb's monitor command. It is true that you could write gdb macros to get certain data, but you may want to just use gdb to access the commands that are available in the kdb front end. This patch implements the Rcmd gdb stub packet. In gdb you access this with the "monitor" command. For instance you could type "monitor help", "monitor lsmod" or "monitor ps A" etc... There is no error checking or command restrictions on what you can and cannot access at this point. Doing something like trying to set breakpoints with the monitor command is going to cause nothing but problems. Perhaps in the future only the commands that are actually known to work with the gdb monitor command will be available. Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Diffstat (limited to 'kernel/debug/gdbstub.c')
-rw-r--r--kernel/debug/gdbstub.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/kernel/debug/gdbstub.c b/kernel/debug/gdbstub.c
index 3c000490a7d..4b17b326952 100644
--- a/kernel/debug/gdbstub.c
+++ b/kernel/debug/gdbstub.c
@@ -201,6 +201,9 @@ void gdbstub_msg_write(const char *s, int len)
int wcount;
int i;
+ if (len == 0)
+ len = strlen(s);
+
/* 'O'utput */
gdbmsgbuf[0] = 'O';
@@ -685,6 +688,25 @@ static void gdb_cmd_query(struct kgdb_state *ks)
kgdb_mem2hex(tmpstr, remcom_out_buffer, strlen(tmpstr));
}
break;
+#ifdef CONFIG_KGDB_KDB
+ case 'R':
+ if (strncmp(remcom_in_buffer, "qRcmd,", 6) == 0) {
+ int len = strlen(remcom_in_buffer + 6);
+
+ if ((len % 2) != 0) {
+ strcpy(remcom_out_buffer, "E01");
+ break;
+ }
+ kgdb_hex2mem(remcom_in_buffer + 6,
+ remcom_out_buffer, len);
+ len = len / 2;
+ remcom_out_buffer[len++] = 0;
+
+ kdb_parse(remcom_out_buffer);
+ strcpy(remcom_out_buffer, "OK");
+ }
+ break;
+#endif
}
}