Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ddb - examin/m displays with splitting by spaces as spec...



details:   https://anonhg.NetBSD.org/src/rev/181c6cbdbcb9
branches:  trunk
changeset: 965280:181c6cbdbcb9
user:      ryo <ryo%NetBSD.org@localhost>
date:      Tue Sep 10 09:32:04 2019 +0000

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

diffstat:

 share/man/man4/ddb.4 |   4 +++-
 sys/ddb/db_examine.c |  27 +++++++++++++++------------
 2 files changed, 18 insertions(+), 13 deletions(-)

diffs (77 lines):

diff -r 4f6d01b7996b -r 181c6cbdbcb9 share/man/man4/ddb.4
--- a/share/man/man4/ddb.4      Tue Sep 10 08:16:04 2019 +0000
+++ b/share/man/man4/ddb.4      Tue Sep 10 09:32:04 2019 +0000
@@ -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 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
diff -r 4f6d01b7996b -r 181c6cbdbcb9 sys/ddb/db_examine.c
--- a/sys/ddb/db_examine.c      Tue Sep 10 08:16:04 2019 +0000
+++ b/sys/ddb/db_examine.c      Tue Sep 10 09:32:04 2019 +0000
@@ -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 @@
                                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 @@
                                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--);



Home | Main Index | Thread Index | Old Index