Commit-ID:  88a7fcf961a27fbd248e3c914fc9df8327f7cdbb
Gitweb:     http://git.kernel.org/tip/88a7fcf961a27fbd248e3c914fc9df8327f7cdbb
Author:     Ravi Bangoria <ravi.bango...@linux.vnet.ibm.com>
AuthorDate: Fri, 19 Aug 2016 18:29:35 +0530
Committer:  Arnaldo Carvalho de Melo <a...@redhat.com>
CommitDate: Tue, 20 Sep 2016 12:28:29 -0300

perf annotate: Do not ignore call instruction with indirect target

Do not ignore call instruction with indirect target when its already
identified as a call. This is an extension of commit e8ea1561952b ("perf
annotate: Use raw form for register indirect call instructions") to
generalize annotation for all instructions with indirect calls.

This is needed for certain powerpc call instructions that use address in
a register (such as bctrl, btarl, ...).

Apart from that, when kcore is used to disassemble function, all call
instructions were ignored. This patch will fix it as a side effect by
not ignoring them. For example,

Before (with kcore):
       mov    %r13,%rdi
       callq  0xffffffff811a7e70
     ^ jmpq   64
       mov    %gs:0x7ef41a6e(%rip),%al

After (with kcore):
       mov    %r13,%rdi
     > callq  0xffffffff811a7e70
     ^ jmpq   64
       mov    %gs:0x7ef41a6e(%rip),%al

Suggested-by: Michael Ellerman <m...@ellerman.id.au>
[Suggested about 'bctrl' instruction]
Signed-off-by: Ravi Bangoria <ravi.bango...@linux.vnet.ibm.com>
Cc: Alexander Shishkin <alexander.shish...@linux.intel.com>
Cc: Chris Riyder <chris.ry...@arm.com>
Cc: Hemant Kumar <hem...@linux.vnet.ibm.com>
Cc: Jiri Olsa <jo...@kernel.org>
Cc: Markus Trippelsdorf <mar...@trippelsdorf.de>
Cc: Masami Hiramatsu <mhira...@kernel.org>
Cc: Namhyung Kim <namhy...@kernel.org>
Cc: Naveen N. Rao <naveen.n....@linux.vnet.ibm.com>
Cc: Pawel Moll <pawel.m...@arm.com>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Russell King <rmk+ker...@arm.linux.org.uk>
Cc: Taeung Song <treeze.tae...@gmail.com>
Link: 
http://lkml.kernel.org/r/1471611578-11255-5-git-send-email-ravi.bango...@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <a...@redhat.com>
---
 tools/perf/util/annotate.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 7a80c73..60e915f 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -82,16 +82,12 @@ static int call__parse(struct ins_operands *ops)
        return ops->target.name == NULL ? -1 : 0;
 
 indirect_call:
-       tok = strchr(endptr, '(');
-       if (tok != NULL) {
+       tok = strchr(endptr, '*');
+       if (tok == NULL) {
                ops->target.addr = 0;
                return 0;
        }
 
-       tok = strchr(endptr, '*');
-       if (tok == NULL)
-               return -1;
-
        ops->target.addr = strtoull(tok + 1, NULL, 16);
        return 0;
 }

Reply via email to