Skip to content

Commit

Permalink
fix line TypeError
Browse files Browse the repository at this point in the history
./profile.py -adf -p `pgrep -n main` 5
Traceback (most recent call last):
  File "./profile.py", line 342, in <module>
    print("%s %d" % (b";".join(line).decode('utf-8', 'replace'), v.value))
TypeError: sequence item 5: expected a bytes-like object, str found
  • Loading branch information
DavadDi authored and yonghong-song committed Jan 23, 2020
1 parent dbfb188 commit 0cafe55
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/profile.py
Expand Up @@ -330,13 +330,13 @@ def aksym(addr):
# hash collision (-EEXIST), we still print a placeholder for consistency
if not args.kernel_stacks_only:
if stack_id_err(k.user_stack_id):
line.append("[Missed User Stack]")
line.append(b"[Missed User Stack]")
else:
line.extend([b.sym(addr, k.pid) for addr in reversed(user_stack)])
if not args.user_stacks_only:
line.extend(["-"] if (need_delimiter and k.kernel_stack_id >= 0 and k.user_stack_id >= 0) else [])
line.extend(b["-"] if (need_delimiter and k.kernel_stack_id >= 0 and k.user_stack_id >= 0) else [])
if stack_id_err(k.kernel_stack_id):
line.append("[Missed Kernel Stack]")
line.append(b"[Missed Kernel Stack]")
else:
line.extend([aksym(addr) for addr in reversed(kernel_stack)])
print("%s %d" % (b";".join(line).decode('utf-8', 'replace'), v.value))
Expand Down

0 comments on commit 0cafe55

Please sign in to comment.