Skip to content

Commit f6eb051

Browse files
mhiramatacmel
authored andcommitted
perf probe: Fix to show correct error message for $vars and $params
Fix to show correct error messages for $vars and $params because those special variables requires debug information to find the real variables or function parameters. E.g. without this fix; ---- # perf probe -x /lib64/libc-2.23.so getaddrinfo \$params Failed to write event: Invalid argument Please upgrade your kernel to at least 3.14 to have access to feature $params Error: Failed to add events. ---- Perf ends up with an error, but the message is not correct. With this fix, perf shows correct error message as below. ---- # perf probe -x /lib64/libc-2.23.so getaddrinfo \$params The /usr/lib64/libc-2.23.so file has no debug information. Rebuild with -g, or install an appropriate debuginfo package. Error: Failed to add events. ---- Reported-and-Tested-by: Arnaldo Carvalho de Melo <[email protected]> Signed-off-by: Masami Hiramatsu <[email protected]> Cc: Ananth N Mavinakayanahalli <[email protected]> Cc: Brendan Gregg <[email protected]> Cc: Hemant Kumar <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/146831787438.17065.6152436996780110699.stgit@devbox Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent b4ee6d4 commit f6eb051

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tools/perf/util/probe-event.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1547,7 +1547,9 @@ bool perf_probe_event_need_dwarf(struct perf_probe_event *pev)
15471547
return true;
15481548

15491549
for (i = 0; i < pev->nargs; i++)
1550-
if (is_c_varname(pev->args[i].var))
1550+
if (is_c_varname(pev->args[i].var) ||
1551+
!strcmp(pev->args[i].var, "$params") ||
1552+
!strcmp(pev->args[i].var, "$vars"))
15511553
return true;
15521554

15531555
return false;

0 commit comments

Comments
 (0)