Project

General

Profile

Actions

Bug #14317

closed

mdb misprints certain bitfields

Added by Robert Mustacchi 8 months ago. Updated 7 months ago.

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

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

While working through some cases, I noticed that mdb was misprinting a bitfield. Looking into the details, the problem here is the following set of circumstances:

  • We had a bitfield that straddled a byte boundary
  • The bitfield size itself did not consume more than one byte

This caused mdb to only read one byte and not the two that it needed to extract the entire bitfield. The fix here is in those circumstances that we need to read one more byte and then mask out from the target. This fixes that particular issue and adds additional regression tests.

Actions #1

Updated by Electric Monk 7 months ago

  • Gerrit CR set to 1913
Actions #2

Updated by Robert Mustacchi 7 months ago

I tested this by running the mdb test suite with updated regression tests:

Starting tests...
mdbtest target: /usr/bin/mdb
output directory: /var/tmp/mdbtest.545
Executing test ./options/tst.autowrap.mdb ... passed
Executing test ./typedef/err.badmodel.ksh ... passed
Executing test ./typedef/tst.deftypes64.mdb ... passed
Executing test ./typedef/err.noargs.ksh ... passed
Executing test ./typedef/err.badstruct-noarrayopen.ksh ... passed
Executing test ./typedef/tst.union.mdb ... passed
Executing test ./typedef/tst.deftypes32.mdb ... passed
Executing test ./typedef/tst.structselfref.mdb ... passed
Executing test ./typedef/tst.cleanupstruct.ksh ... passed
Executing test ./typedef/tst.emptylist.mdb ... passed
Executing test ./typedef/err.badstruct-nomemname.ksh ... passed
Executing test ./typedef/err.badstruct-zerolenarr.ksh ... passed
Executing test ./typedef/err.badstruct-nomembers.ksh ... passed
Executing test ./typedef/tst.anonstruct.mdb ... passed
Executing test ./typedef/tst.models.ksh ... passed
Executing test ./typedef/err.badstruct-noarraylen.ksh ... passed
Executing test ./typedef/err.badstruct-nobraces.ksh ... passed
Executing test ./typedef/tst.dellist.mdb ... passed
Executing test ./typedef/err.badstruct-repmemname.ksh ... passed
Executing test ./typedef/err.extraargs.ksh ... passed
Executing test ./typedef/err.badstruct-neglenarr.ksh ... passed
Executing test ./typedef/err.badstruct-noarrayclose.ksh ... passed
Executing test ./typedef/err.nokeyword.ksh ... passed
Executing test ./typedef/err.typeexists.ksh ... passed
Executing test ./typedef/err.badid-leadschar.ksh ... passed
Executing test ./typedef/tst.structvla.mdb ... passed
Executing test ./typedef/tst.struct.mdb ... passed
Executing test ./typedef/err.badstruct-nomemsemi.ksh ... passed
Executing test ./typedef/err.badunion-hasvla.ksh ... passed
Executing test ./typedef/err.badstruct-noclosebrace.ksh ... passed
Executing test ./typedef/tst.libctype.ksh ... passed
Executing test ./typedef/err.badstruct-noquotes.ksh ... passed
Executing test ./typedef/err.noname.ksh ... passed
Executing test ./typedef/tst.anonunion.mdb ... passed
Executing test ./typedef/err.badstruct-vlaonly.ksh ... passed
Executing test ./typedef/err.nomodel.ksh ... passed
Executing test ./typedef/err.badid-leadnum.ksh ... passed
Executing test ./typedef/err.badstruct-noopenbrace.ksh ... passed
Executing test ./typedef/err.badstruct-extrabraces.ksh ... passed
Executing test ./exit-e/err.unmapped.ksh ... passed
Executing test ./exit-e/tst.simple.ksh ... passed
Executing test ./exit-e/err.nowrite.ksh ... passed
Executing test ./exit-e/err.enocmd.ksh ... passed
Executing test ./exit-e/tst.output.ksh ... passed
Executing test ./exit-e/err.cmdbadopt.ksh ... passed
Executing test ./numbers/tst.octal.mdb ... passed
Executing test ./numbers/tst.prefsym.ksh ... passed
Executing test ./numbers/tst.bitfields.ksh ... passed
Executing test ./numbers/tst.badnums.ksh ... passed
Executing test ./numbers/tst.base10.mdb ... passed
Executing test ./numbers/tst.hex.mdb ... passed
Executing test ./numbers/tst.binary.mdb ... passed
Executing test ./format/tst.format-cap-J.mdb ... passed
Executing test ./format/tst.format-g.mdb ... passed
Executing test ./format/tst.format-cap-P.mdb ... passed
Executing test ./format/tst.format-cap-E.mdb ... passed
Executing test ./format/tst.format-e.mdb ... passed
Executing test ./format/tst.format-p.mdb ... passed
Executing test ./format/tst.format-cap-G.mdb ... passed
Executing test ./format/tst.format-j.mdb ... passed
Executing test ./format/tst.format-cap-R.mdb ... passed

-------------
Results
-------------

Tests passed: 61
Tests failed: 0
Tests ran:    61

Congrats, mdb isn't completely broken, the tests pass.

I also went and with mdb -k, ran ::pgrep ssh | ::print proc_t ! cat > a.out on old bits and with this change present (to a different file). I then compared things. The only difference was in some of the time tracking elements (e.g. pr_utime, pr_stime).

Actions #3

Updated by Electric Monk 7 months ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit 7a58f53801acca2cd594b9ecb75bf926e4fb3eda

commit  7a58f53801acca2cd594b9ecb75bf926e4fb3eda
Author: Robert Mustacchi <rm@fingolfin.org>
Date:   2022-01-15T00:41:16.000Z

    14317 mdb misprints certain bitfields
    6461 mdb incorrectly prints byte-sized things at a bit-offset
    14316 want means to leverage ctfconvert in one go in the build
    Reviewed by: Yuri Pankov <ypankov@tintri.com>
    Reviewed by: Andy Fiddaman <andy@omnios.org>
    Reviewed by: Toomas Soome <tsoome@me.com>
    Approved by: Rich Lowe <richlowe@richlowe.net>

Actions

Also available in: Atom PDF