CVS commit: [netbsd-9] src/sys/ddb

2020-03-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  1 12:45:09 UTC 2020

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

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #746):

sys/ddb/db_lex.c: revision 1.25

Fix crash(8).  Will revisit.


To generate a diff of this commit:
cvs rdiff -u -r1.22.60.1 -r1.22.60.2 src/sys/ddb/db_lex.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_lex.c
diff -u src/sys/ddb/db_lex.c:1.22.60.1 src/sys/ddb/db_lex.c:1.22.60.2
--- src/sys/ddb/db_lex.c:1.22.60.1	Sun Jan 26 11:25:22 2020
+++ src/sys/ddb/db_lex.c	Sun Mar  1 12:45:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_lex.c,v 1.22.60.1 2020/01/26 11:25:22 martin Exp $	*/
+/*	$NetBSD: db_lex.c,v 1.22.60.2 2020/03/01 12:45:09 martin Exp $	*/
 
 /*
  * Mach Operating System
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_lex.c,v 1.22.60.1 2020/01/26 11:25:22 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_lex.c,v 1.22.60.2 2020/03/01 12:45:09 martin Exp $");
 
 #include 
 #include 
@@ -62,11 +62,18 @@ db_read_line(void)
 {
 	int	i;
 
+#ifdef _KERNEL
+	/*
+	 * crash(8) prints the prompt using libedit.  That's why we used to
+	 * print it in db_readline().  But now people are using db_read_line()
+	 * for general purpose input, so..
+	 */
 #ifdef MULTIPROCESSOR
 	db_printf("db{%ld}> ", (long)cpu_number());
 #else
 	db_printf("db> ");
 #endif
+#endif
 	i = db_readline(db_line, sizeof(db_line));
 	if (i == 0)
 		return (0);	/* EOI */



CVS commit: [netbsd-9] src/sys/ddb

2020-03-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  1 12:45:09 UTC 2020

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

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #746):

sys/ddb/db_lex.c: revision 1.25

Fix crash(8).  Will revisit.


To generate a diff of this commit:
cvs rdiff -u -r1.22.60.1 -r1.22.60.2 src/sys/ddb/db_lex.c

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



CVS commit: [netbsd-9] src/sys/ddb

2020-01-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jan 26 11:28:11 UTC 2020

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

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

sys/ddb/db_command.c: revision 1.162
sys/ddb/db_command.c: revision 1.163
sys/ddb/db_command.c: revision 1.164

db_command - make sure count is always initialized.
db_command - make setting have_addr more clear.
Don't set it to false that it's already initialized to.
db_command - don't hide local static variable in the middle of other
local variable definitions.  While here, get rid of the alignment of
variable names.


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.160.4.1 src/sys/ddb/db_command.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_command.c
diff -u src/sys/ddb/db_command.c:1.160 src/sys/ddb/db_command.c:1.160.4.1
--- src/sys/ddb/db_command.c:1.160	Mon Sep 17 01:49:54 2018
+++ src/sys/ddb/db_command.c	Sun Jan 26 11:28:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_command.c,v 1.160 2018/09/17 01:49:54 kre Exp $	*/
+/*	$NetBSD: db_command.c,v 1.160.4.1 2020/01/26 11:28:11 martin Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2009 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.160 2018/09/17 01:49:54 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.160.4.1 2020/01/26 11:28:11 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_aio.h"
@@ -820,16 +820,18 @@ db_read_command(void)
 static void
 db_command(const struct db_command **last_cmdp)
 {
-	const struct db_command *command;
 	static db_expr_t last_count = 0;
-	db_expr_t	addr, count;
-	char		modif[TOK_STRING_SIZE];
-	
-	int			t;
-	bool		have_addr = false;
+
+	int t;
+	const struct db_command *command;
+	db_expr_t addr, count;
+	bool have_addr;
+	char modif[TOK_STRING_SIZE];
 
 	command = NULL;
-	
+	have_addr = false;
+	count = -1;
+
 	t = db_read_token();
 	if ((t == tEOL) || (t == tCOMMA)) {
 		/*
@@ -850,7 +852,6 @@ db_command(const struct db_command **las
 			}
 		} else
 			count = last_count;
-		have_addr = false;
 		modif[0] = '\0';
 		db_skip_to_eol();
 
@@ -897,7 +898,6 @@ db_command(const struct db_command **las
 have_addr = true;
 			} else {
 addr = (db_expr_t) db_dot;
-have_addr = false;
 			}
 
 			t = db_read_token();
@@ -909,7 +909,6 @@ db_command(const struct db_command **las
 }
 			} else {
 db_unread_token(t);
-count = -1;
 			}
 			if ((command->flag & CS_MORE) == 0) {
 db_skip_to_eol();



CVS commit: [netbsd-9] src/sys/ddb

2020-01-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jan 26 11:28:11 UTC 2020

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

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

sys/ddb/db_command.c: revision 1.162
sys/ddb/db_command.c: revision 1.163
sys/ddb/db_command.c: revision 1.164

db_command - make sure count is always initialized.
db_command - make setting have_addr more clear.
Don't set it to false that it's already initialized to.
db_command - don't hide local static variable in the middle of other
local variable definitions.  While here, get rid of the alignment of
variable names.


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.160.4.1 src/sys/ddb/db_command.c

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



CVS commit: [netbsd-9] src/sys/ddb

2020-01-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jan 26 11:25:22 UTC 2020

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

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

sys/ddb/db_input.c: revision 1.27
sys/ddb/db_lex.c: revision 1.23

Print db> prompt in db_read_line(), not db_readline().
The former is what DDB repl calls.  The latter performs the actual
input so let other code use it without the unwanted db> prompt.  It's
already used by ACPI (and AcpiOsWaitCommandReady supplies its own
prompt).  I also use it for my uncommitted Forth scripting for DDB.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.26.64.1 src/sys/ddb/db_input.c
cvs rdiff -u -r1.22 -r1.22.60.1 src/sys/ddb/db_lex.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_input.c
diff -u src/sys/ddb/db_input.c:1.26 src/sys/ddb/db_input.c:1.26.64.1
--- src/sys/ddb/db_input.c:1.26	Tue Aug 31 07:48:23 2010
+++ src/sys/ddb/db_input.c	Sun Jan 26 11:25:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_input.c,v 1.26 2010/08/31 07:48:23 enami Exp $	*/
+/*	$NetBSD: db_input.c,v 1.26.64.1 2020/01/26 11:25:22 martin Exp $	*/
 
 /*
  * Mach Operating System
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_input.c,v 1.26 2010/08/31 07:48:23 enami Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_input.c,v 1.26.64.1 2020/01/26 11:25:22 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddbparam.h"
@@ -38,7 +38,6 @@ __KERNEL_RCSID(0, "$NetBSD: db_input.c,v
 
 #include 
 #include 
-#include 
 
 #include 
 
@@ -352,11 +351,6 @@ int
 db_readline(char *lstart, int lsize)
 {
 
-# ifdef MULTIPROCESSOR
-	db_printf("db{%ld}> ", (long)cpu_number());
-# else
-	db_printf("db> ");
-# endif
 	db_force_whitespace();	/* synch output position */
 
 	db_lbuf_start = lstart;

Index: src/sys/ddb/db_lex.c
diff -u src/sys/ddb/db_lex.c:1.22 src/sys/ddb/db_lex.c:1.22.60.1
--- src/sys/ddb/db_lex.c:1.22	Thu May 26 15:34:14 2011
+++ src/sys/ddb/db_lex.c	Sun Jan 26 11:25:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_lex.c,v 1.22 2011/05/26 15:34:14 joerg Exp $	*/
+/*	$NetBSD: db_lex.c,v 1.22.60.1 2020/01/26 11:25:22 martin Exp $	*/
 
 /*
  * Mach Operating System
@@ -34,10 +34,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_lex.c,v 1.22 2011/05/26 15:34:14 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_lex.c,v 1.22.60.1 2020/01/26 11:25:22 martin Exp $");
 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -61,6 +62,11 @@ db_read_line(void)
 {
 	int	i;
 
+#ifdef MULTIPROCESSOR
+	db_printf("db{%ld}> ", (long)cpu_number());
+#else
+	db_printf("db> ");
+#endif
 	i = db_readline(db_line, sizeof(db_line));
 	if (i == 0)
 		return (0);	/* EOI */



CVS commit: [netbsd-9] src/sys/ddb

2020-01-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jan 26 11:25:22 UTC 2020

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

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

sys/ddb/db_input.c: revision 1.27
sys/ddb/db_lex.c: revision 1.23

Print db> prompt in db_read_line(), not db_readline().
The former is what DDB repl calls.  The latter performs the actual
input so let other code use it without the unwanted db> prompt.  It's
already used by ACPI (and AcpiOsWaitCommandReady supplies its own
prompt).  I also use it for my uncommitted Forth scripting for DDB.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.26.64.1 src/sys/ddb/db_input.c
cvs rdiff -u -r1.22 -r1.22.60.1 src/sys/ddb/db_lex.c

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



CVS commit: [netbsd-9] src/sys/ddb

2020-01-26 Thread Martin Husemann
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 
-__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 
 #include 
@@ -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 */



CVS commit: [netbsd-9] src/sys/ddb

2020-01-26 Thread Martin Husemann
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.