From 44d1a3edfbd65f9da6725921e2425b10477772d8 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Wed, 25 Apr 2012 08:00:23 -0300 Subject: 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 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-3nlcmstua75u07ao7wja1rwx@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/ui/browsers/annotate.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'tools/perf/ui/browsers/annotate.c') diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c index 4c83fe3d7dad..73e1ef0081d4 100644 --- a/tools/perf/ui/browsers/annotate.c +++ b/tools/perf/ui/browsers/annotate.c @@ -112,7 +112,7 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro ui_browser__set_color(self, color); if (dl->ins && dl->ins->ops->scnprintf) { if (ins__is_jump(dl->ins)) { - bool fwd = dl->ops.target > (u64)dl->offset; + bool fwd = dl->ops.target.offset > (u64)dl->offset; ui_browser__write_graph(self, fwd ? SLSMG_DARROW_CHAR : SLSMG_UARROW_CHAR); @@ -156,7 +156,7 @@ static void annotate_browser__draw_current_loop(struct ui_browser *browser) if (!pos->ins || !ins__is_jump(pos->ins)) continue; - target = ab->offsets[pos->ops.target]; + target = ab->offsets[pos->ops.target.offset]; if (!target) continue; @@ -360,7 +360,7 @@ static bool annotate_browser__callq(struct annotate_browser *browser, if (!ins__is_call(dl->ins)) return false; - ip = ms->map->map_ip(ms->map, dl->ops.target); + ip = ms->map->map_ip(ms->map, dl->ops.target.addr); target = map__find_symbol(ms->map, ip, NULL); if (target == NULL) { ui_helpline__puts("The called function was not found."); @@ -411,7 +411,7 @@ static bool annotate_browser__jump(struct annotate_browser *browser) if (!ins__is_jump(dl->ins)) return false; - dl = annotate_browser__find_offset(browser, dl->ops.target, &idx); + dl = annotate_browser__find_offset(browser, dl->ops.target.offset, &idx); if (dl == NULL) { ui_helpline__puts("Invallid jump offset"); return true; @@ -692,14 +692,14 @@ static void annotate_browser__mark_jump_targets(struct annotate_browser *browser if (!dl || !dl->ins || !ins__is_jump(dl->ins)) continue; - if (dl->ops.target >= size) { + if (dl->ops.target.offset >= size) { ui__error("jump to after symbol!\n" "size: %zx, jump target: %" PRIx64, - size, dl->ops.target); + size, dl->ops.target.offset); continue; } - dlt = browser->offsets[dl->ops.target]; + dlt = browser->offsets[dl->ops.target.offset]; /* * FIXME: Oops, no jump target? Buggy disassembler? Or do we * have to adjust to the previous offset? -- cgit v1.2.3