From baf9dec697b13c0c3c2739e4d76b03367f062228 Mon Sep 17 00:00:00 2001 From: mdf Date: Fri, 18 Feb 2011 22:25:11 +0000 Subject: 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 --- sys/gdb/gdb_packet.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'sys/gdb/gdb_packet.c') 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 #include #include +#include #include #include @@ -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); } -- cgit v1.1