diff options
author | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2005-11-13 17:50:46 +0000 |
---|---|---|
committer | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2005-11-13 17:50:46 +0000 |
commit | ac3032870b4893e133da625a13872a42dd2be14d (patch) | |
tree | 36666bbd4d862ebfa842f3ab1c7f8ddc1f451d71 /sys/kern | |
parent | 56fd7dfee4de7122306fde7e9dc0075dee5e3dae (diff) |
move kgdb_connect and kgdb_panic into MI. looked by miod@ and kettenis@
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kgdb_stub.c | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/sys/kern/kgdb_stub.c b/sys/kern/kgdb_stub.c index b3604211ba1..290d78c6366 100644 --- a/sys/kern/kgdb_stub.c +++ b/sys/kern/kgdb_stub.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kgdb_stub.c,v 1.6 2003/06/02 23:28:06 millert Exp $ */ +/* $OpenBSD: kgdb_stub.c,v 1.7 2005/11/13 17:50:45 fgsch Exp $ */ /* $NetBSD: kgdb_stub.c,v 1.6 1998/08/30 20:30:57 scottr Exp $ */ /* @@ -403,7 +403,8 @@ kgdb_trap(type, regs) * knowing if we're in or out of this loop * when he issues a "remote-signal". */ - snprintf(buffer, sizeof buffer, "S%02x", kgdb_signal(type)); + snprintf(buffer, sizeof buffer, "S%02x", + kgdb_signal(type)); kgdb_send(buffer); continue; @@ -521,3 +522,39 @@ kgdb_trap(type, regs) kgdb_recover = 0; return (1); } + +/* + * Trap into kgdb to wait for debugger to connect, + * noting on the console why nothing else is going on. + */ +void +kgdb_connect(int verbose) +{ + if (kgdb_dev < 0) + return; + + KGDB_PREPARE; + + if (verbose) + printf("kgdb waiting..."); + + KGDB_ENTER; + + if (verbose) + printf("connected.\n"); + + kgdb_debug_panic = 1; +} + +/* + * Decide what to do on panic. + * (This is called by panic, like Debugger()) + */ +void +kgdb_panic() +{ + if (kgdb_dev >= 0 && kgdb_debug_panic) { + printf("entering kgdb\n"); + kgdb_connect(kgdb_active == 0); + } +} |