If xconsole is running (or xterm -C), if ddb is entered, the kernel printf output will be queued for xconsole to print out, however if one is on the text VT, it output appears to be missing.
This stores the fact that we have entered ddb and in that case it acts as if xconsole is not running. however output continues to go to xconsole if the user is able to return from ddb. Index: ddb/db_trap.c =================================================================== RCS file: /cvs/src/sys/ddb/db_trap.c,v retrieving revision 1.15 diff -u -p -r1.15 db_trap.c --- ddb/db_trap.c 27 Nov 2010 19:57:23 -0000 1.15 +++ ddb/db_trap.c 3 Apr 2011 14:10:49 -0000 @@ -48,6 +48,7 @@ #include <ddb/db_sym.h> #include <ddb/db_extern.h> #include <ddb/db_interface.h> +#include <ddb/db_var.h> void db_trap(int type, int code) @@ -55,6 +56,7 @@ db_trap(int type, int code) boolean_t bkpt; boolean_t watchpt; + db_is_active = 1; bkpt = IS_BREAKPOINT_TRAP(type, code); watchpt = IS_WATCHPOINT_TRAP(type, code); @@ -97,4 +99,5 @@ db_trap(int type, int code) } db_restart_at_pc(DDB_REGS, watchpt); + db_is_active = 0; } Index: ddb/db_var.h =================================================================== RCS file: /cvs/src/sys/ddb/db_var.h,v retrieving revision 1.10 diff -u -p -r1.10 db_var.h --- ddb/db_var.h 8 Nov 2008 01:14:51 -0000 1.10 +++ ddb/db_var.h 3 Apr 2011 14:11:27 -0000 @@ -65,10 +65,10 @@ extern int db_max_line; extern int db_panic; extern int db_console; extern int db_log; +extern int db_is_active; int ddb_sysctl(int *, u_int, void *, size_t *, void *, size_t, struct proc *); #endif #endif /* _DDB_DB_VAR_H_ */ - Index: kern/subr_prf.c =================================================================== RCS file: /cvs/src/sys/kern/subr_prf.c,v retrieving revision 1.75 diff -u -p -r1.75 subr_prf.c --- kern/subr_prf.c 26 Jul 2010 01:56:27 -0000 1.75 +++ kern/subr_prf.c 3 Apr 2011 14:09:23 -0000 @@ -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 *t 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) Dale Rahn dr...@dalerahn.com