All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
To: linux-kernel@vger.kernel.org
Cc: linux-btrfs@vger.kernel.org,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>,
	Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Subject: [PATCH 3/3] perf: allow typecast for signed value
Date: Wed, 07 Dec 2011 10:37:57 +0900	[thread overview]
Message-ID: <4EDEC375.2090808@jp.fujitsu.com> (raw)
In-Reply-To: <4EDEC207.90403@jp.fujitsu.com>

Still I got following warning with btrfs tracepoints:

  $ perf script
  Warning: Error: expected type 5 but read 4
  Warning: Error: expected type 5 but read 0

I found that the complained format is:

  print fmt: "%s", (REC->val >= (u64)-4) ? "-" : __print_symbolic(...)
                                     ~
In perf's parser, the typecast, which is processed in process_paren(),
only expects that (unsigned) token or another parenthesis will follow
to the typecast.  It should expect signed tokens can be there too.

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
---
 tools/perf/util/trace-event-parse.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index b709f78..032f3de 100644
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -1645,10 +1645,11 @@ process_paren(struct event *event, struct print_arg *arg, char **tok)
 	type = read_token_item(&token);
 
 	/*
-	 * If the next token is an item or another open paren, then
-	 * this was a typecast.
+	 * If the next token is an item (might be signed, with single op "-")
+	 * or another open paren, then this was a typecast.
 	 */
 	if (event_item_type(type) ||
+	    (type == EVENT_OP && strcmp(token, "-") == 0) ||
 	    (type == EVENT_DELIM && strcmp(token, "(") == 0)) {
 
 		/* make this a typecast and contine */
-- 
1.7.7.3

      parent reply	other threads:[~2011-12-07  1:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-07  1:31 [PATCH 0/3] perf: parser fix for btrfs tracepoints Hidetoshi Seto
2011-12-07  1:36 ` [PATCH 1/3] perf: parse greater/less than or equal Hidetoshi Seto
2011-12-07  1:37 ` [PATCH 2/3] perf: allow processing single op args Hidetoshi Seto
2011-12-07  1:37 ` Hidetoshi Seto [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=4EDEC375.2090808@jp.fujitsu.com \
    --to=seto.hidetoshi@jp.fujitsu.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=linux-btrfs@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.