diff options
author | Jason Wessel <jason.wessel@windriver.com> | 2010-05-20 22:04:21 -0400 |
---|---|---|
committer | Jason Wessel <jason.wessel@windriver.com> | 2010-05-20 22:04:21 -0400 |
commit | dcc7871128e99458ca86186b7bc8bf27ff0c47b5 (patch) | |
tree | e10d252ccc4e990aac7dd09f44b94cfe045adc6b /kernel/debug/gdbstub.c | |
parent | 67fc4e0cb931d6b4ccf21248e4199b154478ecea (diff) |
kgdb: core changes to support kdb
These are the minimum changes to the kgdb core in order to enable an
API to connect a new front end (kdb) to the debug core.
This patch introduces the dbg_kdb_mode variable controls where the
user level I/O is routed. It will be routed to the gdbstub (kgdb) or
to the kdb front end which is a simple shell available over the kgdboc
connection.
You can switch back and forth between kdb or the gdb stub mode of
operation dynamically. From gdb stub mode you can blindly type
"$3#33", or from the kdb mode you can enter "kgdb" to switch to the
gdb stub.
The logic in the debug core depends on kdb to look for the typical gdb
connection sequences and return immediately with KGDB_PASS_EVENT if a
gdb serial command sequence is detected. That should allow a
reasonably seamless transition between kdb -> gdb without leaving the
kernel exception state. The two gdb serial queries that kdb is
responsible for detecting are the "?" and "qSupported" packets.
CC: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Acked-by: Martin Hicks <mort@sgi.com>
Diffstat (limited to 'kernel/debug/gdbstub.c')
-rw-r--r-- | kernel/debug/gdbstub.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/kernel/debug/gdbstub.c b/kernel/debug/gdbstub.c index ccdf0929f12d..188203a19657 100644 --- a/kernel/debug/gdbstub.c +++ b/kernel/debug/gdbstub.c | |||
@@ -887,6 +887,13 @@ int gdb_serial_stub(struct kgdb_state *ks) | |||
887 | case 'Z': /* Break point set */ | 887 | case 'Z': /* Break point set */ |
888 | gdb_cmd_break(ks); | 888 | gdb_cmd_break(ks); |
889 | break; | 889 | break; |
890 | #ifdef CONFIG_KGDB_KDB | ||
891 | case '3': /* Escape into back into kdb */ | ||
892 | if (remcom_in_buffer[1] == '\0') { | ||
893 | gdb_cmd_detachkill(ks); | ||
894 | return DBG_PASS_EVENT; | ||
895 | } | ||
896 | #endif | ||
890 | case 'C': /* Exception passing */ | 897 | case 'C': /* Exception passing */ |
891 | tmp = gdb_cmd_exception_pass(ks); | 898 | tmp = gdb_cmd_exception_pass(ks); |
892 | if (tmp > 0) | 899 | if (tmp > 0) |
@@ -932,3 +939,32 @@ kgdb_exit: | |||
932 | error = 1; | 939 | error = 1; |
933 | return error; | 940 | return error; |
934 | } | 941 | } |
942 | |||
943 | int gdbstub_state(struct kgdb_state *ks, char *cmd) | ||
944 | { | ||
945 | int error; | ||
946 | |||
947 | switch (cmd[0]) { | ||
948 | case 'e': | ||
949 | error = kgdb_arch_handle_exception(ks->ex_vector, | ||
950 | ks->signo, | ||
951 | ks->err_code, | ||
952 | remcom_in_buffer, | ||
953 | remcom_out_buffer, | ||
954 | ks->linux_regs); | ||
955 | return error; | ||
956 | case 's': | ||
957 | case 'c': | ||
958 | strcpy(remcom_in_buffer, cmd); | ||
959 | return 0; | ||
960 | case '?': | ||
961 | gdb_cmd_status(ks); | ||
962 | break; | ||
963 | case '\0': | ||
964 | strcpy(remcom_out_buffer, ""); | ||
965 | break; | ||
966 | } | ||
967 | dbg_io_ops->write_char('+'); | ||
968 | put_packet(remcom_out_buffer); | ||
969 | return 0; | ||
970 | } | ||