mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
To: "Jörg Sommer" <joerg@alea.gnuu.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] perf tools: Fix parsing of unary operator in ?: expression
Date: Mon, 26 Mar 2012 15:32:00 -0300	[thread overview]
Message-ID: <20120326183200.GB5195@infradead.org> (raw)
In-Reply-To: <bc768c12ba3df410cb3a049ea6d88d39a993768d.1332709498.git.joerg@alea.gnuu.de>

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@alea.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

  reply	other threads:[~2012-03-26 18:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-25 21:08 [PATCH 1/2] perf tools: Concatenate strings in expressions Jörg Sommer
2012-03-25 21:11 ` [PATCH 2/2] perf tools: Fix parsing of unary operator in ?: expression Jörg Sommer
2012-03-26 18:32   ` Arnaldo Carvalho de Melo [this message]
2012-03-26 18:15 ` [PATCH 1/2] perf tools: Concatenate strings in expressions Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120326183200.GB5195@infradead.org \
    --to=acme@ghostprotocols.net \
    --cc=a.p.zijlstra@chello.nl \
    --cc=joerg@alea.gnuu.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®