[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20120326183200.GB5195@infradead.org>
Date: Mon, 26 Mar 2012 15:32:00 -0300
From: Arnaldo Carvalho de Melo <acme@...stprotocols.net>
To: Jörg Sommer <joerg@...a.gnuu.de>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Paul Mackerras <paulus@...ba.org>, Ingo Molnar <mingo@...e.hu>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] perf tools: Fix parsing of unary operator in ?:
expression
Em Sun, Mar 25, 2012 at 11:11:32PM +0200, Jörg Sommer escreveu:
> Parsing an expression like
>
> print fmt: "reason %s (%d)", …, REC->errno < 0 ? -REC->errno : REC->reason
>
> in kvm_space_exit fails with
There is no 'kvm_space_exit' I could google for except in this patch,
this is 'kvm_userspace_exit', right?
Fixing that in the changeset log.
- Arnaldo
> Fatal unknown op ':'
>
> The colon after a simple operator signals the end of this expression. The
> token should not be advanced, because the colon is handled in
> process_cond(). Hence, it's enough to signal there's an operation
> heading.
>
> Signed-off-by: Jörg Sommer <joerg@...a.gnuu.de>
> ---
> An alternative could be:
>
> --- a/tools/perf/util/trace-event-parse.c
> +++ b/tools/perf/util/trace-event-parse.c
> @@ -1287,7 +1287,7 @@ process_op(struct event *event, struct print_arg *arg, char **tok)
> return EVENT_NONE;
> }
>
> - if (type == EVENT_OP) {
> + if (type == EVENT_OP && strcmp(*tok, ":") != 0) {
> int prio;
>
> /* higher prios need to be closer to the root */
>
>
> tools/perf/util/trace-event-parse.c | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
> index 185e284..d7b5880 100644
> --- a/tools/perf/util/trace-event-parse.c
> +++ b/tools/perf/util/trace-event-parse.c
> @@ -1125,6 +1125,7 @@ static int get_op_prio(char *op)
> case '|':
> return 13;
> case '?':
> + case ':':
> return 16;
> default:
> die("unknown op '%c'", op[0]);
> @@ -1202,6 +1203,8 @@ process_op(struct event *event, struct print_arg *arg, char **tok)
>
> type = process_arg(event, right, tok);
>
> + } else if (strcmp(token, ":") == 0) {
> + return EVENT_OP;
> } else if (strcmp(token, "?") == 0) {
>
> left = malloc_or_die(sizeof(*left));
> --
> 1.7.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists