bcc/bcc-0.20.0-threadsnoop-look-for-pthread_create-in-libc-too.patch
Jerome Marchand 019ff871c7 Misc fixes (bz1992430)
- Sync with latest libbpf (fixes multiple BPF_F_BROADCAST breakages)
- Fix cpudist, mdflush, readahead, threadsnoop.
- Handle the renaming of task_struct_>state field on RHEL 9 (fixes
offcputime, offwaketime, runqlat and runqslower)
- Drop several tools that relies on features disabled on RHEL

Resolves: rhbz#1992430
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
2021-10-15 10:57:36 +02:00

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