diff options
author | Bryan Cantrill <bryan@joyent.com> | 2019-06-06 15:00:37 +0000 |
---|---|---|
committer | Robert Mustacchi <rm@joyent.com> | 2019-06-25 00:12:14 +0000 |
commit | c8a3ee0e3658c32402e6bd505596d4fa45bfe17c (patch) | |
tree | 353aa02e742d0577cd81554bd260cf4a8e70ef0e | |
parent | b1e2e3fb17324e9ddf43db264a0c64da7756d9e6 (diff) | |
download | illumos-joyent-c8a3ee0e3658c32402e6bd505596d4fa45bfe17c.tar.gz |
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>
23 files changed, 538 insertions, 17 deletions
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_fmt.c b/usr/src/cmd/mdb/common/mdb/mdb_fmt.c index 78d27bdcb9..e03a3bcb6e 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_fmt.c +++ b/usr/src/cmd/mdb/common/mdb/mdb_fmt.c @@ -21,7 +21,7 @@ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. - * Copyright 2016 Joyent, Inc. + * Copyright 2019 Joyent, Inc. * Copyright (c) 2017 by Delphix. All rights reserved. */ @@ -82,8 +82,9 @@ typedef mdb_tgt_addr_t mdb_fmt_func_f(mdb_tgt_t *, #define FMT_PRINTF 0x2 /* f_ptr is a const char * format string */ #define FMT_MATCH 0x4 /* Match command (not supported here) */ #define FMT_WRITE 0x8 /* Command writes to address space */ +#define FMT_NOAUTOWRAP 0x10 /* Autowrap should not be autoenabled */ -#define FMT_TYPE(x) ((x) & 0x7) /* Excludes modifying flags (FMT_WRITE) */ +#define FMT_TYPE(x) ((x) & 0x7) /* Excludes modifying flags */ typedef struct mdb_fmt_desc { int f_type; /* Type of format (see above) */ @@ -120,6 +121,7 @@ static const char help_match64[] = "long long"; static const char help_match16[] = "short"; static const char help_uintptr[] = "hexadecimal uintptr_t"; static const char help_ctf[] = "whose size is inferred by CTF info"; +static const char help_jazzed[] = "jazzed-up binary unsigned long long"; /*ARGSUSED*/ static mdb_tgt_addr_t @@ -449,10 +451,12 @@ static mdb_tgt_addr_t fmt_binary(mdb_tgt_t *t, mdb_tgt_as_t as, mdb_tgt_addr_t addr, size_t cnt) { uint64_t x; + const char *fmts[] = { "%-64s", "%-65s" }; + const uint64_t mask = 0x8000000000000000ull; while (cnt-- != 0) { if (mdb_tgt_aread(t, as, &x, sizeof (x), addr) == sizeof (x)) { - mdb_iob_printf(mdb.m_out, "%-64s", + mdb_iob_printf(mdb.m_out, fmts[(x & mask) != 0], numtostr(x, 2, NTOS_UNSIGNED)); mdb_nv_set_value(mdb.m_rvalue, x); addr += sizeof (x); @@ -465,6 +469,83 @@ fmt_binary(mdb_tgt_t *t, mdb_tgt_as_t as, mdb_tgt_addr_t addr, size_t cnt) } static mdb_tgt_addr_t +fmt_jazzed(mdb_tgt_t *t, mdb_tgt_as_t as, mdb_tgt_addr_t addr, size_t cnt) +{ + uint64_t x; + char buf[256]; + + while (cnt-- != 0) { + boolean_t header = B_TRUE; + + if (mdb_tgt_aread(t, as, &x, sizeof (x), addr) != sizeof (x)) { + warn("failed to read data from target"); + break; + } + + mdb_nv_set_value(mdb.m_rvalue, x); + addr += sizeof (x); + + mdb_iob_printf(mdb.m_out, "%s\n", + numtostr(x, 2, NTOS_UNSIGNED)); + + while (x != 0) { + int b = 63, forearm; + int i = 0, highbit; + + /* + * Find the high bit... + */ + while (!(x & (1ULL << b))) + b--; + + highbit = b; + + /* + * ...and iterate over the remaining bits, putting + * the upper arm in our buffer for any set bit (and + * a space otherwise). + */ + while (x & ((1ULL << b) - 1)) { + buf[i++] = x & (1ULL << b) ? '|' : ' '; + b--; + } + + /* + * If this is the header line, print the upper arm + * for the lowest set bit and continue... + */ + if (header) { + header = B_FALSE; + buf[i] = '\0'; + mdb_iob_printf(mdb.m_out, "%s|\n", buf); + continue; + } + + /* + * ...otherwise, put the elbow and forearm into our + * buffer, and print it. + */ + buf[i++] = '+'; + + for (forearm = b; forearm > -2; forearm--) + buf[i++] = '-'; + + buf[i] = '\0'; + mdb_iob_printf(mdb.m_out, "%s bit %d %smask 0x%0*llx\n", + buf, b, b < 10 && highbit >= 10 ? " " : "", + (highbit / 4) + 1, 1ULL << b); + + /* + * Finally, clear the lowest set bit and continue. + */ + x &= ~(1ULL << b); + } + } + + return (addr); +} + +static mdb_tgt_addr_t fmt_hex64(mdb_tgt_t *t, mdb_tgt_as_t as, mdb_tgt_addr_t addr, size_t cnt) { const char *fmts[] = { "%-16llx", "%-17llx" }; @@ -554,13 +635,13 @@ static const mdb_fmt_desc_t fmttab[] = { { FMT_PRINTF, "%-8x", NULL, 1 }, /* 66 = B */ { FMT_FUNC, FUNCP(fmt_escchr), help_escchr, 1 }, /* 67 = C */ { FMT_PRINTF, "%-16d", NULL, 4 }, /* 68 = D */ - { FMT_PRINTF, "%-16llu", NULL, 8 }, /* 69 = E */ + { FMT_PRINTF, "%-21llu", NULL, 8 }, /* 69 = E */ #ifdef _KMDB { FMT_NONE, NULL, NULL, 0 }, /* 70 = F */ #else { FMT_PRINTF, "%g", NULL, sizeof (double), B_TRUE }, /* 70 = F */ #endif - { FMT_PRINTF, "%-16llo", NULL, 8 }, /* 71 = G */ + { FMT_PRINTF, "%-23llo", NULL, 8 }, /* 71 = G */ { FMT_FUNC, FUNCP(fmt_swapint), help_swapint, 4 }, /* 72 = H */ { FMT_FUNC, FUNCP(fmt_dotinstr), help_dotinstr, 0 }, /* 73 = I */ { FMT_FUNC, FUNCP(fmt_hex64), help_hex64, 8 }, /* 74 = J */ @@ -573,7 +654,7 @@ static const mdb_fmt_desc_t fmttab[] = { { FMT_MATCH, NULL, help_match64, 8 }, /* 77 = M */ { FMT_FUNC, FUNCP(fmt_nl), help_nl, SZ_NONE }, /* 78 = N */ { FMT_PRINTF, "%-#16o", NULL, 4 }, /* 79 = O */ - { FMT_PRINTF, "%-16a", NULL, sizeof (uintptr_t) }, /* 80 = P */ + { FMT_PRINTF, "%-19a", NULL, sizeof (uintptr_t) }, /* 80 = P */ { FMT_PRINTF, "%-#16q", NULL, 4 }, /* 81 = Q */ { FMT_FUNC, FUNCP(fmt_binary), help_binary, 8 }, /* 82 = R */ { FMT_FUNC, FUNCP(fmt_escstr), help_escstr, 0 }, /* 83 = S */ @@ -594,23 +675,24 @@ static const mdb_fmt_desc_t fmttab[] = { { FMT_PRINTF, "%-#8o", NULL, 1 }, /* 98 = b */ { FMT_PRINTF, "%c", NULL, 1 }, /* 99 = c */ { FMT_PRINTF, "%-8hd", NULL, 2 }, /* 100 = d */ - { FMT_PRINTF, "%-16lld", NULL, 8 }, /* 101 = e */ + { FMT_PRINTF, "%-21lld", NULL, 8 }, /* 101 = e */ #ifdef _KMDB { FMT_NONE, NULL, NULL, 0 }, /* 102 = f */ #else { FMT_FUNC, FUNCP(fmt_float), help_f, sizeof (float), B_TRUE }, /* 102 = f */ #endif - { FMT_PRINTF, "%-16llq", NULL, 8 }, /* 103 = g */ + { FMT_PRINTF, "%-24llq", NULL, 8 }, /* 103 = g */ { FMT_FUNC, FUNCP(fmt_swapshort), help_swapshort, 2 }, /* 104 = h */ { FMT_FUNC, FUNCP(fmt_instr), help_instr, 0 }, /* 105 = i */ - { FMT_NONE, NULL, NULL, 0 }, /* 106 = j */ + { FMT_FUNC|FMT_NOAUTOWRAP, + FUNCP(fmt_jazzed), help_jazzed, 8 }, /* 106 = j */ { FMT_NONE, NULL, NULL, 0 }, /* 107 = k */ { FMT_MATCH, NULL, help_match16, 2 }, /* 108 = l */ { FMT_NONE, NULL, NULL, 0 }, /* 109 = m */ { FMT_FUNC, FUNCP(fmt_nl), help_nl, SZ_NONE }, /* 110 = n */ { FMT_PRINTF, "%-#8ho", NULL, 2 }, /* 111 = o */ - { FMT_PRINTF, "%-16a", NULL, sizeof (uintptr_t) }, /* 112 = p */ + { FMT_PRINTF, "%-19a", NULL, sizeof (uintptr_t) }, /* 112 = p */ { FMT_PRINTF, "%-#8hq", NULL, 2 }, /* 113 = q */ { FMT_FUNC, FUNCP(fmt_ws), help_ws, SZ_NONE }, /* 114 = r */ { FMT_FUNC, FUNCP(fmt_rawstr), help_rawstr, 0 }, /* 115 = s */ @@ -631,6 +713,7 @@ mdb_fmt_print(mdb_tgt_t *t, mdb_tgt_as_t as, mdb_fmt_func_f *funcp; uintmax_t rvalue; void *buf; + uint_t oflags = mdb.m_flags; union { uint64_t i8; @@ -645,6 +728,14 @@ mdb_fmt_print(mdb_tgt_t *t, mdb_tgt_as_t as, return (addr); } + if (!(fp->f_type & FMT_NOAUTOWRAP)) { + /* + * Unless a format has explicitly opted out, we force autowrap + * for the duration of mdb_fmt_print(). + */ + mdb.m_flags |= MDB_FL_AUTOWRAP; + } + switch (FMT_TYPE(fp->f_type)) { case FMT_FUNC: funcp = (mdb_fmt_func_f *)fp->f_ptr; @@ -719,6 +810,8 @@ mdb_fmt_print(mdb_tgt_t *t, mdb_tgt_as_t as, warn("invalid format character -- '%c'\n", fmt); } + mdb.m_flags = oflags; + return (addr); } diff --git a/usr/src/cmd/mdb/common/mdb/mdb_io.c b/usr/src/cmd/mdb/common/mdb/mdb_io.c index b8c04bcd06..f1ad8d051c 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_io.c +++ b/usr/src/cmd/mdb/common/mdb/mdb_io.c @@ -24,7 +24,7 @@ */ /* - * Copyright (c) 2017, Joyent, Inc. All rights reserved. + * Copyright (c) 2019, Joyent, Inc. All rights reserved. * Copyright (c) 2016 by Delphix. All rights reserved. */ @@ -162,11 +162,14 @@ typedef struct { /* * Define macro for determining if we should automatically wrap to the next * line of output, based on the amount of consumed buffer space and the - * specified size of the next thing to be inserted (n). + * specified size of the next thing to be inserted (n) -- being careful to + * not force a spurious wrap if we're autoindented and already at the margin. */ #define IOB_WRAPNOW(iob, n) \ (IOB_AUTOWRAP(iob) && (iob)->iob_nbytes != 0 && \ - ((n) + (iob)->iob_nbytes > (iob)->iob_cols)) + ((n) + (iob)->iob_nbytes > (iob)->iob_cols) && \ + !(((iob)->iob_flags & MDB_IOB_INDENT) && \ + (iob)->iob_nbytes == (iob)->iob_margin)) /* * Define prompt string and string to erase prompt string for iob_pager @@ -1910,7 +1913,7 @@ mdb_iob_fill(mdb_iob_t *iob, int c, size_t nfill) void mdb_iob_ws(mdb_iob_t *iob, size_t n) { - if (iob->iob_nbytes + n < iob->iob_cols) + if (!IOB_AUTOWRAP(iob) || iob->iob_nbytes + n < iob->iob_cols) mdb_iob_fill(iob, ' ', n); else mdb_iob_nl(iob); diff --git a/usr/src/cmd/mdb/test/format/tst.format-cap-E.mdb b/usr/src/cmd/mdb/test/format/tst.format-cap-E.mdb new file mode 100644 index 0000000000..18e9053ce4 --- /dev/null +++ b/usr/src/cmd/mdb/test/format/tst.format-cap-E.mdb @@ -0,0 +1,2 @@ +-1,10=E +1<<0t63,10=E diff --git a/usr/src/cmd/mdb/test/format/tst.format-cap-E.mdb.out b/usr/src/cmd/mdb/test/format/tst.format-cap-E.mdb.out new file mode 100644 index 0000000000..2268a48be9 --- /dev/null +++ b/usr/src/cmd/mdb/test/format/tst.format-cap-E.mdb.out @@ -0,0 +1,12 @@ + 18446744073709551615 18446744073709551615 18446744073709551615 + 18446744073709551615 18446744073709551615 18446744073709551615 + 18446744073709551615 18446744073709551615 18446744073709551615 + 18446744073709551615 18446744073709551615 18446744073709551615 + 18446744073709551615 18446744073709551615 18446744073709551615 + 18446744073709551615 + 9223372036854775808 9223372036854775808 9223372036854775808 + 9223372036854775808 9223372036854775808 9223372036854775808 + 9223372036854775808 9223372036854775808 9223372036854775808 + 9223372036854775808 9223372036854775808 9223372036854775808 + 9223372036854775808 9223372036854775808 9223372036854775808 + 9223372036854775808 diff --git a/usr/src/cmd/mdb/test/format/tst.format-cap-G.mdb b/usr/src/cmd/mdb/test/format/tst.format-cap-G.mdb new file mode 100644 index 0000000000..f10f78336b --- /dev/null +++ b/usr/src/cmd/mdb/test/format/tst.format-cap-G.mdb @@ -0,0 +1,4 @@ +-1,10=G +1<<0t63,10=G +1<<0t60,10=G +1<<0t57,10=G diff --git a/usr/src/cmd/mdb/test/format/tst.format-cap-G.mdb.out b/usr/src/cmd/mdb/test/format/tst.format-cap-G.mdb.out new file mode 100644 index 0000000000..f1dfd5193b --- /dev/null +++ b/usr/src/cmd/mdb/test/format/tst.format-cap-G.mdb.out @@ -0,0 +1,32 @@ + 1777777777777777777777 1777777777777777777777 + 1777777777777777777777 1777777777777777777777 + 1777777777777777777777 1777777777777777777777 + 1777777777777777777777 1777777777777777777777 + 1777777777777777777777 1777777777777777777777 + 1777777777777777777777 1777777777777777777777 + 1777777777777777777777 1777777777777777777777 + 1777777777777777777777 1777777777777777777777 + 1000000000000000000000 1000000000000000000000 + 1000000000000000000000 1000000000000000000000 + 1000000000000000000000 1000000000000000000000 + 1000000000000000000000 1000000000000000000000 + 1000000000000000000000 1000000000000000000000 + 1000000000000000000000 1000000000000000000000 + 1000000000000000000000 1000000000000000000000 + 1000000000000000000000 1000000000000000000000 + 100000000000000000000 100000000000000000000 + 100000000000000000000 100000000000000000000 + 100000000000000000000 100000000000000000000 + 100000000000000000000 100000000000000000000 + 100000000000000000000 100000000000000000000 + 100000000000000000000 100000000000000000000 + 100000000000000000000 100000000000000000000 + 100000000000000000000 100000000000000000000 + 10000000000000000000 10000000000000000000 + 10000000000000000000 10000000000000000000 + 10000000000000000000 10000000000000000000 + 10000000000000000000 10000000000000000000 + 10000000000000000000 10000000000000000000 + 10000000000000000000 10000000000000000000 + 10000000000000000000 10000000000000000000 + 10000000000000000000 10000000000000000000 diff --git a/usr/src/cmd/mdb/test/format/tst.format-cap-J.mdb b/usr/src/cmd/mdb/test/format/tst.format-cap-J.mdb new file mode 100644 index 0000000000..ff9dabbce9 --- /dev/null +++ b/usr/src/cmd/mdb/test/format/tst.format-cap-J.mdb @@ -0,0 +1,3 @@ +-1,10=J +1<<0t63,10=J +1<<0t59,10=J diff --git a/usr/src/cmd/mdb/test/format/tst.format-cap-J.mdb.out b/usr/src/cmd/mdb/test/format/tst.format-cap-J.mdb.out new file mode 100644 index 0000000000..644fee231e --- /dev/null +++ b/usr/src/cmd/mdb/test/format/tst.format-cap-J.mdb.out @@ -0,0 +1,16 @@ + ffffffffffffffff ffffffffffffffff ffffffffffffffff + ffffffffffffffff ffffffffffffffff ffffffffffffffff + ffffffffffffffff ffffffffffffffff ffffffffffffffff + ffffffffffffffff ffffffffffffffff ffffffffffffffff + ffffffffffffffff ffffffffffffffff ffffffffffffffff + ffffffffffffffff + 8000000000000000 8000000000000000 8000000000000000 + 8000000000000000 8000000000000000 8000000000000000 + 8000000000000000 8000000000000000 8000000000000000 + 8000000000000000 8000000000000000 8000000000000000 + 8000000000000000 8000000000000000 8000000000000000 + 8000000000000000 + 800000000000000 800000000000000 800000000000000 800000000000000 + 800000000000000 800000000000000 800000000000000 800000000000000 + 800000000000000 800000000000000 800000000000000 800000000000000 + 800000000000000 800000000000000 800000000000000 800000000000000 diff --git a/usr/src/cmd/mdb/test/format/tst.format-cap-P.mdb b/usr/src/cmd/mdb/test/format/tst.format-cap-P.mdb new file mode 100644 index 0000000000..88928fda29 --- /dev/null +++ b/usr/src/cmd/mdb/test/format/tst.format-cap-P.mdb @@ -0,0 +1 @@ +1<<0t63,10=P diff --git a/usr/src/cmd/mdb/test/format/tst.format-cap-P.mdb.out b/usr/src/cmd/mdb/test/format/tst.format-cap-P.mdb.out new file mode 100644 index 0000000000..65e05e7220 --- /dev/null +++ b/usr/src/cmd/mdb/test/format/tst.format-cap-P.mdb.out @@ -0,0 +1,6 @@ + 0x8000000000000000 0x8000000000000000 0x8000000000000000 + 0x8000000000000000 0x8000000000000000 0x8000000000000000 + 0x8000000000000000 0x8000000000000000 0x8000000000000000 + 0x8000000000000000 0x8000000000000000 0x8000000000000000 + 0x8000000000000000 0x8000000000000000 0x8000000000000000 + 0x8000000000000000 diff --git a/usr/src/cmd/mdb/test/format/tst.format-cap-R.mdb b/usr/src/cmd/mdb/test/format/tst.format-cap-R.mdb new file mode 100644 index 0000000000..9f55408276 --- /dev/null +++ b/usr/src/cmd/mdb/test/format/tst.format-cap-R.mdb @@ -0,0 +1,4 @@ +1=RRRR +1<<0t62=RRR +1<<0t63=RRR +-1=RRRR diff --git a/usr/src/cmd/mdb/test/format/tst.format-cap-R.mdb.out b/usr/src/cmd/mdb/test/format/tst.format-cap-R.mdb.out new file mode 100644 index 0000000000..f05b0bac4d --- /dev/null +++ b/usr/src/cmd/mdb/test/format/tst.format-cap-R.mdb.out @@ -0,0 +1,14 @@ + 1 + 1 + 1 + 1 + 100000000000000000000000000000000000000000000000000000000000000 + 100000000000000000000000000000000000000000000000000000000000000 + 100000000000000000000000000000000000000000000000000000000000000 + 1000000000000000000000000000000000000000000000000000000000000000 + 1000000000000000000000000000000000000000000000000000000000000000 + 1000000000000000000000000000000000000000000000000000000000000000 + 1111111111111111111111111111111111111111111111111111111111111111 + 1111111111111111111111111111111111111111111111111111111111111111 + 1111111111111111111111111111111111111111111111111111111111111111 + 1111111111111111111111111111111111111111111111111111111111111111 diff --git a/usr/src/cmd/mdb/test/format/tst.format-e.mdb b/usr/src/cmd/mdb/test/format/tst.format-e.mdb new file mode 100644 index 0000000000..79d4b25af4 --- /dev/null +++ b/usr/src/cmd/mdb/test/format/tst.format-e.mdb @@ -0,0 +1,2 @@ +-1,10=e +1<<0t63,10=e diff --git a/usr/src/cmd/mdb/test/format/tst.format-e.mdb.out b/usr/src/cmd/mdb/test/format/tst.format-e.mdb.out new file mode 100644 index 0000000000..909c53cbc0 --- /dev/null +++ b/usr/src/cmd/mdb/test/format/tst.format-e.mdb.out @@ -0,0 +1,12 @@ + -1 -1 -1 + -1 -1 -1 + -1 -1 -1 + -1 -1 -1 + -1 -1 -1 + -1 + -9223372036854775808 -9223372036854775808 -9223372036854775808 + -9223372036854775808 -9223372036854775808 -9223372036854775808 + -9223372036854775808 -9223372036854775808 -9223372036854775808 + -9223372036854775808 -9223372036854775808 -9223372036854775808 + -9223372036854775808 -9223372036854775808 -9223372036854775808 + -9223372036854775808 diff --git a/usr/src/cmd/mdb/test/format/tst.format-g.mdb b/usr/src/cmd/mdb/test/format/tst.format-g.mdb new file mode 100644 index 0000000000..b3397d21ed --- /dev/null +++ b/usr/src/cmd/mdb/test/format/tst.format-g.mdb @@ -0,0 +1,5 @@ +-1,10=g +1<<0t63,10=g +(1<<0t63)-1,10=g +1<<0t60,10=g +1<<0t57,10=g diff --git a/usr/src/cmd/mdb/test/format/tst.format-g.mdb.out b/usr/src/cmd/mdb/test/format/tst.format-g.mdb.out new file mode 100644 index 0000000000..c46dff3594 --- /dev/null +++ b/usr/src/cmd/mdb/test/format/tst.format-g.mdb.out @@ -0,0 +1,40 @@ + -1 -1 + -1 -1 + -1 -1 + -1 -1 + -1 -1 + -1 -1 + -1 -1 + -1 -1 + -1000000000000000000000 -1000000000000000000000 + -1000000000000000000000 -1000000000000000000000 + -1000000000000000000000 -1000000000000000000000 + -1000000000000000000000 -1000000000000000000000 + -1000000000000000000000 -1000000000000000000000 + -1000000000000000000000 -1000000000000000000000 + -1000000000000000000000 -1000000000000000000000 + -1000000000000000000000 -1000000000000000000000 + 777777777777777777777 777777777777777777777 + 777777777777777777777 777777777777777777777 + 777777777777777777777 777777777777777777777 + 777777777777777777777 777777777777777777777 + 777777777777777777777 777777777777777777777 + 777777777777777777777 777777777777777777777 + 777777777777777777777 777777777777777777777 + 777777777777777777777 777777777777777777777 + 100000000000000000000 100000000000000000000 + 100000000000000000000 100000000000000000000 + 100000000000000000000 100000000000000000000 + 100000000000000000000 100000000000000000000 + 100000000000000000000 100000000000000000000 + 100000000000000000000 100000000000000000000 + 100000000000000000000 100000000000000000000 + 100000000000000000000 100000000000000000000 + 10000000000000000000 10000000000000000000 + 10000000000000000000 10000000000000000000 + 10000000000000000000 10000000000000000000 + 10000000000000000000 10000000000000000000 + 10000000000000000000 10000000000000000000 + 10000000000000000000 10000000000000000000 + 10000000000000000000 10000000000000000000 + 10000000000000000000 10000000000000000000 diff --git a/usr/src/cmd/mdb/test/format/tst.format-j.mdb b/usr/src/cmd/mdb/test/format/tst.format-j.mdb new file mode 100644 index 0000000000..875a1e178f --- /dev/null +++ b/usr/src/cmd/mdb/test/format/tst.format-j.mdb @@ -0,0 +1,8 @@ +-1=JRjnn +0=JRjnn +1=JRjnn +feedface=JRjnn +badfeedcafe=JRjnn +deadba11e12a=JRjnn +badb100d=JRjnn +baddefec8ed=JRjnn diff --git a/usr/src/cmd/mdb/test/format/tst.format-j.mdb.out b/usr/src/cmd/mdb/test/format/tst.format-j.mdb.out new file mode 100644 index 0000000000..3f5fa0afaf --- /dev/null +++ b/usr/src/cmd/mdb/test/format/tst.format-j.mdb.out @@ -0,0 +1,238 @@ + ffffffffffffffff + 1111111111111111111111111111111111111111111111111111111111111111 + 1111111111111111111111111111111111111111111111111111111111111111 + |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| + |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||+-- bit 0 mask 0x0000000000000001 + ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||+--- bit 1 mask 0x0000000000000002 + |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||+---- bit 2 mask 0x0000000000000004 + ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||+----- bit 3 mask 0x0000000000000008 + |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||+------ bit 4 mask 0x0000000000000010 + ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||+------- bit 5 mask 0x0000000000000020 + |||||||||||||||||||||||||||||||||||||||||||||||||||||||||+-------- bit 6 mask 0x0000000000000040 + ||||||||||||||||||||||||||||||||||||||||||||||||||||||||+--------- bit 7 mask 0x0000000000000080 + |||||||||||||||||||||||||||||||||||||||||||||||||||||||+---------- bit 8 mask 0x0000000000000100 + ||||||||||||||||||||||||||||||||||||||||||||||||||||||+----------- bit 9 mask 0x0000000000000200 + |||||||||||||||||||||||||||||||||||||||||||||||||||||+------------ bit 10 mask 0x0000000000000400 + ||||||||||||||||||||||||||||||||||||||||||||||||||||+------------- bit 11 mask 0x0000000000000800 + |||||||||||||||||||||||||||||||||||||||||||||||||||+-------------- bit 12 mask 0x0000000000001000 + ||||||||||||||||||||||||||||||||||||||||||||||||||+--------------- bit 13 mask 0x0000000000002000 + |||||||||||||||||||||||||||||||||||||||||||||||||+---------------- bit 14 mask 0x0000000000004000 + ||||||||||||||||||||||||||||||||||||||||||||||||+----------------- bit 15 mask 0x0000000000008000 + |||||||||||||||||||||||||||||||||||||||||||||||+------------------ bit 16 mask 0x0000000000010000 + ||||||||||||||||||||||||||||||||||||||||||||||+------------------- bit 17 mask 0x0000000000020000 + |||||||||||||||||||||||||||||||||||||||||||||+-------------------- bit 18 mask 0x0000000000040000 + ||||||||||||||||||||||||||||||||||||||||||||+--------------------- bit 19 mask 0x0000000000080000 + |||||||||||||||||||||||||||||||||||||||||||+---------------------- bit 20 mask 0x0000000000100000 + ||||||||||||||||||||||||||||||||||||||||||+----------------------- bit 21 mask 0x0000000000200000 + |||||||||||||||||||||||||||||||||||||||||+------------------------ bit 22 mask 0x0000000000400000 + ||||||||||||||||||||||||||||||||||||||||+------------------------- bit 23 mask 0x0000000000800000 + |||||||||||||||||||||||||||||||||||||||+-------------------------- bit 24 mask 0x0000000001000000 + ||||||||||||||||||||||||||||||||||||||+--------------------------- bit 25 mask 0x0000000002000000 + |||||||||||||||||||||||||||||||||||||+---------------------------- bit 26 mask 0x0000000004000000 + ||||||||||||||||||||||||||||||||||||+----------------------------- bit 27 mask 0x0000000008000000 + |||||||||||||||||||||||||||||||||||+------------------------------ bit 28 mask 0x0000000010000000 + ||||||||||||||||||||||||||||||||||+------------------------------- bit 29 mask 0x0000000020000000 + |||||||||||||||||||||||||||||||||+-------------------------------- bit 30 mask 0x0000000040000000 + ||||||||||||||||||||||||||||||||+--------------------------------- bit 31 mask 0x0000000080000000 + |||||||||||||||||||||||||||||||+---------------------------------- bit 32 mask 0x0000000100000000 + ||||||||||||||||||||||||||||||+----------------------------------- bit 33 mask 0x0000000200000000 + |||||||||||||||||||||||||||||+------------------------------------ bit 34 mask 0x0000000400000000 + ||||||||||||||||||||||||||||+------------------------------------- bit 35 mask 0x0000000800000000 + |||||||||||||||||||||||||||+-------------------------------------- bit 36 mask 0x0000001000000000 + ||||||||||||||||||||||||||+--------------------------------------- bit 37 mask 0x0000002000000000 + |||||||||||||||||||||||||+---------------------------------------- bit 38 mask 0x0000004000000000 + ||||||||||||||||||||||||+----------------------------------------- bit 39 mask 0x0000008000000000 + |||||||||||||||||||||||+------------------------------------------ bit 40 mask 0x0000010000000000 + ||||||||||||||||||||||+------------------------------------------- bit 41 mask 0x0000020000000000 + |||||||||||||||||||||+-------------------------------------------- bit 42 mask 0x0000040000000000 + ||||||||||||||||||||+--------------------------------------------- bit 43 mask 0x0000080000000000 + |||||||||||||||||||+---------------------------------------------- bit 44 mask 0x0000100000000000 + ||||||||||||||||||+----------------------------------------------- bit 45 mask 0x0000200000000000 + |||||||||||||||||+------------------------------------------------ bit 46 mask 0x0000400000000000 + ||||||||||||||||+------------------------------------------------- bit 47 mask 0x0000800000000000 + |||||||||||||||+-------------------------------------------------- bit 48 mask 0x0001000000000000 + ||||||||||||||+--------------------------------------------------- bit 49 mask 0x0002000000000000 + |||||||||||||+---------------------------------------------------- bit 50 mask 0x0004000000000000 + ||||||||||||+----------------------------------------------------- bit 51 mask 0x0008000000000000 + |||||||||||+------------------------------------------------------ bit 52 mask 0x0010000000000000 + ||||||||||+------------------------------------------------------- bit 53 mask 0x0020000000000000 + |||||||||+-------------------------------------------------------- bit 54 mask 0x0040000000000000 + ||||||||+--------------------------------------------------------- bit 55 mask 0x0080000000000000 + |||||||+---------------------------------------------------------- bit 56 mask 0x0100000000000000 + ||||||+----------------------------------------------------------- bit 57 mask 0x0200000000000000 + |||||+------------------------------------------------------------ bit 58 mask 0x0400000000000000 + ||||+------------------------------------------------------------- bit 59 mask 0x0800000000000000 + |||+-------------------------------------------------------------- bit 60 mask 0x1000000000000000 + ||+--------------------------------------------------------------- bit 61 mask 0x2000000000000000 + |+---------------------------------------------------------------- bit 62 mask 0x4000000000000000 + +----------------------------------------------------------------- bit 63 mask 0x8000000000000000 + + + 0 + 0 + 0 + + + 1 + 1 + 1 + | + +-- bit 0 mask 0x1 + + + feedface + 11111110111011011111101011001110 + 11111110111011011111101011001110 + ||||||| ||| || |||||| | || ||| + ||||||| ||| || |||||| | || ||+--- bit 1 mask 0x00000002 + ||||||| ||| || |||||| | || |+---- bit 2 mask 0x00000004 + ||||||| ||| || |||||| | || +----- bit 3 mask 0x00000008 + ||||||| ||| || |||||| | |+-------- bit 6 mask 0x00000040 + ||||||| ||| || |||||| | +--------- bit 7 mask 0x00000080 + ||||||| ||| || |||||| +----------- bit 9 mask 0x00000200 + ||||||| ||| || |||||+------------- bit 11 mask 0x00000800 + ||||||| ||| || ||||+-------------- bit 12 mask 0x00001000 + ||||||| ||| || |||+--------------- bit 13 mask 0x00002000 + ||||||| ||| || ||+---------------- bit 14 mask 0x00004000 + ||||||| ||| || |+----------------- bit 15 mask 0x00008000 + ||||||| ||| || +------------------ bit 16 mask 0x00010000 + ||||||| ||| |+-------------------- bit 18 mask 0x00040000 + ||||||| ||| +--------------------- bit 19 mask 0x00080000 + ||||||| ||+----------------------- bit 21 mask 0x00200000 + ||||||| |+------------------------ bit 22 mask 0x00400000 + ||||||| +------------------------- bit 23 mask 0x00800000 + ||||||+--------------------------- bit 25 mask 0x02000000 + |||||+---------------------------- bit 26 mask 0x04000000 + ||||+----------------------------- bit 27 mask 0x08000000 + |||+------------------------------ bit 28 mask 0x10000000 + ||+------------------------------- bit 29 mask 0x20000000 + |+-------------------------------- bit 30 mask 0x40000000 + +--------------------------------- bit 31 mask 0x80000000 + + + badfeedcafe + 10111010110111111110111011011100101011111110 + 10111010110111111110111011011100101011111110 + | ||| | || |||||||| ||| || ||| | | ||||||| + | ||| | || |||||||| ||| || ||| | | ||||||+--- bit 1 mask 0x00000000002 + | ||| | || |||||||| ||| || ||| | | |||||+---- bit 2 mask 0x00000000004 + | ||| | || |||||||| ||| || ||| | | ||||+----- bit 3 mask 0x00000000008 + | ||| | || |||||||| ||| || ||| | | |||+------ bit 4 mask 0x00000000010 + | ||| | || |||||||| ||| || ||| | | ||+------- bit 5 mask 0x00000000020 + | ||| | || |||||||| ||| || ||| | | |+-------- bit 6 mask 0x00000000040 + | ||| | || |||||||| ||| || ||| | | +--------- bit 7 mask 0x00000000080 + | ||| | || |||||||| ||| || ||| | +----------- bit 9 mask 0x00000000200 + | ||| | || |||||||| ||| || ||| +------------- bit 11 mask 0x00000000800 + | ||| | || |||||||| ||| || ||+---------------- bit 14 mask 0x00000004000 + | ||| | || |||||||| ||| || |+----------------- bit 15 mask 0x00000008000 + | ||| | || |||||||| ||| || +------------------ bit 16 mask 0x00000010000 + | ||| | || |||||||| ||| |+-------------------- bit 18 mask 0x00000040000 + | ||| | || |||||||| ||| +--------------------- bit 19 mask 0x00000080000 + | ||| | || |||||||| ||+----------------------- bit 21 mask 0x00000200000 + | ||| | || |||||||| |+------------------------ bit 22 mask 0x00000400000 + | ||| | || |||||||| +------------------------- bit 23 mask 0x00000800000 + | ||| | || |||||||+--------------------------- bit 25 mask 0x00002000000 + | ||| | || ||||||+---------------------------- bit 26 mask 0x00004000000 + | ||| | || |||||+----------------------------- bit 27 mask 0x00008000000 + | ||| | || ||||+------------------------------ bit 28 mask 0x00010000000 + | ||| | || |||+------------------------------- bit 29 mask 0x00020000000 + | ||| | || ||+-------------------------------- bit 30 mask 0x00040000000 + | ||| | || |+--------------------------------- bit 31 mask 0x00080000000 + | ||| | || +---------------------------------- bit 32 mask 0x00100000000 + | ||| | |+------------------------------------ bit 34 mask 0x00400000000 + | ||| | +------------------------------------- bit 35 mask 0x00800000000 + | ||| +--------------------------------------- bit 37 mask 0x02000000000 + | ||+----------------------------------------- bit 39 mask 0x08000000000 + | |+------------------------------------------ bit 40 mask 0x10000000000 + | +------------------------------------------- bit 41 mask 0x20000000000 + +--------------------------------------------- bit 43 mask 0x80000000000 + + + deadba11e12a + 110111101010110110111010000100011110000100101010 + 110111101010110110111010000100011110000100101010 + || |||| | | || || ||| | | |||| | | | | + || |||| | | || || ||| | | |||| | | | +--- bit 1 mask 0x000000000002 + || |||| | | || || ||| | | |||| | | +----- bit 3 mask 0x000000000008 + || |||| | | || || ||| | | |||| | +------- bit 5 mask 0x000000000020 + || |||| | | || || ||| | | |||| +---------- bit 8 mask 0x000000000100 + || |||| | | || || ||| | | |||+--------------- bit 13 mask 0x000000002000 + || |||| | | || || ||| | | ||+---------------- bit 14 mask 0x000000004000 + || |||| | | || || ||| | | |+----------------- bit 15 mask 0x000000008000 + || |||| | | || || ||| | | +------------------ bit 16 mask 0x000000010000 + || |||| | | || || ||| | +---------------------- bit 20 mask 0x000000100000 + || |||| | | || || ||| +--------------------------- bit 25 mask 0x000002000000 + || |||| | | || || ||+----------------------------- bit 27 mask 0x000008000000 + || |||| | | || || |+------------------------------ bit 28 mask 0x000010000000 + || |||| | | || || +------------------------------- bit 29 mask 0x000020000000 + || |||| | | || |+--------------------------------- bit 31 mask 0x000080000000 + || |||| | | || +---------------------------------- bit 32 mask 0x000100000000 + || |||| | | |+------------------------------------ bit 34 mask 0x000400000000 + || |||| | | +------------------------------------- bit 35 mask 0x000800000000 + || |||| | +--------------------------------------- bit 37 mask 0x002000000000 + || |||| +----------------------------------------- bit 39 mask 0x008000000000 + || |||+------------------------------------------- bit 41 mask 0x020000000000 + || ||+-------------------------------------------- bit 42 mask 0x040000000000 + || |+--------------------------------------------- bit 43 mask 0x080000000000 + || +---------------------------------------------- bit 44 mask 0x100000000000 + |+------------------------------------------------ bit 46 mask 0x400000000000 + +------------------------------------------------- bit 47 mask 0x800000000000 + + + badb100d + 10111010110110110001000000001101 + 10111010110110110001000000001101 + | ||| | || || || | || | + | ||| | || || || | || +-- bit 0 mask 0x00000001 + | ||| | || || || | |+---- bit 2 mask 0x00000004 + | ||| | || || || | +----- bit 3 mask 0x00000008 + | ||| | || || || +-------------- bit 12 mask 0x00001000 + | ||| | || || |+------------------ bit 16 mask 0x00010000 + | ||| | || || +------------------- bit 17 mask 0x00020000 + | ||| | || |+--------------------- bit 19 mask 0x00080000 + | ||| | || +---------------------- bit 20 mask 0x00100000 + | ||| | |+------------------------ bit 22 mask 0x00400000 + | ||| | +------------------------- bit 23 mask 0x00800000 + | ||| +--------------------------- bit 25 mask 0x02000000 + | ||+----------------------------- bit 27 mask 0x08000000 + | |+------------------------------ bit 28 mask 0x10000000 + | +------------------------------- bit 29 mask 0x20000000 + +--------------------------------- bit 31 mask 0x80000000 + + + baddefec8ed + 10111010110111011110111111101100100011101101 + 10111010110111011110111111101100100011101101 + | ||| | || ||| |||| ||||||| || | ||| || | + | ||| | || ||| |||| ||||||| || | ||| || +-- bit 0 mask 0x00000000001 + | ||| | || ||| |||| ||||||| || | ||| |+---- bit 2 mask 0x00000000004 + | ||| | || ||| |||| ||||||| || | ||| +----- bit 3 mask 0x00000000008 + | ||| | || ||| |||| ||||||| || | ||+------- bit 5 mask 0x00000000020 + | ||| | || ||| |||| ||||||| || | |+-------- bit 6 mask 0x00000000040 + | ||| | || ||| |||| ||||||| || | +--------- bit 7 mask 0x00000000080 + | ||| | || ||| |||| ||||||| || +------------- bit 11 mask 0x00000000800 + | ||| | || ||| |||| ||||||| |+---------------- bit 14 mask 0x00000004000 + | ||| | || ||| |||| ||||||| +----------------- bit 15 mask 0x00000008000 + | ||| | || ||| |||| ||||||+------------------- bit 17 mask 0x00000020000 + | ||| | || ||| |||| |||||+-------------------- bit 18 mask 0x00000040000 + | ||| | || ||| |||| ||||+--------------------- bit 19 mask 0x00000080000 + | ||| | || ||| |||| |||+---------------------- bit 20 mask 0x00000100000 + | ||| | || ||| |||| ||+----------------------- bit 21 mask 0x00000200000 + | ||| | || ||| |||| |+------------------------ bit 22 mask 0x00000400000 + | ||| | || ||| |||| +------------------------- bit 23 mask 0x00000800000 + | ||| | || ||| |||+--------------------------- bit 25 mask 0x00002000000 + | ||| | || ||| ||+---------------------------- bit 26 mask 0x00004000000 + | ||| | || ||| |+----------------------------- bit 27 mask 0x00008000000 + | ||| | || ||| +------------------------------ bit 28 mask 0x00010000000 + | ||| | || ||+-------------------------------- bit 30 mask 0x00040000000 + | ||| | || |+--------------------------------- bit 31 mask 0x00080000000 + | ||| | || +---------------------------------- bit 32 mask 0x00100000000 + | ||| | |+------------------------------------ bit 34 mask 0x00400000000 + | ||| | +------------------------------------- bit 35 mask 0x00800000000 + | ||| +--------------------------------------- bit 37 mask 0x02000000000 + | ||+----------------------------------------- bit 39 mask 0x08000000000 + | |+------------------------------------------ bit 40 mask 0x10000000000 + | +------------------------------------------- bit 41 mask 0x20000000000 + +--------------------------------------------- bit 43 mask 0x80000000000 + + diff --git a/usr/src/cmd/mdb/test/format/tst.format-p.mdb b/usr/src/cmd/mdb/test/format/tst.format-p.mdb new file mode 100644 index 0000000000..ee2b989d1b --- /dev/null +++ b/usr/src/cmd/mdb/test/format/tst.format-p.mdb @@ -0,0 +1 @@ +1<<0t63,10=p diff --git a/usr/src/cmd/mdb/test/format/tst.format-p.mdb.out b/usr/src/cmd/mdb/test/format/tst.format-p.mdb.out new file mode 100644 index 0000000000..65e05e7220 --- /dev/null +++ b/usr/src/cmd/mdb/test/format/tst.format-p.mdb.out @@ -0,0 +1,6 @@ + 0x8000000000000000 0x8000000000000000 0x8000000000000000 + 0x8000000000000000 0x8000000000000000 0x8000000000000000 + 0x8000000000000000 0x8000000000000000 0x8000000000000000 + 0x8000000000000000 0x8000000000000000 0x8000000000000000 + 0x8000000000000000 0x8000000000000000 0x8000000000000000 + 0x8000000000000000 diff --git a/usr/src/cmd/mdb/test/options/tst.autowrap.mdb b/usr/src/cmd/mdb/test/options/tst.autowrap.mdb index 5c62e288d3..5904cbf4c7 100644 --- a/usr/src/cmd/mdb/test/options/tst.autowrap.mdb +++ b/usr/src/cmd/mdb/test/options/tst.autowrap.mdb @@ -2,7 +2,14 @@ ::typedef -c lp32 0::printf "Pack my box with five dozen liquor jugs. How razorback-jumping frogs can level six piqued gymnasts! Amazingly few discotheques provide jukeboxes.%d" int . +0::printf "%-79d%d" int . . +0::printf "%-80d%d" int . . +0::printf "%-81d%d" int . . + ::set -o autowrap 0::printf "Pack my box with five dozen liquor jugs. How razorback-jumping frogs can level six piqued gymnasts! Amazingly few discotheques provide jukeboxes.%d" int . +0::printf "%-79d%d" int . . +0::printf "%-80d%d" int . . +0::printf "%-81d%d" int . . diff --git a/usr/src/cmd/mdb/test/options/tst.autowrap.mdb.out b/usr/src/cmd/mdb/test/options/tst.autowrap.mdb.out new file mode 100644 index 0000000000..81d3ef5293 --- /dev/null +++ b/usr/src/cmd/mdb/test/options/tst.autowrap.mdb.out @@ -0,0 +1,11 @@ +Pack my box with five dozen liquor jugs. How razorback-jumping frogs can level six piqued gymnasts! Amazingly few discotheques provide jukeboxes.0 +0 0 +0 0 +0 0 +Pack my box with five dozen liquor jugs. How razorback-jumping frogs can level s +ix piqued gymnasts! Amazingly few discotheques provide jukeboxes.0 +0 0 +0 +0 +0 +0 diff --git a/usr/src/man/man1/mdb.1 b/usr/src/man/man1/mdb.1 index 55640c5fab..8fdd91e661 100644 --- a/usr/src/man/man1/mdb.1 +++ b/usr/src/man/man1/mdb.1 @@ -1,11 +1,11 @@ '\" te .\" Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved. -.\" Copyright (c) 2017, Joyent, Inc. All Rights Reserved. +.\" Copyright (c) 2019, Joyent, Inc. All Rights Reserved. .\" Copyright (c) 2014, 2017 by Delphix. All rights reserved. .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH MDB 1 "Dec 9, 2017" +.TH MDB 1 "Feb 21, 2019" .SH NAME mdb \- modular debugger .SH SYNOPSIS @@ -1345,7 +1345,7 @@ N newline O octal unsigned int (4 bytes) P symbol (4 or 8 bytes) Q octal signed int (4 bytes) -R binary int (8 bytes) +R binary unsigned long long (8 bytes) S T{ string using C string notation (variable size) T} @@ -1368,6 +1368,7 @@ f float (4 bytes) g octal signed long long (8 bytes) h swap bytes (2 bytes) i disassembled instruction (variable size) +j jazzed-up binary unsigned long long (8 bytes) n newline o octal unsigned short (2 bytes) p symbol (4 or 8 bytes) |