Blame SOURCES/bcc-0.20.0-threadsnoop-look-for-pthread_create-in-libc-too.patch

c04935
From 460a71ab24ad511318342077ac9ef57df543375f Mon Sep 17 00:00:00 2001
c04935
From: Jerome Marchand <jmarchan@redhat.com>
c04935
Date: Thu, 16 Sep 2021 14:44:23 +0200
c04935
Subject: [PATCH] threadsnoop: look for pthread_create in libc too
c04935
c04935
Since glibc 2.34, pthread features are integrated in libc directly.
c04935
Look for pthread_create there too when it is not found in libpthread.
c04935
c04935
Fixes #3623
c04935
---
c04935
 tools/threadsnoop.py | 7 ++++++-
c04935
 1 file changed, 6 insertions(+), 1 deletion(-)
c04935
c04935
diff --git a/tools/threadsnoop.py b/tools/threadsnoop.py
c04935
index 04c5e680..471b0c3c 100755
c04935
--- a/tools/threadsnoop.py
c04935
+++ b/tools/threadsnoop.py
c04935
@@ -38,7 +38,12 @@ void do_entry(struct pt_regs *ctx) {
c04935
     events.perf_submit(ctx, &data, sizeof(data));
c04935
 };
c04935
 """)
c04935
-b.attach_uprobe(name="pthread", sym="pthread_create", fn_name="do_entry")
c04935
+
c04935
+# Since version 2.34, pthread features are integrated in libc
c04935
+try:
c04935
+    b.attach_uprobe(name="pthread", sym="pthread_create", fn_name="do_entry")
c04935
+except Exception:
c04935
+    b.attach_uprobe(name="c", sym="pthread_create", fn_name="do_entry")
c04935
 
c04935
 print("%-10s %-6s %-16s %s" % ("TIME(ms)", "PID", "COMM", "FUNC"))
c04935
 
c04935
-- 
c04935
2.31.1
c04935