[PATCH v3 3/4] libtraceevent: Have BTF find functions with extra characters
Steven Rostedt <[email protected]> Wed, 12 Nov 2025 16:42:37 -0500
| Newsgroups | org.kernel.vger.linux-trace-devel |
|---|---|
| Message-ID | <[email protected]> |
From: "Steven Rostedt (Google)" <[email protected]> Sometimes the symbol of a function has extra characters followed by a '.'. In this case, the BTF lookup may not find the function. If the function is not found and the function name contains a '.', try stripping off the extra characters and try again. That way, instead of: __mutex_unlock_slowpath.isra.0(ffffffffb5cd4e40, 8, 1, 1, ffffffffb43e0fe4, ffffed1024699f88) It can produce: __mutex_unlock_slowpath.isra.0(lock=0xffffffffb5cd4e40, ip=0x8) Signed-off-by: Steven Rostedt (Google) <[email protected]> --- src/trace-btf.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/trace-btf.c b/src/trace-btf.c index 12dc49447027..742cffd35edc 100644 --- a/src/trace-btf.c +++ b/src/trace-btf.c @@ -357,11 +357,23 @@ int tep_btf_print_args(struct tep_handle *tep, struct trace_seq *s, void *args, unsigned long long arg; unsigned int encode; const char *param_name; + const char *fp; int a, p, x, nr; if (size != 4 && size != 8) return -1; + if (!type && (fp = strchr(func, '.'))) { + char *f; + /* func name has extra characters */ + f = strdup(func); + if (f) { + f[fp - func] = '\0'; + type = tep_btf_find_func(btf, f); + free(f); + } + } + if (!type) { for (int i = 0; i < nmem; i++) { assign_arg(&arg, args, size, i); -- 2.51.0