Skip to content

Commit 77615d4

Browse files
asd142513yonghong-song
authored andcommitted
tools/profile: decode bytes to str
1 parent 80b1e77 commit 77615d4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tools/profile.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -335,29 +335,29 @@ def aksym(addr):
335335
# print folded stack output
336336
user_stack = list(user_stack)
337337
kernel_stack = list(kernel_stack)
338-
line = [k.name]
338+
line = [k.name.decode('utf-8', 'replace')]
339339
# if we failed to get the stack is, such as due to no space (-ENOMEM) or
340340
# hash collision (-EEXIST), we still print a placeholder for consistency
341341
if not args.kernel_stacks_only:
342342
if stack_id_err(k.user_stack_id):
343-
line.append(b"[Missed User Stack]")
343+
line.append("[Missed User Stack]")
344344
else:
345-
line.extend([b.sym(addr, k.pid) for addr in reversed(user_stack)])
345+
line.extend([b.sym(addr, k.pid).decode('utf-8', 'replace') for addr in reversed(user_stack)])
346346
if not args.user_stacks_only:
347-
line.extend([b"-"] if (need_delimiter and k.kernel_stack_id >= 0 and k.user_stack_id >= 0) else [])
347+
line.extend(["-"] if (need_delimiter and k.kernel_stack_id >= 0 and k.user_stack_id >= 0) else [])
348348
if stack_id_err(k.kernel_stack_id):
349-
line.append(b"[Missed Kernel Stack]")
349+
line.append("[Missed Kernel Stack]")
350350
else:
351-
line.extend([aksym(addr) for addr in reversed(kernel_stack)])
352-
print("%s %d" % (b";".join(line).decode('utf-8', 'replace'), v.value))
351+
line.extend([aksym(addr).decode('utf-8', 'replace') for addr in reversed(kernel_stack)])
352+
print("%s %d" % (";".join(line), v.value))
353353
else:
354354
# print default multi-line stack output
355355
if not args.user_stacks_only:
356356
if stack_id_err(k.kernel_stack_id):
357357
print(" [Missed Kernel Stack]")
358358
else:
359359
for addr in kernel_stack:
360-
print(" %s" % aksym(addr))
360+
print(" %s" % aksym(addr).decode('utf-8', 'replace'))
361361
if not args.kernel_stacks_only:
362362
if need_delimiter and k.user_stack_id >= 0 and k.kernel_stack_id >= 0:
363363
print(" --")

0 commit comments

Comments
 (0)