Skip to content

Commit

Permalink
trace: Migrate to new symbols API and remove addresses from stacks
Browse files Browse the repository at this point in the history
  • Loading branch information
goldshtn committed Feb 21, 2017
1 parent 2f78068 commit 1e34f4e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tools/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,8 @@ def print_stack(self, bpf, stack_id, tgid):

stack = list(bpf.get_table(self.stacks_name).walk(stack_id))
for addr in stack:
print(" %016x %s" % (addr, bpf.sym(addr, tgid)))
print(" %s" % (bpf.sym(addr, tgid,
show_module=True, show_address=True)))

def _format_message(self, bpf, tgid, values):
# Replace each %K with kernel sym and %U with user sym in tgid
Expand All @@ -466,9 +467,10 @@ def _format_message(self, bpf, tgid, values):
user_placeholders = [i for i, t in enumerate(self.types)
if t == 'U']
for kp in kernel_placeholders:
values[kp] = bpf.ksymaddr(values[kp])
values[kp] = bpf.ksym(values[kp], show_address=True)
for up in user_placeholders:
values[up] = bpf.symaddr(values[up], tgid)
values[up] = bpf.sym(values[up], tgid,
show_module=True, show_address=True)
return self.python_format % tuple(values)

def print_event(self, bpf, cpu, data, size):
Expand Down

0 comments on commit 1e34f4e

Please sign in to comment.