2016-03-01 10:34:39

by Joel A Fernandes

[permalink] [raw]
Subject: Re: [RFC] perf: probe_finder: continue if atleast one probe point found

Hi Hiramatu,

On Mon, Feb 29, 2016 at 8:29 PM, 平松雅巳 / HIRAMATU,MASAMI
<[email protected]> wrote:
> BTW,
>
> ./perf probe \
> -k ./vmlinux -s ./ -x /lib/x86_64-linux-gnu/libc.so.6 -a 'malloc $params'
>
> might help your case. $params is expanded to function parameters automatically
> and if there is no parameters, it is just ignored :)

Thanks, I agree this is a better approach.

How about an informative error letting the user know about it? Is the
below Ok? I can send a patch.

----x8--------
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 4ce5c5e..21f282a 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -1247,8 +1247,12 @@ static int add_probe_trace_event(Dwarf_Die
*sc_die, struct probe_finder *pf)
pf->tvar = &tev->args[i];
/* Variable should be found from scope DIE */
ret = find_variable(sc_die, pf);
- if (ret != 0)
+ if (ret != 0) {
+ pr_err("Variable couldn't be found, if probe
is on inline function,"
+ "try '%s' or '%s' instead.\n",
+ PROBE_ARG_PARAMS, PROBE_ARG_VARS);
break;
+ }
}


2016-03-01 10:36:42

by Joel A Fernandes

[permalink] [raw]
Subject: Re: [RFC] perf: probe_finder: continue if atleast one probe point found

Sorry about the line wrapping, I sent this email through g-mail.
Shouldn't have any issue when I send the final patch through git
send-email.

Thanks,
Joel

On Tue, Mar 1, 2016 at 2:34 AM, Joel Fernandes <[email protected]> wrote:
> Hi Hiramatu,
>
> On Mon, Feb 29, 2016 at 8:29 PM, 平松雅巳 / HIRAMATU,MASAMI
> <[email protected]> wrote:
>> BTW,
>>
>> ./perf probe \
>> -k ./vmlinux -s ./ -x /lib/x86_64-linux-gnu/libc.so.6 -a 'malloc $params'
>>
>> might help your case. $params is expanded to function parameters automatically
>> and if there is no parameters, it is just ignored :)
>
> Thanks, I agree this is a better approach.
>
> How about an informative error letting the user know about it? Is the
> below Ok? I can send a patch.
>
> ----x8--------
> diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
> index 4ce5c5e..21f282a 100644
> --- a/tools/perf/util/probe-finder.c
> +++ b/tools/perf/util/probe-finder.c
> @@ -1247,8 +1247,12 @@ static int add_probe_trace_event(Dwarf_Die
> *sc_die, struct probe_finder *pf)
> pf->tvar = &tev->args[i];
> /* Variable should be found from scope DIE */
> ret = find_variable(sc_die, pf);
> - if (ret != 0)
> + if (ret != 0) {
> + pr_err("Variable couldn't be found, if probe
> is on inline function,"
> + "try '%s' or '%s' instead.\n",
> + PROBE_ARG_PARAMS, PROBE_ARG_VARS);
> break;
> + }
> }