[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180212020644.GG31513@sejong>
Date: Mon, 12 Feb 2018 11:06:44 +0900
From: Namhyung Kim <namhyung@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: linux-kernel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
Ingo Molnar <mingo@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Tom Zanussi <tom.zanussi@...ux.intel.com>,
linux-rt-users@...r.kernel.org, linux-trace-users@...r.kernel.org,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Clark Williams <williams@...hat.com>,
Jiri Olsa <jolsa@...hat.com>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Juri Lelli <juri.lelli@...hat.com>,
Jonathan Corbet <corbet@....net>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Alexei Starovoitov <alexei.starovoitov@...il.com>,
kernel-team@....com
Subject: Re: [PATCH 12/18] tracing: Add accessing direct address from
function based events
Hi Steve,
On Fri, Feb 09, 2018 at 05:07:37PM -0500, Steven Rostedt wrote:
> On Fri, 9 Feb 2018 09:34:36 +0900
> Namhyung Kim <namhyung@...nel.org> wrote:
>
> > Couldn't we use the symbol name directly? Maybe it needs a syntax to
> > indicate global variable. Like this?
> >
> > # echo 'do_IRQ(int $total_forks)' > function_events
>
>
> I decided to stick with "$".
Good.
[SNIP]
> static enum func_states
> process_event(struct func_event *fevent, const char *token, enum func_states state)
> {
> @@ -469,6 +479,8 @@ process_event(struct func_event *fevent, const char *token, enum func_states sta
> case FUNC_STATE_ARRAY_END:
> if (WARN_ON(!fevent->last_arg))
> break;
> + if (token[0] == '$')
> + return FUNC_STATE_SYMBOL;
> if (update_arg_name(fevent, token) < 0)
> break;
> if (strncmp(token, "0x", 2) == 0)
> @@ -542,6 +554,11 @@ process_event(struct func_event *fevent, const char *token, enum func_states sta
> fevent->last_arg->index += val;
> return FUNC_STATE_VAR;
>
> + case FUNC_STATE_SYMBOL:
> + if (!isalpha(token[0]) && token[0] != '_')
> + break;
> + goto equal;
> +
> case FUNC_STATE_ADDR:
> switch (token[0]) {
> case ')':
> @@ -599,14 +616,26 @@ process_event(struct func_event *fevent, const char *token, enum func_states sta
> break;
>
> case FUNC_STATE_EQUAL:
> + if (token[0] == '$')
> + return FUNC_STATE_SYMBOL;
> if (strncmp(token, "0x", 2) != 0)
> break;
> equal:
> if (WARN_ON(!fevent->last_arg))
> break;
> - ret = kstrtoul(token, 0, &val);
> - if (ret < 0)
> - break;
> + if (isalpha(token[0]) || token[0] != '_') {
I guess you wanted the token[0] being '_'. Maybe it'd be better adding
#define isident0(x) (isalpha(x) || (x) == '_')
?
Thanks,
Namhyung
> + ret = get_symbol(token, &val);
> + if (ret < 0)
> + break;
> + if (!fevent->last_arg->name) {
> + if (update_arg_name(fevent, token) < 0)
> + break;
> + }
> + } else {
> + ret = kstrtoul(token, 0, &val);
> + if (ret < 0)
> + break;
> + }
> update_arg = false;
> fevent->last_arg->index = val;
> fevent->last_arg->arg = -1;
> --
> 2.13.6
>
Powered by blists - more mailing lists