Commit 1179e11b authored by Adrian Hunter's avatar Adrian Hunter Committed by Arnaldo Carvalho de Melo

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: default avatarAdrian 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.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 0544d422
...@@ -442,35 +442,34 @@ static bool annotate_browser__callq(struct annotate_browser *browser, ...@@ -442,35 +442,34 @@ static bool annotate_browser__callq(struct annotate_browser *browser,
{ {
struct map_symbol *ms = browser->b.priv; struct map_symbol *ms = browser->b.priv;
struct disasm_line *dl = browser->selection; struct disasm_line *dl = browser->selection;
struct symbol *sym = ms->sym;
struct annotation *notes; struct annotation *notes;
struct symbol *target; struct addr_map_symbol target = {
u64 ip; .map = ms->map,
.addr = dl->ops.target.addr,
};
char title[SYM_TITLE_MAX_SIZE]; char title[SYM_TITLE_MAX_SIZE];
if (!ins__is_call(dl->ins)) if (!ins__is_call(dl->ins))
return false; return false;
ip = ms->map->map_ip(ms->map, dl->ops.target.addr); if (map_groups__find_ams(&target, NULL)) {
target = map__find_symbol(ms->map, ip, NULL);
if (target == NULL) {
ui_helpline__puts("The called function was not found."); ui_helpline__puts("The called function was not found.");
return true; return true;
} }
notes = symbol__annotation(target); notes = symbol__annotation(target.sym);
pthread_mutex_lock(&notes->lock); pthread_mutex_lock(&notes->lock);
if (notes->src == NULL && symbol__alloc_hist(target) < 0) { if (notes->src == NULL && symbol__alloc_hist(target.sym) < 0) {
pthread_mutex_unlock(&notes->lock); pthread_mutex_unlock(&notes->lock);
ui__warning("Not enough memory for annotating '%s' symbol!\n", ui__warning("Not enough memory for annotating '%s' symbol!\n",
target->name); target.sym->name);
return true; return true;
} }
pthread_mutex_unlock(&notes->lock); pthread_mutex_unlock(&notes->lock);
symbol__tui_annotate(target, ms->map, evsel, hbt); symbol__tui_annotate(target.sym, target.map, evsel, hbt);
sym_title(sym, ms->map, title, sizeof(title)); sym_title(ms->sym, ms->map, title, sizeof(title));
ui_browser__show_title(&browser->b, title); ui_browser__show_title(&browser->b, title);
return true; return true;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment