Some dbg script work
- Changed how names are rendered in dbgbtree.py/dbgmtree.py to be consistent with non-names. The special rendering isn't really worth it now that names aren't just ascii/utf8. - Changed the ordering of raw/device/human rendering of btree entries to be more consistent with rendering of other entries (don't attempt to group btree entries). - Changed dbgmtree.py header to show information about the mtree.
This commit is contained in:
+8
-17
@@ -1360,18 +1360,12 @@ def main(disk, mroots=None, *,
|
||||
else '',
|
||||
tagrepr(tag, w if i == 0 else 0, len(data), None),
|
||||
# note we render names a bit different here
|
||||
''.join(
|
||||
b if b >= ' ' and b <= '~' else '.'
|
||||
for b in map(chr, data))
|
||||
if tag & 0x7f00 == TAG_NAME
|
||||
else next(xxd(data, 8), '')
|
||||
if not args.get('no_truncate')
|
||||
next(xxd(data, 8), '') if not args.get('no_truncate')
|
||||
else ''))
|
||||
prbyd = rbyd
|
||||
|
||||
# show in-device representation
|
||||
if args.get('device'):
|
||||
for i, (tag, j, d, data) in enumerate(tags):
|
||||
# show in-device representation
|
||||
if args.get('device'):
|
||||
print('%11s %*s%*s %-22s%s' % (
|
||||
'',
|
||||
t_width, '',
|
||||
@@ -1382,8 +1376,7 @@ def main(disk, mroots=None, *,
|
||||
rbyd.data[j+d+i*4 : j+d + min(i*4+4,len(data))])
|
||||
for i in range(min(m.ceil(len(data)/4), 3)))[:23]))
|
||||
|
||||
# show on-disk encoding of tags/data
|
||||
for i, (tag, j, d, data) in enumerate(tags):
|
||||
# show on-disk encoding of tags/data
|
||||
if args.get('raw'):
|
||||
for o, line in enumerate(xxd(rbyd.data[j:j+d])):
|
||||
print('%11s: %*s%*s %s' % (
|
||||
@@ -1391,9 +1384,7 @@ def main(disk, mroots=None, *,
|
||||
t_width, '',
|
||||
w_width, '',
|
||||
line))
|
||||
# note we don't render name tags with no_truncate
|
||||
if args.get('raw') or (
|
||||
args.get('no_truncate') and tag & 0x7f00 != TAG_NAME):
|
||||
if args.get('raw') or args.get('no_truncate'):
|
||||
for o, line in enumerate(xxd(data)):
|
||||
print('%11s: %*s%*s %s' % (
|
||||
'%04x' % (j+d + o*16),
|
||||
@@ -1402,9 +1393,9 @@ def main(disk, mroots=None, *,
|
||||
line))
|
||||
|
||||
|
||||
# print the actual mroot
|
||||
print('mroot %s, rev %d, weight %d' % (
|
||||
mroot.addr(), mroot.rev, mroot.weight))
|
||||
# print some information about the mtree
|
||||
print('mtree %s, rev %d, weight %d' % (
|
||||
mroot.addr(), mroot.rev, mweight))
|
||||
|
||||
# print header
|
||||
w_width = (m.ceil(m.log10(max(1, mweight)+1))
|
||||
|
||||
Reference in New Issue
Block a user