diff options
author | mdf <mdf@FreeBSD.org> | 2011-02-18 22:25:11 +0000 |
---|---|---|
committer | mdf <mdf@FreeBSD.org> | 2011-02-18 22:25:11 +0000 |
commit | baf9dec697b13c0c3c2739e4d76b03367f062228 (patch) | |
tree | 46e277fb34fa25a6bc0562a2934616b700f3f6f8 /sys/gdb/gdb_packet.c | |
parent | 699ef3129bdda98a0a0164e4d221a0273dfc24d8 (diff) | |
download | FreeBSD-src-baf9dec697b13c0c3c2739e4d76b03367f062228.zip FreeBSD-src-baf9dec697b13c0c3c2739e4d76b03367f062228.tar.gz |
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
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 d3e5a0a..a62cc8d 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); } |