Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/kdump Change back to print hex bytes. The 'word' pri...



details:   https://anonhg.NetBSD.org/src/rev/781902fc06a2
branches:  trunk
changeset: 549397:781902fc06a2
user:      dsl <dsl%NetBSD.org@localhost>
date:      Sun Jul 13 18:54:29 2003 +0000

description:
Change back to print hex bytes. The 'word' print was completely broken
on little endian systems.  It is also much easier to read misaligned
words in a straight byte hexdump.
Cut offset to 3 hex digits so that it fixs in 80 columns and still
leaves a tab at the start of 'continuation' lines.
The ktrace buffer is limited to 4k, so 3 digits is ample.

diffstat:

 usr.bin/kdump/kdump.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (39 lines):

diff -r e2166973f4a9 -r 781902fc06a2 usr.bin/kdump/kdump.c
--- a/usr.bin/kdump/kdump.c     Sun Jul 13 15:19:39 2003 +0000
+++ b/usr.bin/kdump/kdump.c     Sun Jul 13 18:54:29 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kdump.c,v 1.56 2003/07/13 15:19:39 he Exp $    */
+/*     $NetBSD: kdump.c,v 1.57 2003/07/13 18:54:29 dsl Exp $   */
 
 /*-
  * Copyright (c) 1988, 1993
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)kdump.c    8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.56 2003/07/13 15:19:39 he Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.57 2003/07/13 18:54:29 dsl Exp $");
 #endif
 #endif /* not lint */
 
@@ -563,15 +563,15 @@
                        line_len = datalen;
                cp = chars;
                l = 0;
-               printf("0x%08lx ", (u_long)dp - (u_long)vdp);
+               printf("\t%3.3lx ", (u_long)dp - (u_long)vdp);
                for (i = 0; i < line_len; i++) {
                        c = *dp++;
-                       if ((i % 4) == 0)
-                               l += printf(" 0x");
-                       l += printf("%2.2x", c);
+                       if (i == 8)
+                               l += printf(" ");
+                       l += printf(" %2.2x", c);
                        *cp++ = isgraph(c) ? c : '.';
                } while (--i);
-               printf("%*s %.*s\n", 45 - l, "", (int)(cp - chars), chars);
+               printf("%*s %.*s\n", 50 - l, "", (int)(cp - chars), chars);
        }
 }
 



Home | Main Index | Thread Index | Old Index