Skip to content

Commit

Permalink
Decode C strings into Python strings (iovisor#1847)
Browse files Browse the repository at this point in the history
Leftover from iovisor#986.
  • Loading branch information
juergenhoetzel authored and yonghong-song committed Jun 25, 2018
1 parent 203dbbd commit eba1483
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def aksym(addr):
# print folded stack output
user_stack = list(user_stack)
kernel_stack = list(kernel_stack)
line = [k.name.decode()]
line = [k.name]
# if we failed to get the stack is, such as due to no space (-ENOMEM) or
# hash collision (-EEXIST), we still print a placeholder for consistency
if not args.kernel_stacks_only:
Expand All @@ -318,7 +318,7 @@ def aksym(addr):
line.append("[Missed Kernel Stack]")
else:
line.extend([b.ksym(addr) for addr in reversed(kernel_stack)])
print("%s %d" % (";".join(line), v.value))
print("%s %d" % (b";".join(line).decode(), v.value))
else:
# print default multi-line stack output
if not args.user_stacks_only:
Expand All @@ -334,7 +334,7 @@ def aksym(addr):
print(" [Missed User Stack]")
else:
for addr in user_stack:
print(" %s" % b.sym(addr, k.pid))
print(" %s" % b.sym(addr, k.pid).decode())
print(" %-16s %s (%d)" % ("-", k.name.decode(), k.pid))
print(" %d\n" % v.value)

Expand Down

0 comments on commit eba1483

Please sign in to comment.