[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <bc768c12ba3df410cb3a049ea6d88d39a993768d.1332709498.git.joerg@alea.gnuu.de>
Date: Sun, 25 Mar 2012 23:11:32 +0200
From: Jörg Sommer <joerg@...a.gnuu.de>
To: Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Paul Mackerras <paulus@...ba.org>, Ingo Molnar <mingo@...e.hu>,
Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
linux-kernel@...r.kernel.org
Cc: Jörg Sommer <joerg@...a.gnuu.de>
Subject: [PATCH 2/2] perf tools: Fix parsing of unary operator in ?: expression
Parsing an expression like
print fmt: "reason %s (%d)", …, REC->errno < 0 ? -REC->errno : REC->reason
in kvm_space_exit fails with
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