diff options
Diffstat (limited to 'tools/perf/ui/browsers/annotate.c')
-rw-r--r-- | tools/perf/ui/browsers/annotate.c | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c index 8f8cd2d73b3b..5dab3ca96980 100644 --- a/tools/perf/ui/browsers/annotate.c +++ b/tools/perf/ui/browsers/annotate.c | |||
@@ -188,6 +188,12 @@ static void annotate_browser__draw_current_jump(struct ui_browser *browser) | |||
188 | struct disasm_line *cursor = ab->selection, *target; | 188 | struct disasm_line *cursor = ab->selection, *target; |
189 | struct browser_disasm_line *btarget, *bcursor; | 189 | struct browser_disasm_line *btarget, *bcursor; |
190 | unsigned int from, to; | 190 | 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; | ||
191 | 197 | ||
192 | if (!cursor || !cursor->ins || !ins__is_jump(cursor->ins) || | 198 | if (!cursor || !cursor->ins || !ins__is_jump(cursor->ins) || |
193 | !disasm_line__has_offset(cursor)) | 199 | !disasm_line__has_offset(cursor)) |
@@ -386,9 +392,8 @@ static void annotate_browser__init_asm_mode(struct annotate_browser *browser) | |||
386 | browser->b.nr_entries = browser->nr_asm_entries; | 392 | browser->b.nr_entries = browser->nr_asm_entries; |
387 | } | 393 | } |
388 | 394 | ||
389 | static bool annotate_browser__callq(struct annotate_browser *browser, | 395 | static bool annotate_browser__callq(struct annotate_browser *browser, int evidx, |
390 | int evidx, void (*timer)(void *arg), | 396 | struct hist_browser_timer *hbt) |
391 | void *arg, int delay_secs) | ||
392 | { | 397 | { |
393 | struct map_symbol *ms = browser->b.priv; | 398 | struct map_symbol *ms = browser->b.priv; |
394 | struct disasm_line *dl = browser->selection; | 399 | struct disasm_line *dl = browser->selection; |
@@ -418,7 +423,7 @@ static bool annotate_browser__callq(struct annotate_browser *browser, | |||
418 | } | 423 | } |
419 | 424 | ||
420 | pthread_mutex_unlock(¬es->lock); | 425 | pthread_mutex_unlock(¬es->lock); |
421 | symbol__tui_annotate(target, ms->map, evidx, timer, arg, delay_secs); | 426 | symbol__tui_annotate(target, ms->map, evidx, hbt); |
422 | ui_browser__show_title(&browser->b, sym->name); | 427 | ui_browser__show_title(&browser->b, sym->name); |
423 | return true; | 428 | return true; |
424 | } | 429 | } |
@@ -602,13 +607,13 @@ static void annotate_browser__update_addr_width(struct annotate_browser *browser | |||
602 | } | 607 | } |
603 | 608 | ||
604 | static int annotate_browser__run(struct annotate_browser *browser, int evidx, | 609 | static int annotate_browser__run(struct annotate_browser *browser, int evidx, |
605 | void(*timer)(void *arg), | 610 | struct hist_browser_timer *hbt) |
606 | void *arg, int delay_secs) | ||
607 | { | 611 | { |
608 | struct rb_node *nd = NULL; | 612 | struct rb_node *nd = NULL; |
609 | struct map_symbol *ms = browser->b.priv; | 613 | struct map_symbol *ms = browser->b.priv; |
610 | struct symbol *sym = ms->sym; | 614 | struct symbol *sym = ms->sym; |
611 | const char *help = "Press 'h' for help on key bindings"; | 615 | const char *help = "Press 'h' for help on key bindings"; |
616 | int delay_secs = hbt ? hbt->refresh : 0; | ||
612 | int key; | 617 | int key; |
613 | 618 | ||
614 | if (ui_browser__show(&browser->b, sym->name, help) < 0) | 619 | if (ui_browser__show(&browser->b, sym->name, help) < 0) |
@@ -639,8 +644,8 @@ static int annotate_browser__run(struct annotate_browser *browser, int evidx, | |||
639 | 644 | ||
640 | switch (key) { | 645 | switch (key) { |
641 | case K_TIMER: | 646 | case K_TIMER: |
642 | if (timer != NULL) | 647 | if (hbt) |
643 | timer(arg); | 648 | hbt->timer(hbt->arg); |
644 | 649 | ||
645 | if (delay_secs != 0) | 650 | if (delay_secs != 0) |
646 | symbol__annotate_decay_histogram(sym, evidx); | 651 | symbol__annotate_decay_histogram(sym, evidx); |
@@ -676,8 +681,14 @@ static int annotate_browser__run(struct annotate_browser *browser, int evidx, | |||
676 | "o Toggle disassembler output/simplified view\n" | 681 | "o Toggle disassembler output/simplified view\n" |
677 | "s Toggle source code view\n" | 682 | "s Toggle source code view\n" |
678 | "/ Search string\n" | 683 | "/ Search string\n" |
684 | "r Run available scripts\n" | ||
679 | "? Search previous string\n"); | 685 | "? Search previous string\n"); |
680 | continue; | 686 | continue; |
687 | case 'r': | ||
688 | { | ||
689 | script_browse(NULL); | ||
690 | continue; | ||
691 | } | ||
681 | case 'H': | 692 | case 'H': |
682 | nd = browser->curr_hot; | 693 | nd = browser->curr_hot; |
683 | break; | 694 | break; |
@@ -734,7 +745,7 @@ show_help: | |||
734 | goto show_sup_ins; | 745 | goto show_sup_ins; |
735 | goto out; | 746 | goto out; |
736 | } else if (!(annotate_browser__jump(browser) || | 747 | } else if (!(annotate_browser__jump(browser) || |
737 | annotate_browser__callq(browser, evidx, timer, arg, delay_secs))) { | 748 | annotate_browser__callq(browser, evidx, hbt))) { |
738 | show_sup_ins: | 749 | show_sup_ins: |
739 | ui_helpline__puts("Actions are only available for 'callq', 'retq' & jump instructions."); | 750 | ui_helpline__puts("Actions are only available for 'callq', 'retq' & jump instructions."); |
740 | } | 751 | } |
@@ -757,16 +768,21 @@ out: | |||
757 | } | 768 | } |
758 | 769 | ||
759 | int hist_entry__tui_annotate(struct hist_entry *he, int evidx, | 770 | int hist_entry__tui_annotate(struct hist_entry *he, int evidx, |
760 | void(*timer)(void *arg), void *arg, int delay_secs) | 771 | struct hist_browser_timer *hbt) |
761 | { | 772 | { |
762 | return symbol__tui_annotate(he->ms.sym, he->ms.map, evidx, | 773 | return symbol__tui_annotate(he->ms.sym, he->ms.map, evidx, hbt); |
763 | timer, arg, delay_secs); | ||
764 | } | 774 | } |
765 | 775 | ||
766 | static void annotate_browser__mark_jump_targets(struct annotate_browser *browser, | 776 | static void annotate_browser__mark_jump_targets(struct annotate_browser *browser, |
767 | size_t size) | 777 | size_t size) |
768 | { | 778 | { |
769 | u64 offset; | 779 | 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; | ||
770 | 786 | ||
771 | for (offset = 0; offset < size; ++offset) { | 787 | for (offset = 0; offset < size; ++offset) { |
772 | struct disasm_line *dl = browser->offsets[offset], *dlt; | 788 | struct disasm_line *dl = browser->offsets[offset], *dlt; |
@@ -810,8 +826,7 @@ static inline int width_jumps(int n) | |||
810 | } | 826 | } |
811 | 827 | ||
812 | int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx, | 828 | int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx, |
813 | void(*timer)(void *arg), void *arg, | 829 | struct hist_browser_timer *hbt) |
814 | int delay_secs) | ||
815 | { | 830 | { |
816 | struct disasm_line *pos, *n; | 831 | struct disasm_line *pos, *n; |
817 | struct annotation *notes; | 832 | struct annotation *notes; |
@@ -893,7 +908,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx, | |||
893 | 908 | ||
894 | annotate_browser__update_addr_width(&browser); | 909 | annotate_browser__update_addr_width(&browser); |
895 | 910 | ||
896 | ret = annotate_browser__run(&browser, evidx, timer, arg, delay_secs); | 911 | ret = annotate_browser__run(&browser, evidx, hbt); |
897 | list_for_each_entry_safe(pos, n, ¬es->src->source, node) { | 912 | list_for_each_entry_safe(pos, n, ¬es->src->source, node) { |
898 | list_del(&pos->node); | 913 | list_del(&pos->node); |
899 | disasm_line__free(pos); | 914 | disasm_line__free(pos); |