Re: [PATCH] perf probe: Improve error message when function not found

From: David Ahern
Date: Thu Dec 26 2013 - 08:44:05 EST


If you do not have any problems with this version please Ack so Arnaldo will pick it up.



On 12/20/13, 1:04 PM, David Ahern wrote:
When requesting a function from a userspace library the error message to
the user is less than helpful. e.g.,

perf probe -x /lib64/ -a 'lock_full=__pthread_mutex_lock_full'
no symbols found in /lib64/, maybe install a debug package?
Failed to load map.
Error: Failed to add events. (-22)

yet the symbol really does exist but is a local symbol which is filtered:

nm /lib64/ | grep __pthread_mutex_lock_full
0000000000005700 t __pthread_mutex_lock_full

With this patch:
perf probe -x /lib64/ -a 'lock_full=__pthread_mutex_lock_full'

no symbols found in /lib64/, maybe install a debug package?
Failed to find function in /lib64/ Perhaps it is a local variable?
Error: Failed to add events. (-22)

Signed-off-by: David Ahern <dsahern@xxxxxxxxx>
Cc: Masami Hiramatsu <>
Cc: Srikar Dronamraju <srikar@xxxxxxxxxxxxxxxxxx>

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 9c6989ca2bea..2eac49096840 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -2309,7 +2309,8 @@ static int convert_name_to_addr(struct perf_probe_event *pev, const char *exec)
available_func_filter = strfilter__new(function, NULL);
if (map__load(map, filter_available_functions)) {
- pr_err("Failed to load map.\n");
+ pr_err("Failed to find requested symbol in %s. Is it a global variable?\n",
+ name);
goto out;

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at