diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2013-10-14 06:43:39 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-10-14 09:29:27 -0400 |
commit | 1179e11bbb655162e83b33e17a97c45d3fe292da (patch) | |
tree | 1d0fc874e65829c3de495583270edb8be677a7e3 /tools/perf/ui | |
parent | 0544d4225c52ca31ab2a55b22ddce1392d8f45a4 (diff) |
perf annotate: Fix annotate_browser__callq()
When following a call, annotate_browser__callq() uses the current
symbol's map to look up the target ip. That will not work if the target
ip is on a map with a different mapping (i.e. start - pgoff is
different).
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1381747424-3557-3-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/ui')
-rw-r--r-- | tools/perf/ui/browsers/annotate.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c index 08545ae46992..57d3a8659fc0 100644 --- a/tools/perf/ui/browsers/annotate.c +++ b/tools/perf/ui/browsers/annotate.c | |||
@@ -442,35 +442,34 @@ static bool annotate_browser__callq(struct annotate_browser *browser, | |||
442 | { | 442 | { |
443 | struct map_symbol *ms = browser->b.priv; | 443 | struct map_symbol *ms = browser->b.priv; |
444 | struct disasm_line *dl = browser->selection; | 444 | struct disasm_line *dl = browser->selection; |
445 | struct symbol *sym = ms->sym; | ||
446 | struct annotation *notes; | 445 | struct annotation *notes; |
447 | struct symbol *target; | 446 | struct addr_map_symbol target = { |
448 | u64 ip; | 447 | .map = ms->map, |
448 | .addr = dl->ops.target.addr, | ||
449 | }; | ||
449 | char title[SYM_TITLE_MAX_SIZE]; | 450 | char title[SYM_TITLE_MAX_SIZE]; |
450 | 451 | ||
451 | if (!ins__is_call(dl->ins)) | 452 | if (!ins__is_call(dl->ins)) |
452 | return false; | 453 | return false; |
453 | 454 | ||
454 | ip = ms->map->map_ip(ms->map, dl->ops.target.addr); | 455 | if (map_groups__find_ams(&target, NULL)) { |
455 | target = map__find_symbol(ms->map, ip, NULL); | ||
456 | if (target == NULL) { | ||
457 | ui_helpline__puts("The called function was not found."); | 456 | ui_helpline__puts("The called function was not found."); |
458 | return true; | 457 | return true; |
459 | } | 458 | } |
460 | 459 | ||
461 | notes = symbol__annotation(target); | 460 | notes = symbol__annotation(target.sym); |
462 | pthread_mutex_lock(¬es->lock); | 461 | pthread_mutex_lock(¬es->lock); |
463 | 462 | ||
464 | if (notes->src == NULL && symbol__alloc_hist(target) < 0) { | 463 | if (notes->src == NULL && symbol__alloc_hist(target.sym) < 0) { |
465 | pthread_mutex_unlock(¬es->lock); | 464 | pthread_mutex_unlock(¬es->lock); |
466 | ui__warning("Not enough memory for annotating '%s' symbol!\n", | 465 | ui__warning("Not enough memory for annotating '%s' symbol!\n", |
467 | target->name); | 466 | target.sym->name); |
468 | return true; | 467 | return true; |
469 | } | 468 | } |
470 | 469 | ||
471 | pthread_mutex_unlock(¬es->lock); | 470 | pthread_mutex_unlock(¬es->lock); |
472 | symbol__tui_annotate(target, ms->map, evsel, hbt); | 471 | symbol__tui_annotate(target.sym, target.map, evsel, hbt); |
473 | sym_title(sym, ms->map, title, sizeof(title)); | 472 | sym_title(ms->sym, ms->map, title, sizeof(title)); |
474 | ui_browser__show_title(&browser->b, title); | 473 | ui_browser__show_title(&browser->b, title); |
475 | return true; | 474 | return true; |
476 | } | 475 | } |