From 9e8ec35e238b32eebdedaad450332101011a8535 Mon Sep 17 00:00:00 2001 From: Roger Barton Date: Mon, 15 Jan 2024 17:01:30 +0100 Subject: [PATCH] annotate objdump instead of trace option --- util/trace/annotate.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/util/trace/annotate.py b/util/trace/annotate.py index 512556190..4d2c94862 100755 --- a/util/trace/annotate.py +++ b/util/trace/annotate.py @@ -75,6 +75,12 @@ '--keep-time', action='store_true', help='Preserve simulation time in trace') +parser.add_argument( + '--is-objdump', + action='store_true', + default=False, + help='Enable this to annotate a .dump file instead of a trace.' +) parser.add_argument( '-q', '--quiet', @@ -90,6 +96,7 @@ addr2line = args.addr2line quiet = args.quiet keep_time = args.keep_time +is_objdump = args.is_objdump if not quiet: print('elf:', elf_file, file=sys.stderr) @@ -194,13 +201,13 @@ def dump_hunk(hunk_tstart, hunk_sstart, hunk_trace, hunk_source): for lino, line in enumerate(trace_lines): # Split trace line in columns - cols = re.split(r" +", line.strip()) + cols = re.split(r":" if is_objdump else r" +", line.strip()) # Get simulation time from first column - time = cols[0] + time = 0 if is_objdump else cols[0] # RTL traces might not contain a PC on each line try: # Get address from PC column - addr = cols[3] + addr = cols[0 if is_objdump else 3] # Find index of first character in PC if trace_start_col < 0: trace_start_col = line.find(addr)