aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/annotate.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2012-04-25 07:00:23 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-04-25 07:00:23 -0400
commit44d1a3edfbd65f9da6725921e2425b10477772d8 (patch)
tree127655e788cf172e26eea4e38b98303c998e0d4a /tools/perf/util/annotate.c
parent9481ede909e08418c9379665ee9f25335d20dd06 (diff)
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/annotate.c')
-rw-r--r--tools/perf/util/annotate.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index b07d7d1425f9..e1e7d0eb6145 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)
22{ 22{
23 char *endptr, *tok, *name; 23 char *endptr, *tok, *name;
24 24
25 ops->target = strtoull(ops->raw, &endptr, 16); 25 ops->target.addr = strtoull(ops->raw, &endptr, 16);
26 26
27 name = strchr(endptr, '<'); 27 name = strchr(endptr, '<');
28 if (name == NULL) 28 if (name == NULL)
@@ -35,17 +35,17 @@ static int call__parse(struct ins_operands *ops)
35 return -1; 35 return -1;
36 36
37 *tok = '\0'; 37 *tok = '\0';
38 ops->target_name = strdup(name); 38 ops->target.name = strdup(name);
39 *tok = '>'; 39 *tok = '>';
40 40
41 return ops->target_name == NULL ? -1 : 0; 41 return ops->target.name == NULL ? -1 : 0;
42 42
43indirect_call: 43indirect_call:
44 tok = strchr(endptr, '*'); 44 tok = strchr(endptr, '*');
45 if (tok == NULL) 45 if (tok == NULL)
46 return -1; 46 return -1;
47 47
48 ops->target = strtoull(tok + 1, NULL, 16); 48 ops->target.addr = strtoull(tok + 1, NULL, 16);
49 return 0; 49 return 0;
50} 50}
51 51
@@ -55,10 +55,10 @@ static int call__scnprintf(struct ins *ins, char *bf, size_t size,
55 if (addrs) 55 if (addrs)
56 return scnprintf(bf, size, "%-6.6s %s", ins->name, ops->raw); 56 return scnprintf(bf, size, "%-6.6s %s", ins->name, ops->raw);
57 57
58 if (ops->target_name) 58 if (ops->target.name)
59 return scnprintf(bf, size, "%-6.6s %s", ins->name, ops->target_name); 59 return scnprintf(bf, size, "%-6.6s %s", ins->name, ops->target.name);
60 60
61 return scnprintf(bf, size, "%-6.6s *%" PRIx64, ins->name, ops->target); 61 return scnprintf(bf, size, "%-6.6s *%" PRIx64, ins->name, ops->target.addr);
62} 62}
63 63
64static struct ins_ops call_ops = { 64static struct ins_ops call_ops = {
@@ -78,7 +78,7 @@ static int jump__parse(struct ins_operands *ops)
78 if (s++ == NULL) 78 if (s++ == NULL)
79 return -1; 79 return -1;
80 80
81 ops->target = strtoll(s, NULL, 16); 81 ops->target.offset = strtoll(s, NULL, 16);
82 return 0; 82 return 0;
83} 83}
84 84
@@ -88,7 +88,7 @@ static int jump__scnprintf(struct ins *ins, char *bf, size_t size,
88 if (addrs) 88 if (addrs)
89 return scnprintf(bf, size, "%-6.6s %s", ins->name, ops->raw); 89 return scnprintf(bf, size, "%-6.6s %s", ins->name, ops->raw);
90 90
91 return scnprintf(bf, size, "%-6.6s %" PRIx64, ins->name, ops->target); 91 return scnprintf(bf, size, "%-6.6s %" PRIx64, ins->name, ops->target.offset);
92} 92}
93 93
94static struct ins_ops jump_ops = { 94static struct ins_ops jump_ops = {
@@ -289,7 +289,7 @@ void disasm_line__free(struct disasm_line *dl)
289{ 289{
290 free(dl->line); 290 free(dl->line);
291 free(dl->name); 291 free(dl->name);
292 free(dl->ops.target_name); 292 free(dl->ops.target.name);
293 free(dl); 293 free(dl);
294} 294}
295 295