Project

General

Profile

Feature #11208

add mdb format character for jazzed-up binary output

Added by Robert Mustacchi 18 days ago. Updated about 1 hour ago.

Status:
Closed
Priority:
Normal
Category:
mdb - modular debugger
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:

Description

mdb has a very useful format character – R – for printing out a number as binary:

> abc022119=R
                101010111100000000100010000100011001

Often when printing out binary output, one is looking for specific bit positions (e.g., for decoding a register or other machine state). For these use cases, it's helpful to have fancier output – which, to accommodate the limited available format character space – we call "jazzed-up binary output" and denote with the new j format character:

> ::formats ! grep j
j - jazzed-up binary unsigned long long (8 bytes)
> abc022119=j
                101010111100000000100010000100011001
                | | | ||||        |   |    |   ||  |
                | | | ||||        |   |    |   ||  +-- bit 0  mask 0x000000001
                | | | ||||        |   |    |   |+----- bit 3  mask 0x000000008
                | | | ||||        |   |    |   +------ bit 4  mask 0x000000010
                | | | ||||        |   |    +---------- bit 8  mask 0x000000100
                | | | ||||        |   +--------------- bit 13 mask 0x000002000
                | | | ||||        +------------------- bit 17 mask 0x000020000
                | | | |||+---------------------------- bit 26 mask 0x004000000
                | | | ||+----------------------------- bit 27 mask 0x008000000
                | | | |+------------------------------ bit 28 mask 0x010000000
                | | | +------------------------------- bit 29 mask 0x020000000
                | | +--------------------------------- bit 31 mask 0x080000000
                | +----------------------------------- bit 33 mask 0x200000000
                +------------------------------------- bit 35 mask 0x800000000

This has been tested by writing new mdb tests for the functionality (which revealed 11206 and 11207) and then additionally verifying that kmdb works properly.

History

#1

Updated by Electric Monk about 1 hour ago

  • Status changed from New to Closed

git commit c8a3ee0e3658c32402e6bd505596d4fa45bfe17c

commit  c8a3ee0e3658c32402e6bd505596d4fa45bfe17c
Author: Bryan Cantrill <bryan@joyent.com>
Date:   2019-06-25T00:12:14.000Z

    11208 add mdb format character for jazzed-up binary output
    11206 mdb output autowrapping still subtly wrong
    11207 many 64-bit mdb format characters have insufficient width
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Jordan Hendricks <jordan.hendricks@joyent.com>
    Reviewed by: Toomas Soome <tsoome@me.com>
    Reviewed by: Andy Fiddaman <andy@omniosce.org>
    Reviewed by: Garrett D'Amore <garrett@damore.org>
    Approved by: Dan McDonald <danmcd@joyent.com>

Also available in: Atom PDF