[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180212114702.0452e71c@gandalf.local.home>
Date: Mon, 12 Feb 2018 11:47:02 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Masami Hiramatsu <mhiramat@...nel.org>
Cc: Namhyung Kim <namhyung@...nel.org>, 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>,
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
On Tue, 13 Feb 2018 00:47:50 +0900
Masami Hiramatsu <mhiramat@...nel.org> wrote:
> > > 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) == '_')
>
> If this '$' is only for the symbol or direct address(with 0x prefix),
> you just need to check by !isdigit(token[0]), isn't it?
> (and if it is insane get_symbol just fails)
I modified a lot of this code for the next version (which I'm still
tweaking).
I have this for next_token() (which I may add for the
trace_events_filter.c code as Al Viro has recently pointed out issues
with its parsing):
static char *next_token(char **ptr, char *last)
{
char *arg;
char *str;
if (!*ptr)
return NULL;
arg = *ptr;
if (*last)
*arg = *last;
if (!*arg)
return NULL;
for (str = arg; *str; str++) {
if (!isalnum(*str) && *str != '_')
break;
}
if (*str) {
if (str == arg)
str++;
*last = *str;
*str = 0;
*ptr = str;
return arg;
}
*last = 0;
*ptr = NULL;
return arg;
}
And this:
static bool valid_name(const char *token)
{
return isalpha(token[0]) || token[0] == '_';
}
As all tokens will now be either entirely alphanumeric with '_' or a
single character.
-- Steve
Powered by blists - more mailing lists