linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, Rabin Vincent <rabin@rab.in>,
	Paul Mackerras <paulus@samba.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 3/9] perf annotate: Handle ins parsing failures
Date: Wed, 21 Jan 2015 12:01:04 -0300	[thread overview]
Message-ID: <1421852470-20153-4-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1421852470-20153-1-git-send-email-acme@kernel.org>

From: Rabin Vincent <rabin@rab.in>

Don't use the ins's ->sncprintf() if the parsing failed.

For example, this fixes the display of "imul %edx".  Without this patch:

       |      imul   (null),(null)

After this patch:

       |      imul   %edx

Signed-off-by: Rabin Vincent <rabin@rab.in>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1421607621-15005-1-git-send-email-rabin@rab.in
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/annotate.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 79999ceaf2be..d5da1b85541b 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -183,8 +183,9 @@ static int lock__parse(struct ins_operands *ops)
 	if (!ops->locked.ins->ops)
 		return 0;
 
-	if (ops->locked.ins->ops->parse)
-		ops->locked.ins->ops->parse(ops->locked.ops);
+	if (ops->locked.ins->ops->parse &&
+	    ops->locked.ins->ops->parse(ops->locked.ops) < 0)
+		goto out_free_ops;
 
 	return 0;
 
@@ -531,8 +532,8 @@ static void disasm_line__init_ins(struct disasm_line *dl)
 	if (!dl->ins->ops)
 		return;
 
-	if (dl->ins->ops->parse)
-		dl->ins->ops->parse(&dl->ops);
+	if (dl->ins->ops->parse && dl->ins->ops->parse(&dl->ops) < 0)
+		dl->ins = NULL;
 }
 
 static int disasm_line__parse(char *line, char **namep, char **rawp)
-- 
1.9.3


  parent reply	other threads:[~2015-01-21 15:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-21 15:01 [GIT PULL 0/9] perf/urgent fixes Arnaldo Carvalho de Melo
2015-01-21 15:01 ` [PATCH 1/9] perf evlist: Remove extraneous 'was' on error message Arnaldo Carvalho de Melo
2015-01-21 15:01 ` [PATCH 2/9] perf scripting perl: Force to use stdbool Arnaldo Carvalho de Melo
2015-01-21 15:01 ` Arnaldo Carvalho de Melo [this message]
2015-01-21 15:01 ` [PATCH 4/9] perf annotate: Fix memory leaks in LOCK handling Arnaldo Carvalho de Melo
2015-01-21 15:01 ` [PATCH 5/9] perf symbols: Return the first entry with a given name in find_by_name method Arnaldo Carvalho de Melo
2015-01-21 15:01 ` [PATCH 6/9] perf symbols: Introduce method to iterate symbols ordered by name Arnaldo Carvalho de Melo
2015-01-21 15:01 ` [PATCH 7/9] perf probe: Do not rely on map__load() filter to find symbols Arnaldo Carvalho de Melo
2015-01-21 15:01 ` [PATCH 8/9] perf symbols: Introduce 'for' method to iterate over the symbols with a given name Arnaldo Carvalho de Melo
2015-01-21 15:01 ` [PATCH 9/9] perf probe: Fix probing kretprobes Arnaldo Carvalho de Melo
2015-01-28 14:42 ` [GIT PULL 0/9] perf/urgent fixes Ingo Molnar

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=1421852470-20153-4-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=rabin@rab.in \
    /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;
as well as URLs for NNTP newsgroup(s).