lkml.org 
[lkml]   [2018]   [Feb]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@kernel.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
>

\
 
 \ /
  Last update: 2018-02-12 03:07    [W:0.128 / U:2.472 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site