Skip to content

Commit

Permalink
vverbose: don't use plural "calls" when there's a single call
Browse files Browse the repository at this point in the history
  • Loading branch information
williballenthin committed Jan 29, 2025
1 parent 9a0c4f7 commit 4f84453
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion capa/render/verbose.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,18 @@ def render_thread(layout: rd.DynamicLayout, addr: frz.Address) -> str:

def render_span_of_calls(layout: rd.DynamicLayout, addrs: list[frz.Address]) -> str:
calls: list[capa.features.address.DynamicCallAddress] = [addr.to_capa() for addr in addrs] # type: ignore
assert len(calls) > 0
for call in calls:
assert isinstance(call, capa.features.address.DynamicCallAddress)
call = calls[0]

pname = _get_process_name(layout, frz.Address.from_capa(calls[0].thread.process))
call_ids = [str(call.id) for call in calls]
return f"{pname}{{pid:{call.thread.process.pid},tid:{call.thread.tid},calls:{{{','.join(call_ids)}}}}}"
if len(call_ids) == 1:
call_id = call_ids[0]
return f"{pname}{{pid:{call.thread.process.pid},tid:{call.thread.tid},call:{call_id}}}"
else:
return f"{pname}{{pid:{call.thread.process.pid},tid:{call.thread.tid},calls:{{{','.join(call_ids)}}}}}"


def render_call(layout: rd.DynamicLayout, addr: frz.Address) -> str:
Expand Down

0 comments on commit 4f84453

Please sign in to comment.