From d86b0597c4bd41ea3edc6446a855306eed34f93b Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Wed, 18 Apr 2012 16:07:38 -0300 Subject: perf annotate: Parse call targets earlier No need to do it everytime the user presses enter/-> on a call instruction. Cc: David Ahern Cc: Frederic Weisbecker Cc: Mike Galbraith Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/n/tip-ybgss44m5ycry8mk7b1qdbre@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/annotate.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'tools/perf/util/annotate.c') diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 4ee2c07..a4296fd 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -18,6 +18,21 @@ const char *disassembler_style; +static int call_ops__parse_target(const char *operands, u64 *target) +{ + *target = strtoull(operands, NULL, 16); + return 0; +} + +static struct ins_ops call_ops = { + .parse_target = call_ops__parse_target, +}; + +bool ins__is_call(const struct ins *ins) +{ + return ins->ops == &call_ops; +} + static int jump_ops__parse_target(const char *operands, u64 *target) { const char *s = strchr(operands, '+'); @@ -38,11 +53,12 @@ bool ins__is_jump(const struct ins *ins) return ins->ops == &jump_ops; } - /* * Must be sorted by name! */ static struct ins instructions[] = { + { .name = "call", .ops = &call_ops, }, + { .name = "callq", .ops = &call_ops, }, { .name = "ja", .ops = &jump_ops, }, { .name = "je", .ops = &jump_ops, }, { .name = "jmp", .ops = &jump_ops, }, -- cgit v1.1