Skip to content

Commit

Permalink
threadsnoop: look for pthread_create in libc too
Browse files Browse the repository at this point in the history
Since glibc 2.34, pthread features are integrated in libc directly.
Look for pthread_create there too when it is not found in libpthread.

Fixes iovisor#3623
  • Loading branch information
jeromemarchand authored and yonghong-song committed Sep 17, 2021
1 parent 44fc17f commit 039a381
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/threadsnoop.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@
events.perf_submit(ctx, &data, sizeof(data));
};
""")
b.attach_uprobe(name="pthread", sym="pthread_create", fn_name="do_entry")

# Since version 2.34, pthread features are integrated in libc
try:
b.attach_uprobe(name="pthread", sym="pthread_create", fn_name="do_entry")
except Exception:
b.attach_uprobe(name="c", sym="pthread_create", fn_name="do_entry")

print("%-10s %-6s %-16s %s" % ("TIME(ms)", "PID", "COMM", "FUNC"))

Expand Down

0 comments on commit 039a381

Please sign in to comment.