perf probe: Improve error message when function not found
PATCH 1/1 perf probe: Improve error message when function not found
When requesting a function from a userspace library the error message to the user is less than helpful. e.g.,
perf probe -x /lib64/libpthread-2.14.90.so -a 'lock_full=__pthread_mutex_lock_full' no symbols found in /lib64/libpthread-2.14.90.so, 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/libpthread-2.14.90.so | grep __pthread_mutex_lock_full 0000000000005700 t __pthread_mutex_lock_full
With this patch:
perf probe -x /lib64/libpthread-2.14.90.so -a 'lock_full=__pthread_mutex_lock_full'
no symbols found in /lib64/libpthread-2.14.90.so, maybe install a debug package? Failed to find function in /lib64/libpthread-2.14.90.so. Perhaps it is a local variable?
Error: Failed to add events. (-22)
tools/perf/util/probe-event.c +2 -1
@@ -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; }
Signature · 1 line
1.8.3.4 (Apple Git-47)
Masami:
If you do not have any problems with this version please Ack so Arnaldo will pick it up.
Thanks,
David
Quoted 39 lines · David Ahern
When requesting a function from a userspace library the error message to the user is less than helpful. e.g.,
perf probe -x
/lib64/libpthread-2.14.90.so-a 'lock_full=__pthread_mutex_lock_full' no symbols found in/lib64/libpthread-2.14.90.so, 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/libpthread-2.14.90.so| grep__pthread_mutex_lock_full0000000000005700 t__pthread_mutex_lock_fullWith this patch:
perf probe -x/lib64/libpthread-2.14.90.so-a 'lock_full=__pthread_mutex_lock_full'no symbols found in
/lib64/libpthread-2.14.90.so, maybe install a debug package? Failed to find function in/lib64/libpthread-2.14.90.so. Perhaps it is a local variable?
Error: Failed to add events. (-22)Signed-off-by David Ahern <[email protected]>Cc Masami Hiramatsu <[email protected]>Cc Srikar Dronamraju <[email protected]>tools/perf/util/probe-event.c +2
-1@@ -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; }
Quoted 4 lines · David Ahern
Masami:
If you do not have any problems with this version please Ack so Arnaldo will pick it up.
David, as we talked about that before;
Quoted 8 lines · David Ahern
Quoted 8 lines · Masami Hiramatsu
Quoted 6 lines
Quoted 2 lines
That needs to be explicitly stated in the error message -- only global symbols may be given.
Ah, I see. In that case, I think the "variable" is not a correct word, the "symbol" is better, because perf probe can take tracing variable arguments after the trace point definition. :)
Quoted 5 lines
Quoted 3 lines
Right, variable is not the correct word. So how about this:
"Failed to find requested symbol in %s. Is it a global symbol?"
Yeah, that's good for me now :)
But your patch, still using the "variable"....
Quoted 2 lines
tools/perf/util/probe-event.c static int convert_name_to_addr(struct perf_probe_event *pev, const char *exec) · line 2313
Quoted 2 lines
tools/perf/util/probe-event.c +2
-0+pr_err ("Failed to find requested symbol in %s. Is it a global variable?\n" , + name);
Thus, I can't give Ack for this.
Anyway, I'd like to rewrite this part since it is too limited, after my 2 weeks off.
Thank you,
Quoted 38 lines · David Ahern
Quoted 37 lines
When requesting a function from a userspace library the error message to the user is less than helpful. e.g.,
perf probe -x
/lib64/libpthread-2.14.90.so-a 'lock_full=__pthread_mutex_lock_full' no symbols found in/lib64/libpthread-2.14.90.so, 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/libpthread-2.14.90.so| grep__pthread_mutex_lock_full0000000000005700 t__pthread_mutex_lock_fullWith this patch:
perf probe -x/lib64/libpthread-2.14.90.so-a 'lock_full=__pthread_mutex_lock_full'no symbols found in
/lib64/libpthread-2.14.90.so, maybe install a debug package? Failed to find function in/lib64/libpthread-2.14.90.so. Perhaps it is a local variable?
Error: Failed to add events. (-22)Signed-off-by David Ahern <[email protected]>Cc Masami Hiramatsu <[email protected]>Cc Srikar Dronamraju <[email protected]>tools/perf/util/probe-event.c +2
-1@@ -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; }
Signature · 4 lines
Masami HIRAMATSU IT Management Research Dept. Linux Technology Center Hitachi, Ltd., Yokohama Research Laboratory E-mail: [email protected]