Module Name:    src
Committed By:   martin
Date:           Sun Jan 26 11:23:41 UTC 2020

Modified Files:
        src/sys/ddb [netbsd-9]: db_output.c

Log Message:
Pull up following revision(s) (requested by uwe in ticket #654):

        sys/ddb/db_output.c: revision 1.35
        sys/ddb/db_output.c: revision 1.36

db_putchar - check if we need to wrap at $maxwidth after whitespace.

That fixes orphaned first character in something like:
    |Stopped in ... longsymbol+0xf00:  |
    |i
    |nsn

Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.34.4.1 src/sys/ddb/db_output.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/ddb/db_output.c
diff -u src/sys/ddb/db_output.c:1.34 src/sys/ddb/db_output.c:1.34.4.1
--- src/sys/ddb/db_output.c:1.34	Sun Sep 16 23:18:55 2018
+++ src/sys/ddb/db_output.c	Sun Jan 26 11:23:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_output.c,v 1.34 2018/09/16 23:18:55 mrg Exp $	*/
+/*	$NetBSD: db_output.c,v 1.34.4.1 2020/01/26 11:23:41 martin Exp $	*/
 
 /*
  * Mach Operating System
@@ -35,7 +35,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_output.c,v 1.34 2018/09/16 23:18:55 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_output.c,v 1.34.4.1 2020/01/26 11:23:41 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -103,6 +103,24 @@ db_force_whitespace(void)
 	db_last_non_space = db_output_position;
 }
 
+
+/*
+ * End the current line if it exceeds $maxwidth
+ */
+static void
+db_check_wrap(void)
+{
+
+	if (db_max_width >= DB_MIN_MAX_WIDTH
+	    && db_output_position >= db_max_width) {
+		cnputc('\n');
+		db_output_position = 0;
+		db_last_non_space = 0;
+		db_output_line++;
+	}
+}
+
+
 static void
 db_more(void)
 {
@@ -148,16 +166,10 @@ db_putchar(int c)
 		 * Use tabs if possible.
 		 */
 		db_force_whitespace();
+		db_check_wrap();
 		cnputc(c);
 		db_output_position++;
-		if (db_max_width >= DB_MIN_MAX_WIDTH
-		    && db_output_position >= db_max_width) {
-			/* auto new line */
-			cnputc('\n');
-			db_output_position = 0;
-			db_last_non_space = 0;
-			db_output_line++;
-		}
+		db_check_wrap();
 		db_last_non_space = db_output_position;
 	} else if (c == '\n') {
 		/* Return */

Reply via email to