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:
+2
-11
@@ -836,18 +836,12 @@ def main(disk, roots=None, *,
|
|||||||
else '',
|
else '',
|
||||||
tagrepr(tag, w if i == 0 else 0, len(data), None),
|
tagrepr(tag, w if i == 0 else 0, len(data), None),
|
||||||
# note we render names a bit different here
|
# note we render names a bit different here
|
||||||
''.join(
|
next(xxd(data, 8), '') if not args.get('no_truncate')
|
||||||
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')
|
|
||||||
else ''))
|
else ''))
|
||||||
prbyd = rbyd
|
prbyd = rbyd
|
||||||
|
|
||||||
# show in-device representation
|
# show in-device representation
|
||||||
if args.get('device'):
|
if args.get('device'):
|
||||||
for i, (tag, j, d, data) in enumerate(tags):
|
|
||||||
print('%9s %*s%*s %-22s%s' % (
|
print('%9s %*s%*s %-22s%s' % (
|
||||||
'',
|
'',
|
||||||
t_width, '',
|
t_width, '',
|
||||||
@@ -859,7 +853,6 @@ def main(disk, roots=None, *,
|
|||||||
for i in range(min(m.ceil(len(data)/4), 3)))[:23]))
|
for i in range(min(m.ceil(len(data)/4), 3)))[:23]))
|
||||||
|
|
||||||
# show on-disk encoding of tags/data
|
# show on-disk encoding of tags/data
|
||||||
for i, (tag, j, d, data) in enumerate(tags):
|
|
||||||
if args.get('raw'):
|
if args.get('raw'):
|
||||||
for o, line in enumerate(xxd(rbyd.data[j:j+d])):
|
for o, line in enumerate(xxd(rbyd.data[j:j+d])):
|
||||||
print('%9s: %*s%*s %s' % (
|
print('%9s: %*s%*s %s' % (
|
||||||
@@ -867,9 +860,7 @@ def main(disk, roots=None, *,
|
|||||||
t_width, '',
|
t_width, '',
|
||||||
w_width, '',
|
w_width, '',
|
||||||
line))
|
line))
|
||||||
# note we don't render name tags with no_truncate
|
if args.get('raw') or args.get('no_truncate'):
|
||||||
if args.get('raw') or (
|
|
||||||
args.get('no_truncate') and tag & 0xf00f != TAG_NAME):
|
|
||||||
for o, line in enumerate(xxd(data)):
|
for o, line in enumerate(xxd(data)):
|
||||||
print('%9s: %*s%*s %s' % (
|
print('%9s: %*s%*s %s' % (
|
||||||
'%04x' % (j+d + o*16),
|
'%04x' % (j+d + o*16),
|
||||||
|
|||||||
+5
-14
@@ -1360,18 +1360,12 @@ def main(disk, mroots=None, *,
|
|||||||
else '',
|
else '',
|
||||||
tagrepr(tag, w if i == 0 else 0, len(data), None),
|
tagrepr(tag, w if i == 0 else 0, len(data), None),
|
||||||
# note we render names a bit different here
|
# note we render names a bit different here
|
||||||
''.join(
|
next(xxd(data, 8), '') if not args.get('no_truncate')
|
||||||
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')
|
|
||||||
else ''))
|
else ''))
|
||||||
prbyd = rbyd
|
prbyd = rbyd
|
||||||
|
|
||||||
# show in-device representation
|
# show in-device representation
|
||||||
if args.get('device'):
|
if args.get('device'):
|
||||||
for i, (tag, j, d, data) in enumerate(tags):
|
|
||||||
print('%11s %*s%*s %-22s%s' % (
|
print('%11s %*s%*s %-22s%s' % (
|
||||||
'',
|
'',
|
||||||
t_width, '',
|
t_width, '',
|
||||||
@@ -1383,7 +1377,6 @@ def main(disk, mroots=None, *,
|
|||||||
for i in range(min(m.ceil(len(data)/4), 3)))[:23]))
|
for i in range(min(m.ceil(len(data)/4), 3)))[:23]))
|
||||||
|
|
||||||
# show on-disk encoding of tags/data
|
# show on-disk encoding of tags/data
|
||||||
for i, (tag, j, d, data) in enumerate(tags):
|
|
||||||
if args.get('raw'):
|
if args.get('raw'):
|
||||||
for o, line in enumerate(xxd(rbyd.data[j:j+d])):
|
for o, line in enumerate(xxd(rbyd.data[j:j+d])):
|
||||||
print('%11s: %*s%*s %s' % (
|
print('%11s: %*s%*s %s' % (
|
||||||
@@ -1391,9 +1384,7 @@ def main(disk, mroots=None, *,
|
|||||||
t_width, '',
|
t_width, '',
|
||||||
w_width, '',
|
w_width, '',
|
||||||
line))
|
line))
|
||||||
# note we don't render name tags with no_truncate
|
if args.get('raw') or args.get('no_truncate'):
|
||||||
if args.get('raw') or (
|
|
||||||
args.get('no_truncate') and tag & 0x7f00 != TAG_NAME):
|
|
||||||
for o, line in enumerate(xxd(data)):
|
for o, line in enumerate(xxd(data)):
|
||||||
print('%11s: %*s%*s %s' % (
|
print('%11s: %*s%*s %s' % (
|
||||||
'%04x' % (j+d + o*16),
|
'%04x' % (j+d + o*16),
|
||||||
@@ -1402,9 +1393,9 @@ def main(disk, mroots=None, *,
|
|||||||
line))
|
line))
|
||||||
|
|
||||||
|
|
||||||
# print the actual mroot
|
# print some information about the mtree
|
||||||
print('mroot %s, rev %d, weight %d' % (
|
print('mtree %s, rev %d, weight %d' % (
|
||||||
mroot.addr(), mroot.rev, mroot.weight))
|
mroot.addr(), mroot.rev, mweight))
|
||||||
|
|
||||||
# print header
|
# print header
|
||||||
w_width = (m.ceil(m.log10(max(1, mweight)+1))
|
w_width = (m.ceil(m.log10(max(1, mweight)+1))
|
||||||
|
|||||||
Reference in New Issue
Block a user