From f4e2a1a9b4103cb901c60762f6496aec7e88b629 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Mon, 20 Mar 2023 22:35:01 -0500 Subject: [PATCH] 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. --- scripts/dbgbtree.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/dbgbtree.py b/scripts/dbgbtree.py index 60745b21..8ea1409c 100755 --- a/scripts/dbgbtree.py +++ b/scripts/dbgbtree.py @@ -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)