ddb examine hex adjustment

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ddb examine hex adjustment

Alexander Bluhm
Hi,

Printing hex values with right adjustment makes it easier to compare
corresponding digits.  So I would like the change the ddb x/x output.

before:
0xffff8000003b1038:     ffffff007c531cf0
0xffff8000003b1040:     0
0xffff8000003b1048:     ffffffff81a05e29
0xffff8000003b1050:     1018
0xffff8000003b1058:     80000001018
0xffff8000003b1060:     4000
0xffff8000003b1068:     d72a7
0xffff8000003b1070:     be704
0xffff8000003b1078:     b3ae3

after:
0xffff8000003b1038:         ffffff007c400cf0
0xffff8000003b1040:                        0
0xffff8000003b1048:         ffffffff81a09b51
0xffff8000003b1050:                     1018
0xffff8000003b1058:              80000001018
0xffff8000003b1060:                     4000
0xffff8000003b1068:                    d72a7
0xffff8000003b1070:                    be704
0xffff8000003b1078:                    b3ae3

ok?

bluhm

Index: ddb/db_examine.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/ddb/db_examine.c,v
retrieving revision 1.23
diff -u -p -r1.23 db_examine.c
--- ddb/db_examine.c 18 Oct 2016 19:46:00 -0000 1.23
+++ ddb/db_examine.c 9 Jan 2019 12:56:07 -0000
@@ -130,7 +130,7 @@ db_examine(db_addr_t addr, char *fmt, in
  break;
  case 'x': /* unsigned hex */
  value = db_get_value(addr, size, FALSE);
- db_printf("%-*lx", width, (long)value);
+ db_printf("%*lx", width, (long)value);
  break;
  case 'm': /* hex dump */
  /*

Reply | Threaded
Open this post in threaded view
|

Re: ddb examine hex adjustment

Alexandr Nedvedicky
Hello,

On Wed, Jan 09, 2019 at 02:05:23PM +0100, Alexander Bluhm wrote:

> Hi,
>
> Printing hex values with right adjustment makes it easier to compare
> corresponding digits.  So I would like the change the ddb x/x output.
>
> before:
> 0xffff8000003b1038:     ffffff007c531cf0
> 0xffff8000003b1040:     0
> 0xffff8000003b1048:     ffffffff81a05e29
> 0xffff8000003b1050:     1018
> 0xffff8000003b1058:     80000001018
> 0xffff8000003b1060:     4000
> 0xffff8000003b1068:     d72a7
> 0xffff8000003b1070:     be704
> 0xffff8000003b1078:     b3ae3
>
> after:
> 0xffff8000003b1038:         ffffff007c400cf0
> 0xffff8000003b1040:                        0
> 0xffff8000003b1048:         ffffffff81a09b51
> 0xffff8000003b1050:                     1018
> 0xffff8000003b1058:              80000001018
> 0xffff8000003b1060:                     4000
> 0xffff8000003b1068:                    d72a7
> 0xffff8000003b1070:                    be704
> 0xffff8000003b1078:                    b3ae3
>
> ok?

    yes, please. I was about to send same diff.

sashan

>
> bluhm
>
> Index: ddb/db_examine.c
> ===================================================================
> RCS file: /data/mirror/openbsd/cvs/src/sys/ddb/db_examine.c,v
> retrieving revision 1.23
> diff -u -p -r1.23 db_examine.c
> --- ddb/db_examine.c 18 Oct 2016 19:46:00 -0000 1.23
> +++ ddb/db_examine.c 9 Jan 2019 12:56:07 -0000
> @@ -130,7 +130,7 @@ db_examine(db_addr_t addr, char *fmt, in
>   break;
>   case 'x': /* unsigned hex */
>   value = db_get_value(addr, size, FALSE);
> - db_printf("%-*lx", width, (long)value);
> + db_printf("%*lx", width, (long)value);
>   break;
>   case 'm': /* hex dump */
>   /*
>