35 lines
1.1 KiB
Diff
35 lines
1.1 KiB
Diff
|
From 460a71ab24ad511318342077ac9ef57df543375f Mon Sep 17 00:00:00 2001
|
||
|
From: Jerome Marchand <jmarchan@redhat.com>
|
||
|
Date: Thu, 16 Sep 2021 14:44:23 +0200
|
||
|
Subject: [PATCH] threadsnoop: look for pthread_create in libc too
|
||
|
|
||
|
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 #3623
|
||
|
---
|
||
|
tools/threadsnoop.py | 7 ++++++-
|
||
|
1 file changed, 6 insertions(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/tools/threadsnoop.py b/tools/threadsnoop.py
|
||
|
index 04c5e680..471b0c3c 100755
|
||
|
--- a/tools/threadsnoop.py
|
||
|
+++ b/tools/threadsnoop.py
|
||
|
@@ -38,7 +38,12 @@ void do_entry(struct pt_regs *ctx) {
|
||
|
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"))
|
||
|
|
||
|
--
|
||
|
2.31.1
|
||
|
|