Dropped the header from dbg scripts

I had never noticed xxd has no header until comparing its output against
dbgblock.py. Turns out these headers aren't really all that useful, and
even sometimes wrong in dbglfs.py.
This commit is contained in:
Christopher Haster
2023-09-15 17:42:00 -05:00
parent 2cdd03c8fd
commit dd6a4e6496
5 changed files with 5 additions and 49 deletions
-3
View File
@@ -87,9 +87,6 @@ def main(disk, block=None, *,
f.seek((block * block_size) + (off or 0)) f.seek((block * block_size) + (off or 0))
data = f.read(size) data = f.read(size)
# print header
print('%-8s %s' % ('off', 'data'))
# render the hex view # render the hex view
for o, line in enumerate(xxd(data)): for o, line in enumerate(xxd(data)):
print('%08x: %s' % ((off or 0) + 16*o, line)) print('%08x: %s' % ((off or 0) + 16*o, line))
+1 -8
View File
@@ -827,15 +827,8 @@ def main(disk, roots=None, *,
return '%s ' % ''.join(trunk) return '%s ' % ''.join(trunk)
# print header # dynamically size the id field
w_width = 2*m.ceil(m.log10(max(1, btree.weight)+1))+1 w_width = 2*m.ceil(m.log10(max(1, btree.weight)+1))+1
print('%-9s %*s%-*s %-22s %s' % (
'rbyd',
t_width, '',
w_width, 'bid',
'tag',
'data (truncated)'
if not args.get('no_truncate') else ''))
# prbyd here means the last rendered rbyd, we update # prbyd here means the last rendered rbyd, we update
# in dbg_branch to always print interleaved addresses # in dbg_branch to always print interleaved addresses
+1 -14
View File
@@ -1094,23 +1094,10 @@ def main(disk, mroots=None, *,
config.version[1] if config.version[1] is not None else '?', config.version[1] if config.version[1] is not None else '?',
mroot.addr(), mroot.rev, bweight//mleaf_weight, 1*mleaf_weight)) mroot.addr(), mroot.rev, bweight//mleaf_weight, 1*mleaf_weight))
# print header # dynamically size the id field
w_width = (m.ceil(m.log10(max(1, bweight//mleaf_weight)+1)) w_width = (m.ceil(m.log10(max(1, bweight//mleaf_weight)+1))
+ 2*m.ceil(m.log10(max(1, rweight)+1)) + 2*m.ceil(m.log10(max(1, rweight)+1))
+ 2) + 2)
if dtree:
print('%-11s %-*s %-*s %s' % (
'mdir',
w_width, 'mid',
f_width, 'name',
'type'))
else:
print('%-11s %-*s %-22s %s' % (
'mdir',
w_width, 'mid',
'tag',
'data (truncated)'
if not args.get('no_truncate') else ''))
# print config? # print config?
if args.get('config'): if args.get('config'):
+1 -8
View File
@@ -1433,17 +1433,10 @@ def main(disk, mroots=None, *,
print('mtree %s, rev %d, weight %d.%d' % ( print('mtree %s, rev %d, weight %d.%d' % (
mroot.addr(), mroot.rev, bweight//mleaf_weight, 1*mleaf_weight)) mroot.addr(), mroot.rev, bweight//mleaf_weight, 1*mleaf_weight))
# print header # dynamically size the id field
w_width = (m.ceil(m.log10(max(1, bweight//mleaf_weight)+1)) w_width = (m.ceil(m.log10(max(1, bweight//mleaf_weight)+1))
+ 2*m.ceil(m.log10(max(1, rweight)+1)) + 2*m.ceil(m.log10(max(1, rweight)+1))
+ 2) + 2)
print('%-11s %*s%-*s %-22s %s' % (
'mdir',
t_width, '',
w_width, 'mid',
'tag',
'data (truncated)'
if not args.get('no_truncate') else ''))
# show each mroot # show each mroot
prbyd = None prbyd = None
+2 -16
View File
@@ -436,15 +436,8 @@ def dbg_log(data, block_size, rev, off, weight, *,
lifetime_width - sum(len(r) for r in reprs), '') lifetime_width - sum(len(r) for r in reprs), '')
# print header # dynamically size the id field
w_width = 2*m.ceil(m.log10(max(1, weight)+1))+1 w_width = 2*m.ceil(m.log10(max(1, weight)+1))+1
print('%-8s %*s%-*s %-22s %s' % (
'off',
lifetime_width, '',
w_width, 'rid',
'tag',
'data (truncated)'
if not args.get('no_truncate') else ''))
# print revision count # print revision count
if args.get('raw'): if args.get('raw'):
@@ -765,15 +758,8 @@ def dbg_tree(data, block_size, rev, trunk, weight, *,
return '%s ' % ''.join(trunk) return '%s ' % ''.join(trunk)
# print header # dynamically size the id field
w_width = 2*m.ceil(m.log10(max(1, weight)+1))+1 w_width = 2*m.ceil(m.log10(max(1, weight)+1))+1
print('%-8s %*s%-*s %-22s %s' % (
'off',
t_width, '',
w_width, 'rid',
'tag',
'data (truncated)'
if not args.get('no_truncate') else ''))
rid, tag = -1, 0 rid, tag = -1, 0
while True: while True: