Skip to content

Commit

Permalink
annotate objdump instead of trace option
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerbarton committed Jan 15, 2024
1 parent 3b2e6c1 commit 9e8ec35
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions util/trace/annotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 9e8ec35

Please sign in to comment.