diff options
author | Matthew D Fleming <mdf@FreeBSD.org> | 2011-02-18 22:25:11 +0000 |
---|---|---|
committer | Matthew D Fleming <mdf@FreeBSD.org> | 2011-02-18 22:25:11 +0000 |
commit | 3a5d36716fae934b211ab63e86cdcf98ea7618ec (patch) | |
tree | 46e277fb34fa25a6bc0562a2934616b700f3f6f8 /sys/gdb/gdb_packet.c | |
parent | 79c77d726e35146bdb1d9422fa89eeabf1212a10 (diff) | |
download | src-3a5d36716fae934b211ab63e86cdcf98ea7618ec.tar.gz src-3a5d36716fae934b211ab63e86cdcf98ea7618ec.zip |
Modify kdb_trap() so that it re-calls the dbbe_trap function as long as
the debugger back-end has changed. This means that switching from ddb
to gdb no longer requires a "step" which can be dangerous on an
already-crashed kernel.
Also add a capability to get from the gdb back-end back to ddb, by
typing ^C in the console window.
While here, simplify kdb_sysctl_available() by using
sbuf_new_for_sysctl(), and use strlcpy() instead of strncpy() since the
strlcpy semantic is desired.
MFC after: 1 month
Notes
Notes:
svn path=/head/; revision=218825
Diffstat (limited to 'sys/gdb/gdb_packet.c')
-rw-r--r-- | sys/gdb/gdb_packet.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/gdb/gdb_packet.c b/sys/gdb/gdb_packet.c index d3e5a0ab5aec..a62cc8d16b36 100644 --- a/sys/gdb/gdb_packet.c +++ b/sys/gdb/gdb_packet.c @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include <sys/systm.h> #include <sys/ctype.h> #include <sys/kdb.h> +#include <sys/ttydefaults.h> #include <machine/gdb_machdep.h> #include <machine/kdb.h> @@ -60,6 +61,17 @@ gdb_getc(void) do c = gdb_cur->gdb_getc(); while (c == -1); + + if (c == CTRL('C')) { + printf("Received ^C; trying to switch back to ddb.\n"); + + if (kdb_dbbe_select("ddb") != 0) + printf("The ddb backend could not be selected.\n"); + else { + printf("using longjmp, hope it works!\n"); + kdb_reenter(); + } + } return (c); } |