diff options
author | Rabin Vincent <rabin@rab.in> | 2015-01-18 14:00:20 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-01-21 08:05:17 -0500 |
commit | be81908c2289f405df75d2511ccf5da785945400 (patch) | |
tree | 091dfe44f434c1eb29e5224d21d058f44e68f4ae | |
parent | 75e0b5f010837f29b5773653a248852a7317562b (diff) |
perf annotate: Handle ins parsing failures
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>
-rw-r--r-- | tools/perf/util/annotate.c | 9 |
1 files 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) | |||
183 | if (!ops->locked.ins->ops) | 183 | if (!ops->locked.ins->ops) |
184 | return 0; | 184 | return 0; |
185 | 185 | ||
186 | if (ops->locked.ins->ops->parse) | 186 | if (ops->locked.ins->ops->parse && |
187 | ops->locked.ins->ops->parse(ops->locked.ops); | 187 | ops->locked.ins->ops->parse(ops->locked.ops) < 0) |
188 | goto out_free_ops; | ||
188 | 189 | ||
189 | return 0; | 190 | return 0; |
190 | 191 | ||
@@ -531,8 +532,8 @@ static void disasm_line__init_ins(struct disasm_line *dl) | |||
531 | if (!dl->ins->ops) | 532 | if (!dl->ins->ops) |
532 | return; | 533 | return; |
533 | 534 | ||
534 | if (dl->ins->ops->parse) | 535 | if (dl->ins->ops->parse && dl->ins->ops->parse(&dl->ops) < 0) |
535 | dl->ins->ops->parse(&dl->ops); | 536 | dl->ins = NULL; |
536 | } | 537 | } |
537 | 538 | ||
538 | static int disasm_line__parse(char *line, char **namep, char **rawp) | 539 | static int disasm_line__parse(char *line, char **namep, char **rawp) |