diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-04-25 11:00:23 (GMT) |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-04-25 11:00:23 (GMT) |
commit | 44d1a3edfbd65f9da6725921e2425b10477772d8 (patch) | |
tree | 127655e788cf172e26eea4e38b98303c998e0d4a /tools/perf/util | |
parent | 9481ede909e08418c9379665ee9f25335d20dd06 (diff) | |
download | linux-fsl-qoriq-44d1a3edfbd65f9da6725921e2425b10477772d8.tar.xz |
perf annotate: Disambiguage offsets and addresses in operands
We were using ins_ops->target for callq addresses and jump offsets,
disambiguate by having ins_ops->target.addr and ins_ops->target.offset.
For jumps we'll need both to fixup lines that don't have an offset on
the <> part.
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-3nlcmstua75u07ao7wja1rwx@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/annotate.c | 20 | ||||
-rw-r--r-- | tools/perf/util/annotate.h | 7 |
2 files changed, 15 insertions, 12 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index b07d7d1..e1e7d0e 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -22,7 +22,7 @@ static int call__parse(struct ins_operands *ops) { char *endptr, *tok, *name; - ops->target = strtoull(ops->raw, &endptr, 16); + ops->target.addr = strtoull(ops->raw, &endptr, 16); name = strchr(endptr, '<'); if (name == NULL) @@ -35,17 +35,17 @@ static int call__parse(struct ins_operands *ops) return -1; *tok = '\0'; - ops->target_name = strdup(name); + ops->target.name = strdup(name); *tok = '>'; - return ops->target_name == NULL ? -1 : 0; + return ops->target.name == NULL ? -1 : 0; indirect_call: tok = strchr(endptr, '*'); if (tok == NULL) return -1; - ops->target = strtoull(tok + 1, NULL, 16); + ops->target.addr = strtoull(tok + 1, NULL, 16); return 0; } @@ -55,10 +55,10 @@ static int call__scnprintf(struct ins *ins, char *bf, size_t size, if (addrs) return scnprintf(bf, size, "%-6.6s %s", ins->name, ops->raw); - if (ops->target_name) - return scnprintf(bf, size, "%-6.6s %s", ins->name, ops->target_name); + if (ops->target.name) + return scnprintf(bf, size, "%-6.6s %s", ins->name, ops->target.name); - return scnprintf(bf, size, "%-6.6s *%" PRIx64, ins->name, ops->target); + return scnprintf(bf, size, "%-6.6s *%" PRIx64, ins->name, ops->target.addr); } static struct ins_ops call_ops = { @@ -78,7 +78,7 @@ static int jump__parse(struct ins_operands *ops) if (s++ == NULL) return -1; - ops->target = strtoll(s, NULL, 16); + ops->target.offset = strtoll(s, NULL, 16); return 0; } @@ -88,7 +88,7 @@ static int jump__scnprintf(struct ins *ins, char *bf, size_t size, if (addrs) return scnprintf(bf, size, "%-6.6s %s", ins->name, ops->raw); - return scnprintf(bf, size, "%-6.6s %" PRIx64, ins->name, ops->target); + return scnprintf(bf, size, "%-6.6s %" PRIx64, ins->name, ops->target.offset); } static struct ins_ops jump_ops = { @@ -289,7 +289,7 @@ void disasm_line__free(struct disasm_line *dl) { free(dl->line); free(dl->name); - free(dl->ops.target_name); + free(dl->ops.target.name); free(dl); } diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h index 8a8af0d..2b9e3e0 100644 --- a/tools/perf/util/annotate.h +++ b/tools/perf/util/annotate.h @@ -11,8 +11,11 @@ struct ins; struct ins_operands { char *raw; - char *target_name; - u64 target; + struct { + char *name; + u64 offset; + u64 addr; + } target; }; struct ins_ops { |