Lines Matching refs:browser

35 static inline struct annotation *browser__annotation(struct ui_browser *browser)  in browser__annotation()  argument
37 struct map_symbol *ms = browser->priv; in browser__annotation()
41 static bool disasm_line__filter(struct ui_browser *browser, void *entry) in disasm_line__filter() argument
43 struct annotation *notes = browser__annotation(browser); in disasm_line__filter()
48 static int ui_browser__jumps_percent_color(struct ui_browser *browser, int nr, bool current) in ui_browser__jumps_percent_color() argument
50 struct annotation *notes = browser__annotation(browser); in ui_browser__jumps_percent_color()
52 if (current && (!browser->use_navkeypressed || browser->navkeypressed)) in ui_browser__jumps_percent_color()
61 static int ui_browser__set_jumps_percent_color(void *browser, int nr, bool current) in ui_browser__set_jumps_percent_color() argument
63 int color = ui_browser__jumps_percent_color(browser, nr, current); in ui_browser__set_jumps_percent_color()
64 return ui_browser__set_color(browser, color); in ui_browser__set_jumps_percent_color()
67 static int annotate_browser__set_color(void *browser, int color) in annotate_browser__set_color() argument
69 return ui_browser__set_color(browser, color); in annotate_browser__set_color()
72 static void annotate_browser__write_graph(void *browser, int graph) in annotate_browser__write_graph() argument
74 ui_browser__write_graph(browser, graph); in annotate_browser__write_graph()
77 static void annotate_browser__set_percent_color(void *browser, double percent, bool current) in annotate_browser__set_percent_color() argument
79 ui_browser__set_percent_color(browser, percent, current); in annotate_browser__set_percent_color()
82 static void annotate_browser__printf(void *browser, const char *fmt, ...) in annotate_browser__printf() argument
87 ui_browser__vprintf(browser, fmt, args); in annotate_browser__printf()
91 static void annotate_browser__write(struct ui_browser *browser, void *entry, int row) in annotate_browser__write() argument
93 struct annotate_browser *ab = container_of(browser, struct annotate_browser, b); in annotate_browser__write()
94 struct annotation *notes = browser__annotation(browser); in annotate_browser__write()
96 const bool is_current_entry = ui_browser__is_current_entry(browser, row); in annotate_browser__write()
102 (browser->use_navkeypressed && in annotate_browser__write()
103 !browser->navkeypressed))), in annotate_browser__write()
104 .width = browser->width, in annotate_browser__write()
105 .obj = browser, in annotate_browser__write()
114 if (!browser->navkeypressed) in annotate_browser__write()
151 static void annotate_browser__draw_current_jump(struct ui_browser *browser) in annotate_browser__draw_current_jump() argument
153 struct annotate_browser *ab = container_of(browser, struct annotate_browser, b); in annotate_browser__draw_current_jump()
208 ui_browser__set_color(browser, HE_COLORSET_JUMP_ARROWS); in annotate_browser__draw_current_jump()
209 __ui_browser__line_arrow(browser, in annotate_browser__draw_current_jump()
215 ui_browser__mark_fused(browser, in annotate_browser__draw_current_jump()
221 static unsigned int annotate_browser__refresh(struct ui_browser *browser) in annotate_browser__refresh() argument
223 struct annotation *notes = browser__annotation(browser); in annotate_browser__refresh()
224 int ret = ui_browser__list_head_refresh(browser); in annotate_browser__refresh()
228 annotate_browser__draw_current_jump(browser); in annotate_browser__refresh()
230 ui_browser__set_color(browser, HE_COLORSET_NORMAL); in annotate_browser__refresh()
231 __ui_browser__vline(browser, pcnt_width, 0, browser->rows - 1); in annotate_browser__refresh()
249 static void disasm_rb_tree__insert(struct annotate_browser *browser, in disasm_rb_tree__insert() argument
252 struct rb_root *root = &browser->entries; in disasm_rb_tree__insert()
261 if (disasm__cmp(al, l, browser->opts->percent_type) < 0) in disasm_rb_tree__insert()
270 static void annotate_browser__set_top(struct annotate_browser *browser, in annotate_browser__set_top() argument
273 struct annotation *notes = browser__annotation(&browser->b); in annotate_browser__set_top()
276 ui_browser__refresh_dimensions(&browser->b); in annotate_browser__set_top()
277 back = browser->b.height / 2; in annotate_browser__set_top()
278 browser->b.top_idx = browser->b.index = idx; in annotate_browser__set_top()
280 while (browser->b.top_idx != 0 && back != 0) { in annotate_browser__set_top()
286 --browser->b.top_idx; in annotate_browser__set_top()
290 browser->b.top = pos; in annotate_browser__set_top()
291 browser->b.navkeypressed = true; in annotate_browser__set_top()
294 static void annotate_browser__set_rb_top(struct annotate_browser *browser, in annotate_browser__set_rb_top() argument
297 struct annotation *notes = browser__annotation(&browser->b); in annotate_browser__set_rb_top()
303 annotate_browser__set_top(browser, pos, idx); in annotate_browser__set_rb_top()
304 browser->curr_hot = nd; in annotate_browser__set_rb_top()
307 static void annotate_browser__calc_percent(struct annotate_browser *browser, in annotate_browser__calc_percent() argument
310 struct map_symbol *ms = browser->b.priv; in annotate_browser__calc_percent()
315 browser->entries = RB_ROOT; in annotate_browser__calc_percent()
334 browser->opts->percent_type); in annotate_browser__calc_percent()
344 disasm_rb_tree__insert(browser, &pos->al); in annotate_browser__calc_percent()
348 browser->curr_hot = rb_last(&browser->entries); in annotate_browser__calc_percent()
352 struct annotate_browser *browser, in annotate_browser__find_next_asm_line() argument
358 list_for_each_entry_continue(it, browser->b.entries, node) { in annotate_browser__find_next_asm_line()
365 list_for_each_entry_continue_reverse(it, browser->b.entries, node) { in annotate_browser__find_next_asm_line()
374 static bool annotate_browser__toggle_source(struct annotate_browser *browser) in annotate_browser__toggle_source() argument
376 struct annotation *notes = browser__annotation(&browser->b); in annotate_browser__toggle_source()
378 off_t offset = browser->b.index - browser->b.top_idx; in annotate_browser__toggle_source()
380 browser->b.seek(&browser->b, offset, SEEK_CUR); in annotate_browser__toggle_source()
381 al = list_entry(browser->b.top, struct annotation_line, node); in annotate_browser__toggle_source()
387 browser->b.nr_entries = notes->nr_entries; in annotate_browser__toggle_source()
389 browser->b.seek(&browser->b, -offset, SEEK_CUR); in annotate_browser__toggle_source()
390 browser->b.top_idx = al->idx - offset; in annotate_browser__toggle_source()
391 browser->b.index = al->idx; in annotate_browser__toggle_source()
395 al = annotate_browser__find_next_asm_line(browser, al); in annotate_browser__toggle_source()
397 browser->b.seek(&browser->b, -offset, SEEK_CUR); in annotate_browser__toggle_source()
405 browser->b.nr_entries = notes->nr_asm_entries; in annotate_browser__toggle_source()
407 browser->b.seek(&browser->b, -offset, SEEK_CUR); in annotate_browser__toggle_source()
408 browser->b.top_idx = al->idx_asm - offset; in annotate_browser__toggle_source()
409 browser->b.index = al->idx_asm; in annotate_browser__toggle_source()
417 static void annotate_browser__show_full_location(struct ui_browser *browser) in annotate_browser__show_full_location() argument
419 struct annotate_browser *ab = container_of(browser, struct annotate_browser, b); in annotate_browser__show_full_location()
434 static void ui_browser__init_asm_mode(struct ui_browser *browser) in ui_browser__init_asm_mode() argument
436 struct annotation *notes = browser__annotation(browser); in ui_browser__init_asm_mode()
437 ui_browser__reset_index(browser); in ui_browser__init_asm_mode()
438 browser->nr_entries = notes->nr_asm_entries; in ui_browser__init_asm_mode()
457 static bool annotate_browser__callq(struct annotate_browser *browser, in annotate_browser__callq() argument
461 struct map_symbol *ms = browser->b.priv, target_ms; in annotate_browser__callq()
462 struct disasm_line *dl = disasm_line(browser->selection); in annotate_browser__callq()
485 symbol__tui_annotate(&target_ms, evsel, hbt, browser->opts); in annotate_browser__callq()
486 sym_title(ms->sym, ms->map, title, sizeof(title), browser->opts->percent_type); in annotate_browser__callq()
487 ui_browser__show_title(&browser->b, title); in annotate_browser__callq()
492 struct disasm_line *annotate_browser__find_offset(struct annotate_browser *browser, in annotate_browser__find_offset() argument
495 struct annotation *notes = browser__annotation(&browser->b); in annotate_browser__find_offset()
509 static bool annotate_browser__jump(struct annotate_browser *browser, in annotate_browser__jump() argument
513 struct disasm_line *dl = disasm_line(browser->selection); in annotate_browser__jump()
521 annotate_browser__callq(browser, evsel, hbt); in annotate_browser__jump()
526 dl = annotate_browser__find_offset(browser, offset, &idx); in annotate_browser__jump()
532 annotate_browser__set_top(browser, &dl->al, idx); in annotate_browser__jump()
538 struct annotation_line *annotate_browser__find_string(struct annotate_browser *browser, in annotate_browser__find_string() argument
541 struct annotation *notes = browser__annotation(&browser->b); in annotate_browser__find_string()
542 struct annotation_line *al = browser->selection; in annotate_browser__find_string()
544 *idx = browser->b.index; in annotate_browser__find_string()
558 static bool __annotate_browser__search(struct annotate_browser *browser) in __annotate_browser__search() argument
563 al = annotate_browser__find_string(browser, browser->search_bf, &idx); in __annotate_browser__search()
569 annotate_browser__set_top(browser, al, idx); in __annotate_browser__search()
570 browser->searching_backwards = false; in __annotate_browser__search()
575 struct annotation_line *annotate_browser__find_string_reverse(struct annotate_browser *browser, in annotate_browser__find_string_reverse() argument
578 struct annotation *notes = browser__annotation(&browser->b); in annotate_browser__find_string_reverse()
579 struct annotation_line *al = browser->selection; in annotate_browser__find_string_reverse()
581 *idx = browser->b.index; in annotate_browser__find_string_reverse()
595 static bool __annotate_browser__search_reverse(struct annotate_browser *browser) in __annotate_browser__search_reverse() argument
600 al = annotate_browser__find_string_reverse(browser, browser->search_bf, &idx); in __annotate_browser__search_reverse()
606 annotate_browser__set_top(browser, al, idx); in __annotate_browser__search_reverse()
607 browser->searching_backwards = true; in __annotate_browser__search_reverse()
611 static bool annotate_browser__search_window(struct annotate_browser *browser, in annotate_browser__search_window() argument
614 if (ui_browser__input_window("Search", "String: ", browser->search_bf, in annotate_browser__search_window()
617 !*browser->search_bf) in annotate_browser__search_window()
623 static bool annotate_browser__search(struct annotate_browser *browser, int delay_secs) in annotate_browser__search() argument
625 if (annotate_browser__search_window(browser, delay_secs)) in annotate_browser__search()
626 return __annotate_browser__search(browser); in annotate_browser__search()
631 static bool annotate_browser__continue_search(struct annotate_browser *browser, in annotate_browser__continue_search() argument
634 if (!*browser->search_bf) in annotate_browser__continue_search()
635 return annotate_browser__search(browser, delay_secs); in annotate_browser__continue_search()
637 return __annotate_browser__search(browser); in annotate_browser__continue_search()
640 static bool annotate_browser__search_reverse(struct annotate_browser *browser, in annotate_browser__search_reverse() argument
643 if (annotate_browser__search_window(browser, delay_secs)) in annotate_browser__search_reverse()
644 return __annotate_browser__search_reverse(browser); in annotate_browser__search_reverse()
650 bool annotate_browser__continue_search_reverse(struct annotate_browser *browser, in annotate_browser__continue_search_reverse() argument
653 if (!*browser->search_bf) in annotate_browser__continue_search_reverse()
654 return annotate_browser__search_reverse(browser, delay_secs); in annotate_browser__continue_search_reverse()
656 return __annotate_browser__search_reverse(browser); in annotate_browser__continue_search_reverse()
659 static int annotate_browser__show(struct ui_browser *browser, char *title, const char *help) in annotate_browser__show() argument
661 struct annotate_browser *ab = container_of(browser, struct annotate_browser, b); in annotate_browser__show()
662 struct map_symbol *ms = browser->priv; in annotate_browser__show()
666 if (ui_browser__show(browser, title, help) < 0) in annotate_browser__show()
671 ui_browser__gotorc_title(browser, 0, 0); in annotate_browser__show()
672 ui_browser__set_color(browser, HE_COLORSET_ROOT); in annotate_browser__show()
673 ui_browser__write_nstring(browser, symbol_dso, browser->width + 1); in annotate_browser__show()
710 static int annotate_browser__run(struct annotate_browser *browser, in annotate_browser__run() argument
716 struct map_symbol *ms = browser->b.priv; in annotate_browser__run()
725 if (annotate_browser__show(&browser->b, title, help) < 0) in annotate_browser__run()
728 annotate_browser__calc_percent(browser, evsel); in annotate_browser__run()
730 if (browser->curr_hot) { in annotate_browser__run()
731 annotate_browser__set_rb_top(browser, browser->curr_hot); in annotate_browser__run()
732 browser->b.navkeypressed = false; in annotate_browser__run()
735 nd = browser->curr_hot; in annotate_browser__run()
738 key = ui_browser__run(&browser->b, delay_secs); in annotate_browser__run()
741 annotate_browser__calc_percent(browser, evsel); in annotate_browser__run()
759 annotate_browser__show(&browser->b, title, help); in annotate_browser__run()
766 nd = rb_last(&browser->entries); in annotate_browser__run()
768 nd = browser->curr_hot; in annotate_browser__run()
774 nd = rb_first(&browser->entries); in annotate_browser__run()
776 nd = browser->curr_hot; in annotate_browser__run()
780 ui_browser__help_window(&browser->b, in annotate_browser__run()
808 annotate_browser__show(&browser->b, title, help); in annotate_browser__run()
814 annotate_browser__show_full_location (&browser->b); in annotate_browser__run()
817 nd = browser->curr_hot; in annotate_browser__run()
820 if (annotate_browser__toggle_source(browser)) in annotate_browser__run()
839 if (annotate_browser__search(browser, delay_secs)) { in annotate_browser__run()
845 if (browser->searching_backwards ? in annotate_browser__run()
846 annotate_browser__continue_search_reverse(browser, delay_secs) : in annotate_browser__run()
847 annotate_browser__continue_search(browser, delay_secs)) in annotate_browser__run()
851 if (annotate_browser__search_reverse(browser, delay_secs)) in annotate_browser__run()
858 seq++, browser->b.nr_entries, in annotate_browser__run()
859 browser->b.height, in annotate_browser__run()
860 browser->b.index, in annotate_browser__run()
861 browser->b.top_idx, in annotate_browser__run()
868 struct disasm_line *dl = disasm_line(browser->selection); in annotate_browser__run()
870 if (browser->selection == NULL) in annotate_browser__run()
872 else if (browser->selection->offset == -1) in annotate_browser__run()
878 else if (!(annotate_browser__jump(browser, evsel, hbt) || in annotate_browser__run()
879 annotate_browser__callq(browser, evsel, hbt))) { in annotate_browser__run()
886 map_symbol__annotation_dump(ms, evsel, browser->opts); in annotate_browser__run()
907 switch_percent_type(browser->opts, key == 'b'); in annotate_browser__run()
909 annotate_browser__show(&browser->b, title, help); in annotate_browser__run()
924 annotate_browser__set_rb_top(browser, nd); in annotate_browser__run()
927 ui_browser__hide(&browser->b); in annotate_browser__run()
955 struct annotate_browser browser = { in symbol__tui_annotate() local
977 err = symbol__annotate2(ms, evsel, opts, &browser.arch); in symbol__tui_annotate()
989 browser.b.width = notes->max_line_len; in symbol__tui_annotate()
990 browser.b.nr_entries = notes->nr_entries; in symbol__tui_annotate()
991 browser.b.entries = &notes->src->source, in symbol__tui_annotate()
992 browser.b.width += 18; /* Percentage */ in symbol__tui_annotate()
995 ui_browser__init_asm_mode(&browser.b); in symbol__tui_annotate()
997 ret = annotate_browser__run(&browser, evsel, hbt); in symbol__tui_annotate()