Skip to content

Commit 32ae1ef

Browse files
Namhyung Kimacmel
authored andcommitted
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: Namhyung Kim <[email protected]> Cc: Andi Kleen <[email protected]> Cc: David Ahern <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 2ba34aa commit 32ae1ef

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tools/perf/ui/browsers/annotate.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,12 @@ static void annotate_browser__draw_current_jump(struct ui_browser *browser)
188188
struct disasm_line *cursor = ab->selection, *target;
189189
struct browser_disasm_line *btarget, *bcursor;
190190
unsigned int from, to;
191+
struct map_symbol *ms = ab->b.priv;
192+
struct symbol *sym = ms->sym;
193+
194+
/* PLT symbols contain external offsets */
195+
if (strstr(sym->name, "@plt"))
196+
return;
191197

192198
if (!cursor || !cursor->ins || !ins__is_jump(cursor->ins) ||
193199
!disasm_line__has_offset(cursor))
@@ -771,6 +777,12 @@ static void annotate_browser__mark_jump_targets(struct annotate_browser *browser
771777
size_t size)
772778
{
773779
u64 offset;
780+
struct map_symbol *ms = browser->b.priv;
781+
struct symbol *sym = ms->sym;
782+
783+
/* PLT symbols contain external offsets */
784+
if (strstr(sym->name, "@plt"))
785+
return;
774786

775787
for (offset = 0; offset < size; ++offset) {
776788
struct disasm_line *dl = browser->offsets[offset], *dlt;

0 commit comments

Comments
 (0)