Re: Re: Re: [PATCH v3 3/3] perf probe: Show better error message when failed to find variable

Masami Hiramatsu
2015-05-11T20:31:20Z

On 2015/05/11 22:44, Arnaldo Carvalho de Melo wrote:
> Em Mon, May 11, 2015 at 10:35:27AM -0300, Arnaldo Carvalho de Melo escreveu:
>> Em Mon, May 11, 2015 at 09:02:47PM +0900, Masami Hiramatsu escreveu:
>>> On 2015/05/11 19:15, He Kuang wrote:
>>>> On 2015/5/11 17:50, Ingo Molnar wrote:
>>>>> * He Kuang <hekuang@huawei.com> wrote:
>>>>>> On 2015/5/11 17:30, Ingo Molnar wrote:
>>>>>>>> After this patch:
>>>>>>>> $ perf probe --add 'generic_perform_write+118 bytes'
>>>>>>>> Failed to find the location of bytes at this address.
>>>>>>> What does this sentence mean? I thought 'address' means 'location of
>>>>>>> bytes'. So the address identifies the location and obviously we know
>>>>>>> that. So this message wants to say something else.
>>>>>> 'generic_perform_write' is a function name, while 'bytes' is a local
>>>>>> variable in this function. Maybe the variable I chose make you confused.
>>
>>>>>> This maybe clear:
>>>>>> Failed to find the location of 'bytes' at this address.
>>>>> Yeah, absolutely! This highlights the importance of putting
>>>>> user-supplied symbols into quotes and such.
>>
>>>>> Maybe even write:
>>
>>>>> Failed to find the location of the 'bytes' variable at this address.
>>
>>> OK, He, could you also include this fix?
>>
>> I agree with the change, makes things clearer, will do the change
>> myself. If He has any objection to that, I can fix things up before
>> pushing it to Ingo,

Opps, I missed this...

>
> So, this is the end result:
>
> - if (ret == -ENOENT || ret == -EINVAL)
> - pr_err("Failed to find the location of %s at this address.\n"
> - " Perhaps, it has been optimized out.\n", pf->pvar->var);
> - else if (ret == -ENOTSUP)
> + if (ret == -ENOENT || ret == -EINVAL) {
> + pr_err("Failed to find the location of the '%s' variable at this address.\n"
> + " Perhaps it has been optimized out.\n"
> + " Use -V with the --range option to show '%s' location range.\n",
> + pf->pvar->var, pf->pvar->var);
> + } else if (ret == -ENOTSUP)

OK, I ack this change.

Thank you,

--
Masami HIRAMATSU
Linux Technology Research Center, System Productivity Research Dept.
Center for Technology Innovation - Systems Engineering
Hitachi, Ltd., Research & Development Group
E-mail: masami.hiramatsu.pt@hitachi.com