From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Steven Rostedt <rostedt@goodmis.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 16/16] tools lib traceevent: Fix use of multiple options in processing field
Date: Mon, 18 Nov 2013 17:28:04 -0300 [thread overview]
Message-ID: <1384806484-29869-17-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1384806484-29869-1-git-send-email-acme@infradead.org>
From: Steven Rostedt <rostedt@goodmis.org>
Jiri Olsa reported that the scsi_dispatch_cmd_done event failed to parse
with:
Error: expected type 5 but read 4
Error: expected type 5 but read 4
The problem is with this part of the print_fmt:
__print_symbolic(((REC->result) >> 24) & 0xff, ...
The __print_symbolic() helper function's first parameter is the field to
use to determine what symbol to print based on the value of the result.
The parser can handle one operation, but it can not handle multiple
operations ('>>' and '&').
Add code to process all operations for the field argument for
__print_symbolic() as well as __print_flags().
Reported-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/20131118142314.27ca334b@gandalf.local.home
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/traceevent/event-parse.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 0362d575de7d..8a5b65df6efb 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -1606,6 +1606,24 @@ process_arg(struct event_format *event, struct print_arg *arg, char **tok)
static enum event_type
process_op(struct event_format *event, struct print_arg *arg, char **tok);
+/*
+ * For __print_symbolic() and __print_flags, we need to completely
+ * evaluate the first argument, which defines what to print next.
+ */
+static enum event_type
+process_field_arg(struct event_format *event, struct print_arg *arg, char **tok)
+{
+ enum event_type type;
+
+ type = process_arg(event, arg, tok);
+
+ while (type == EVENT_OP) {
+ type = process_op(event, arg, tok);
+ }
+
+ return type;
+}
+
static enum event_type
process_cond(struct event_format *event, struct print_arg *top, char **tok)
{
@@ -2371,7 +2389,7 @@ process_flags(struct event_format *event, struct print_arg *arg, char **tok)
goto out_free;
}
- type = process_arg(event, field, &token);
+ type = process_field_arg(event, field, &token);
/* Handle operations in the first argument */
while (type == EVENT_OP)
@@ -2424,7 +2442,8 @@ process_symbols(struct event_format *event, struct print_arg *arg, char **tok)
goto out_free;
}
- type = process_arg(event, field, &token);
+ type = process_field_arg(event, field, &token);
+
if (test_type_token(type, token, EVENT_DELIM, ","))
goto out_free_field;
--
1.8.1.4
prev parent reply other threads:[~2013-11-18 20:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-18 20:27 [GIT PULL 00/16] perf/core improvements and fixes Arnaldo Carvalho de Melo
2013-11-18 20:27 ` [PATCH 01/16] perf trace: Remove thread summary coloring Arnaldo Carvalho de Melo
2013-11-18 20:27 ` [PATCH 02/16] perf top: Make -g refer to callchains Arnaldo Carvalho de Melo
2013-11-18 20:27 ` [PATCH 03/16] perf tools: Tag thread comm as overriden Arnaldo Carvalho de Melo
2013-11-18 20:27 ` [PATCH 04/16] perf completion: introduce a layer of indirection Arnaldo Carvalho de Melo
2013-11-18 20:27 ` [PATCH 05/16] perf completion: factor out compgen stuff Arnaldo Carvalho de Melo
2013-11-18 20:27 ` [PATCH 06/16] perf completion: factor out call to __ltrim_colon_completions Arnaldo Carvalho de Melo
2013-11-18 20:27 ` [PATCH 07/16] perf completion: introduce zsh support Arnaldo Carvalho de Melo
2013-11-18 20:27 ` [PATCH 08/16] perf completion: rename file to reflect " Arnaldo Carvalho de Melo
2013-11-18 20:27 ` [PATCH 09/16] perf header: Fix bogus group name Arnaldo Carvalho de Melo
2013-11-18 20:27 ` [PATCH 10/16] perf header: Fix possible memory leaks in process_group_desc() Arnaldo Carvalho de Melo
2013-11-18 20:27 ` [PATCH 11/16] perf script: Move evname print code to process_event() Arnaldo Carvalho de Melo
2013-11-18 20:28 ` [PATCH 12/16] perf record: Make per-cpu mmaps the default Arnaldo Carvalho de Melo
2013-11-18 20:28 ` [PATCH 13/16] perf tools: Allow '--inherit' as the negation of '--no-inherit' Arnaldo Carvalho de Melo
2013-11-18 20:28 ` [PATCH 14/16] perf tools: Add option macro OPT_BOOLEAN_SET Arnaldo Carvalho de Melo
2013-11-18 20:28 ` [PATCH 15/16] perf record: Default -t option to no inheritance Arnaldo Carvalho de Melo
2013-11-18 20:28 ` Arnaldo Carvalho de Melo [this message]
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=1384806484-29869-17-git-send-email-acme@infradead.org \
--to=acme@infradead.org \
--cc=acme@redhat.com \
--cc=fweisbec@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=rostedt@goodmis.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®