kernel - Have DDB print '?' for non-printable characters
authorMatthew Dillon <dillon@apollo.backplane.com>
Sat, 11 Dec 2010 21:21:03 +0000 (13:21 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sat, 11 Dec 2010 21:21:03 +0000 (13:21 -0800)
* When DDB prints something just use '?' for non-printable characters
  to try to avoid messing up the screen too much.

sys/ddb/db_output.c

index 81132d8..dfc7784 100644 (file)
@@ -39,6 +39,7 @@
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/cons.h>
+#include <sys/ctype.h>
 #include <sys/thread2.h>
 #include <sys/spinlock2.h>
 
@@ -107,7 +108,12 @@ db_putchar(int c, void *arg)
         * the message buffer.
         */
        if (!db_active) {
-               kprintf("%c", c);
+               if (c == '\r' || c == '\n' || c == '\t' ||
+                   isprint(c)) {
+                       kprintf("%c", c);
+               } else {
+                       kprintf("?");
+               }
                if (!db_active)
                        return;
                if (c == '\r' || c == '\n')