提交 32ae1efd 编写于 作者: N Namhyung Kim 提交者: Arnaldo Carvalho de Melo

perf annotate: Don't try to follow jump target on PLT symbols

The perf annotate browser on TUI can identify a jump target for a
selected instruction.  It assumes that the jump target is within the
function but it's not the case of PLT symbols which have offset out of
the function as a target.

Since it caused a segmentation fault, do not try to follow jump target
on the PLT symbols.
Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1352482044-3443-5-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 2ba34aaa
...@@ -188,6 +188,12 @@ static void annotate_browser__draw_current_jump(struct ui_browser *browser) ...@@ -188,6 +188,12 @@ static void annotate_browser__draw_current_jump(struct ui_browser *browser)
struct disasm_line *cursor = ab->selection, *target; struct disasm_line *cursor = ab->selection, *target;
struct browser_disasm_line *btarget, *bcursor; struct browser_disasm_line *btarget, *bcursor;
unsigned int from, to; unsigned int from, to;
struct map_symbol *ms = ab->b.priv;
struct symbol *sym = ms->sym;
/* PLT symbols contain external offsets */
if (strstr(sym->name, "@plt"))
return;
if (!cursor || !cursor->ins || !ins__is_jump(cursor->ins) || if (!cursor || !cursor->ins || !ins__is_jump(cursor->ins) ||
!disasm_line__has_offset(cursor)) !disasm_line__has_offset(cursor))
...@@ -771,6 +777,12 @@ static void annotate_browser__mark_jump_targets(struct annotate_browser *browser ...@@ -771,6 +777,12 @@ static void annotate_browser__mark_jump_targets(struct annotate_browser *browser
size_t size) size_t size)
{ {
u64 offset; u64 offset;
struct map_symbol *ms = browser->b.priv;
struct symbol *sym = ms->sym;
/* PLT symbols contain external offsets */
if (strstr(sym->name, "@plt"))
return;
for (offset = 0; offset < size; ++offset) { for (offset = 0; offset < size; ++offset) {
struct disasm_line *dl = browser->offsets[offset], *dlt; struct disasm_line *dl = browser->offsets[offset], *dlt;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册