Tweaked dbgbtree.py to show higher names when -i is not specified

This avoids showing vestigial names in a case where they could be really
confusing.
This commit is contained in:
Christopher Haster
2023-03-20 22:35:01 -05:00
parent 23956cc25b
commit f4e2a1a9b4

View File

@@ -491,6 +491,16 @@ def main(disk, block_size=None, trunk=0, limit=None, *,
corrupted = True
continue
# if we're not showing inner nodes, prefer names higher in the tree
# since this avoids showing vestigial names
if not args.get('inner'):
for (id_, w_, rbyd_, rid_, tag_,
name_j_, name_d_, name_,
struct_j_, struct_d_, struct__) in reversed(path):
name_j, name_d, name = name_j_, name_d_, name_
if rid_-(w_-1) != 0:
break
# show human-readable representation
print('%10s %s%*s %-8s %-22s %s' % (
'%04x.%04x:' % (rbyd.block, rbyd.limit)