perf annotate: Use raw form for register indirect call instructions
authorArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 11 May 2012 15:28:55 +0000 (12:28 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 11 May 2012 15:28:55 +0000 (12:28 -0300)
   callq  *0x10(%rax)

was being rendered in simplified mode as:

   callq  *10

I.e. hexa, but without the 0x and omitting the register. In such cases
just use the raw form.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-m91tv004h2m1fkfgu6ovx3hb@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/annotate.c

index 6b4146b40a20e08a7a573ec839a0615c92a436dc..9a020d1e01806b385e3b35546c4579ae01e6ada5 100644 (file)
@@ -56,6 +56,12 @@ static int call__parse(struct ins_operands *ops)
        return ops->target.name == NULL ? -1 : 0;
 
 indirect_call:
+       tok = strchr(endptr, '(');
+       if (tok != NULL) {
+               ops->target.addr = 0;
+               return 0;
+       }
+
        tok = strchr(endptr, '*');
        if (tok == NULL)
                return -1;
@@ -70,6 +76,9 @@ static int call__scnprintf(struct ins *ins, char *bf, size_t size,
        if (ops->target.name)
                return scnprintf(bf, size, "%-6.6s %s", ins->name, ops->target.name);
 
+       if (ops->target.addr == 0)
+               return ins__raw_scnprintf(ins, bf, size, ops);
+
        return scnprintf(bf, size, "%-6.6s *%" PRIx64, ins->name, ops->target.addr);
 }