diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2011-04-03 16:46:20 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2011-04-03 16:46:20 +0000 |
commit | b6940314d6366671b87422f51857ee576975d151 (patch) | |
tree | d7f8d83c895522ea3bb23cb0168d4a30f0f5544e /sys/kern/subr_prf.c | |
parent | 7c7725bd092134301df528c00b4a45f5c652622e (diff) |
Allow kernel printfs to go to console if in ddb instead of being redirected
to xconsole. ok deraadt@ guenther@
Diffstat (limited to 'sys/kern/subr_prf.c')
-rw-r--r-- | sys/kern/subr_prf.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index 30e7dcef6be..7459266b1b3 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_prf.c,v 1.75 2010/07/26 01:56:27 guenther Exp $ */ +/* $OpenBSD: subr_prf.c,v 1.76 2011/04/03 16:46:19 drahn Exp $ */ /* $NetBSD: subr_prf.c,v 1.45 1997/10/24 18:14:25 chuck Exp $ */ /*- @@ -123,6 +123,11 @@ int db_console = 1; #else int db_console = 0; #endif + +/* + * flag to indicate if we are currently in ddb (on some processor) + */ +int db_is_active; #endif /* @@ -324,10 +329,16 @@ void kputchar(int c, int flags, struct tty *tp) { extern int msgbufmapped; + int ddb_active = 0; + +#ifdef DDB + ddb_active = db_is_active; +#endif if (panicstr) constty = NULL; - if ((flags & TOCONS) && tp == NULL && constty) { + + if ((flags & TOCONS) && tp == NULL && constty && !ddb_active) { tp = constty; flags |= TOTTY; } @@ -337,7 +348,7 @@ kputchar(int c, int flags, struct tty *tp) if ((flags & TOLOG) && c != '\0' && c != '\r' && c != 0177 && msgbufmapped) msgbuf_putchar(c); - if ((flags & TOCONS) && constty == NULL && c != '\0') + if ((flags & TOCONS) && (constty == NULL || ddb_active) && c != '\0') (*v_putc)(c); #ifdef DDB if (flags & TODDB) |