elf_mem_map: allow to customize the name column's width

This commit is contained in:
Yuri D'Elia 2021-06-05 17:22:25 +02:00 committed by DRracer
parent 7f76f62af9
commit 29513a369d

View File

@ -233,7 +233,7 @@ def decode_dump(path):
return (buf_addr, buf_data) return (buf_addr, buf_data)
def annotate_refs(grefs, addr, data, width=45, gaps=True, overlaps=True): def annotate_refs(grefs, addr, data, width=46, gaps=True, overlaps=True):
last_end = None last_end = None
for entry in grefs: for entry in grefs:
if entry.loc < addr: if entry.loc < addr:
@ -290,6 +290,8 @@ def main():
help='do not decode structure data') help='do not decode structure data')
ap.add_argument('--overlaps', action='store_true', ap.add_argument('--overlaps', action='store_true',
help='annotate overlaps greater than 1 byte') help='annotate overlaps greater than 1 byte')
ap.add_argument('--name-width', type=int, default=46,
help='set name column width')
g = ap.add_mutually_exclusive_group(required=True) g = ap.add_mutually_exclusive_group(required=True)
g.add_argument('dump', nargs='?', help='RAM dump obtained from D2 g-code') g.add_argument('dump', nargs='?', help='RAM dump obtained from D2 g-code')
g.add_argument('--map', action='store_true', help='dump global memory map') g.add_argument('--map', action='store_true', help='dump global memory map')
@ -302,6 +304,7 @@ def main():
else: else:
addr, data = decode_dump(args.dump) addr, data = decode_dump(args.dump)
annotate_refs(grefs, addr, data, annotate_refs(grefs, addr, data,
width=args.name_width,
gaps=not args.no_gaps, gaps=not args.no_gaps,
overlaps=args.overlaps) overlaps=args.overlaps)