Module Name:    src
Committed By:   ryo
Date:           Tue Sep 10 09:32:05 UTC 2019

Modified Files:
        src/share/man/man4: ddb.4
        src/sys/ddb: db_examine.c

Log Message:
- examin/m displays with splitting by spaces as specified size
- add support 'q' modifier on all arch
- consider endianness


To generate a diff of this commit:
cvs rdiff -u -r1.186 -r1.187 src/share/man/man4/ddb.4
cvs rdiff -u -r1.38 -r1.39 src/sys/ddb/db_examine.c

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

Modified files:

Index: src/share/man/man4/ddb.4
diff -u src/share/man/man4/ddb.4:1.186 src/share/man/man4/ddb.4:1.187
--- src/share/man/man4/ddb.4:1.186	Tue Sep 10 08:16:04 2019
+++ src/share/man/man4/ddb.4	Tue Sep 10 09:32:04 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ddb.4,v 1.186 2019/09/10 08:16:04 ryo Exp $
+.\"	$NetBSD: ddb.4,v 1.187 2019/09/10 09:32:04 ryo Exp $
 .\"
 .\" Copyright (c) 1997 - 2009 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -412,6 +412,8 @@ examine half-words (16 bits).
 examine words (legacy
 .Dq long ,
 32 bits).
+.It Cm q
+examine quad-words (64 bits).
 .It Cm L
 examine long words (implementation dependent)
 .It Cm a

Index: src/sys/ddb/db_examine.c
diff -u src/sys/ddb/db_examine.c:1.38 src/sys/ddb/db_examine.c:1.39
--- src/sys/ddb/db_examine.c:1.38	Tue Sep 10 08:16:05 2019
+++ src/sys/ddb/db_examine.c	Tue Sep 10 09:32:05 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_examine.c,v 1.38 2019/09/10 08:16:05 ryo Exp $	*/
+/*	$NetBSD: db_examine.c,v 1.39 2019/09/10 09:32:05 ryo Exp $	*/
 
 /*
  * Mach Operating System
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_examine.c,v 1.38 2019/09/10 08:16:05 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_examine.c,v 1.39 2019/09/10 09:32:05 ryo Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -101,13 +101,10 @@ db_examine(db_addr_t addr, char *fmt, in
 				size = 4;
 				width = 12;
 				break;
-			case 'q':
-				if (sizeof(db_expr_t) != sizeof(uint64_t)) {
-					size = -1;
-					db_error("q not supported\n");
-					/*NOTREACHED*/
-				}
-				/* FALLTHROUGH */
+			case 'q':	/* quad-word */
+				size = 8;
+				width = 16;
+				break;
 			case 'L':	/* implementation maximum */
 				size = sizeof value;
 				width = 12 * (sizeof value / 4);
@@ -146,13 +143,19 @@ db_examine(db_addr_t addr, char *fmt, in
 				do {
 					for (i = 0; i < size; i++) {
 						value =
- 						    db_get_value(addr+bytes, 1,
-							false);
+#if BYTE_ORDER == LITTLE_ENDIAN
+						    db_get_value(addr +
+						    (bytes & ~(size - 1)) +
+						    size - i - 1, 1, false);
+#else
+						    db_get_value(addr + bytes,
+						    1, false);
+#endif
 						db_printf(
 						    "%02" DDB_EXPR_FMT "x",
 						    value);
 						bytes++;
-						if (!(bytes % 4))
+						if (!(bytes % size))
 							db_printf(" ");
 					}
 				} while ((bytes != 16) && count--);

Reply via email to