public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf probe: Improve error message when function not found
@ 2013-12-20 18:04 David Ahern
  2013-12-26 13:43 ` David Ahern
  0 siblings, 1 reply; 3+ messages in thread
From: David Ahern @ 2013-12-20 18:04 UTC (permalink / raw)
  To: acme, linux-kernel; +Cc: David Ahern, Masami Hiramatsu, Srikar Dronamraju

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)

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>

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;
 	}
 
-- 
1.8.3.4 (Apple Git-47)


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf probe: Improve error message when function not found
  2013-12-20 18:04 [PATCH] perf probe: Improve error message when function not found David Ahern
@ 2013-12-26 13:43 ` David Ahern
  2013-12-27  7:34   ` Masami Hiramatsu
  0 siblings, 1 reply; 3+ messages in thread
From: David Ahern @ 2013-12-26 13:43 UTC (permalink / raw)
  To: acme, linux-kernel; +Cc: David Ahern, Masami Hiramatsu, Srikar Dronamraju

Masami:

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

Thanks,

David

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/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)
>
> Signed-off-by: David Ahern <dsahern@gmail.com>
> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
>
> 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;
>   	}
>
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Re: [PATCH] perf probe: Improve error message when function not found
  2013-12-26 13:43 ` David Ahern
@ 2013-12-27  7:34   ` Masami Hiramatsu
  0 siblings, 0 replies; 3+ messages in thread
From: Masami Hiramatsu @ 2013-12-27  7:34 UTC (permalink / raw)
  To: David Ahern; +Cc: acme, linux-kernel, Srikar Dronamraju

(2013/12/26 22:43), David Ahern wrote:
> 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;

(2013/12/04 10:23), Masami Hiramatsu wrote:> (2013/12/04 0:15), David Ahern wrote:
>> On 12/2/13, 10:12 PM, Masami Hiramatsu wrote:
>>>> 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. :)
>>
>> 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"....

>> +		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,

> 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/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)
>>
>> Signed-off-by: David Ahern <dsahern@gmail.com>
>> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
>> Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
>>
>> 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;
>>   	}

-- 
Masami HIRAMATSU
IT Management Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-12-27  7:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-20 18:04 [PATCH] perf probe: Improve error message when function not found David Ahern
2013-12-26 13:43 ` David Ahern
2013-12-27  7:34   ` Masami Hiramatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox