summaryrefslogtreecommitdiffstats
path: root/sys/gdb/gdb_main.c
diff options
context:
space:
mode:
authormdf <mdf@FreeBSD.org>2011-02-18 22:25:11 +0000
committermdf <mdf@FreeBSD.org>2011-02-18 22:25:11 +0000
commitbaf9dec697b13c0c3c2739e4d76b03367f062228 (patch)
tree46e277fb34fa25a6bc0562a2934616b700f3f6f8 /sys/gdb/gdb_main.c
parent699ef3129bdda98a0a0164e4d221a0273dfc24d8 (diff)
downloadFreeBSD-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_main.c')
-rw-r--r--sys/gdb/gdb_main.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/gdb/gdb_main.c b/sys/gdb/gdb_main.c
index 233330e..8f3c271 100644
--- a/sys/gdb/gdb_main.c
+++ b/sys/gdb/gdb_main.c
@@ -95,7 +95,17 @@ gdb_init(void)
static int
gdb_trap(int type, int code)
{
+ jmp_buf jb;
struct thread *thr_iter;
+ void *prev_jb;
+
+ prev_jb = kdb_jmpbuf(jb);
+ if (setjmp(jb) != 0) {
+ printf("%s bailing, hopefully back to ddb!\n", __func__);
+ gdb_listening = 0;
+ (void)kdb_jmpbuf(prev_jb);
+ return (1);
+ }
gdb_listening = 0;
/*
@@ -291,5 +301,6 @@ gdb_trap(int type, int code)
break;
}
}
+ (void)kdb_jmpbuf(prev_jb);
return (0);
}
OpenPOWER on IntegriCloud