Skip to contentSkip to conversation

perf annotate: Use raw form for register indirect call instructions

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message May 14, 2012 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  e8ea1561952b04276cf4c02500e363de76c142aa
Gitweb:     http://git.kernel.org/tip/e8ea1561952b04276cf4c02500e363de76c142aa
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Fri, 11 May 2012 12:28:55 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 11 May 2012 12:28:55 -0300

perf annotate: Use raw form for register indirect call instructions

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.

Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/util/annotate.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
tools/perf/util/annotate.c +9 -0
index 6b4146b..9a020d1 100644
@@ -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);
 }