Lines Matching refs:browser

63 static bool disasm_line__filter(struct ui_browser *browser __maybe_unused,  in disasm_line__filter()
74 static int annotate_browser__jumps_percent_color(struct annotate_browser *browser, in annotate_browser__jumps_percent_color() argument
77 if (current && (!browser->b.use_navkeypressed || browser->b.navkeypressed)) in annotate_browser__jumps_percent_color()
79 if (nr == browser->max_jump_sources) in annotate_browser__jumps_percent_color()
86 static int annotate_browser__set_jumps_percent_color(struct annotate_browser *browser, in annotate_browser__set_jumps_percent_color() argument
89 int color = annotate_browser__jumps_percent_color(browser, nr, current); in annotate_browser__set_jumps_percent_color()
90 return ui_browser__set_color(&browser->b, color); in annotate_browser__set_jumps_percent_color()
93 static void annotate_browser__write(struct ui_browser *browser, void *entry, int row) in annotate_browser__write() argument
95 struct annotate_browser *ab = container_of(browser, struct annotate_browser, b); in annotate_browser__write()
98 bool current_entry = ui_browser__is_current_entry(browser, row); in annotate_browser__write()
100 (!current_entry || (browser->use_navkeypressed && in annotate_browser__write()
101 !browser->navkeypressed))); in annotate_browser__write()
102 int width = browser->width, printed; in annotate_browser__write()
114 ui_browser__set_percent_color(browser, bdl->percent[i], in annotate_browser__write()
119 ui_browser__set_percent_color(browser, 0, current_entry); in annotate_browser__write()
126 if (!browser->navkeypressed) in annotate_browser__write()
159 ui_browser__set_color(browser, prev); in annotate_browser__write()
171 color = ui_browser__set_color(browser, HE_COLORSET_ADDR); in annotate_browser__write()
174 ui_browser__set_color(browser, color); in annotate_browser__write()
179 ui_browser__write_graph(browser, fwd ? SLSMG_DARROW_CHAR : in annotate_browser__write()
183 ui_browser__write_graph(browser, SLSMG_RARROW_CHAR); in annotate_browser__write()
192 ui_browser__write_graph(browser, SLSMG_LARROW_CHAR); in annotate_browser__write()
215 static void annotate_browser__draw_current_jump(struct ui_browser *browser) in annotate_browser__draw_current_jump() argument
217 struct annotate_browser *ab = container_of(browser, struct annotate_browser, b); in annotate_browser__draw_current_jump()
249 ui_browser__set_color(browser, HE_COLORSET_CODE); in annotate_browser__draw_current_jump()
250 __ui_browser__line_arrow(browser, pcnt_width + 2 + ab->addr_width, in annotate_browser__draw_current_jump()
254 static unsigned int annotate_browser__refresh(struct ui_browser *browser) in annotate_browser__refresh() argument
256 struct annotate_browser *ab = container_of(browser, struct annotate_browser, b); in annotate_browser__refresh()
257 int ret = ui_browser__list_head_refresh(browser); in annotate_browser__refresh()
263 annotate_browser__draw_current_jump(browser); in annotate_browser__refresh()
265 ui_browser__set_color(browser, HE_COLORSET_NORMAL); in annotate_browser__refresh()
266 __ui_browser__vline(browser, pcnt_width, 0, browser->height - 1); in annotate_browser__refresh()
303 static void annotate_browser__set_top(struct annotate_browser *browser, in annotate_browser__set_top() argument
308 ui_browser__refresh_dimensions(&browser->b); in annotate_browser__set_top()
309 back = browser->b.height / 2; in annotate_browser__set_top()
310 browser->b.top_idx = browser->b.index = idx; in annotate_browser__set_top()
312 while (browser->b.top_idx != 0 && back != 0) { in annotate_browser__set_top()
315 if (disasm_line__filter(&browser->b, &pos->node)) in annotate_browser__set_top()
318 --browser->b.top_idx; in annotate_browser__set_top()
322 browser->b.top = pos; in annotate_browser__set_top()
323 browser->b.navkeypressed = true; in annotate_browser__set_top()
326 static void annotate_browser__set_rb_top(struct annotate_browser *browser, in annotate_browser__set_rb_top() argument
338 annotate_browser__set_top(browser, pos, idx); in annotate_browser__set_rb_top()
339 browser->curr_hot = nd; in annotate_browser__set_rb_top()
342 static void annotate_browser__calc_percent(struct annotate_browser *browser, in annotate_browser__calc_percent() argument
345 struct map_symbol *ms = browser->b.priv; in annotate_browser__calc_percent()
351 browser->entries = RB_ROOT; in annotate_browser__calc_percent()
368 for (i = 0; i < browser->nr_events; i++) { in annotate_browser__calc_percent()
383 disasm_rb_tree__insert(&browser->entries, bpos, in annotate_browser__calc_percent()
384 browser->nr_events); in annotate_browser__calc_percent()
388 browser->curr_hot = rb_last(&browser->entries); in annotate_browser__calc_percent()
391 static bool annotate_browser__toggle_source(struct annotate_browser *browser) in annotate_browser__toggle_source() argument
395 off_t offset = browser->b.index - browser->b.top_idx; in annotate_browser__toggle_source()
397 browser->b.seek(&browser->b, offset, SEEK_CUR); in annotate_browser__toggle_source()
398 dl = list_entry(browser->b.top, struct disasm_line, node); in annotate_browser__toggle_source()
405 browser->b.nr_entries = browser->nr_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 = bdl->idx - offset; in annotate_browser__toggle_source()
409 browser->b.index = bdl->idx; in annotate_browser__toggle_source()
413 browser->b.seek(&browser->b, -offset, SEEK_CUR); in annotate_browser__toggle_source()
420 browser->b.nr_entries = browser->nr_asm_entries; in annotate_browser__toggle_source()
422 browser->b.seek(&browser->b, -offset, SEEK_CUR); in annotate_browser__toggle_source()
423 browser->b.top_idx = bdl->idx_asm - offset; in annotate_browser__toggle_source()
424 browser->b.index = bdl->idx_asm; in annotate_browser__toggle_source()
430 static void annotate_browser__init_asm_mode(struct annotate_browser *browser) in annotate_browser__init_asm_mode() argument
432 ui_browser__reset_index(&browser->b); in annotate_browser__init_asm_mode()
433 browser->b.nr_entries = browser->nr_asm_entries; in annotate_browser__init_asm_mode()
444 static bool annotate_browser__callq(struct annotate_browser *browser, in annotate_browser__callq() argument
448 struct map_symbol *ms = browser->b.priv; in annotate_browser__callq()
449 struct disasm_line *dl = browser->selection; in annotate_browser__callq()
481 ui_browser__show_title(&browser->b, title); in annotate_browser__callq()
486 struct disasm_line *annotate_browser__find_offset(struct annotate_browser *browser, in annotate_browser__find_offset() argument
489 struct map_symbol *ms = browser->b.priv; in annotate_browser__find_offset()
498 if (!disasm_line__filter(&browser->b, &pos->node)) in annotate_browser__find_offset()
505 static bool annotate_browser__jump(struct annotate_browser *browser) in annotate_browser__jump() argument
507 struct disasm_line *dl = browser->selection; in annotate_browser__jump()
513 dl = annotate_browser__find_offset(browser, dl->ops.target.offset, &idx); in annotate_browser__jump()
519 annotate_browser__set_top(browser, dl, idx); in annotate_browser__jump()
525 struct disasm_line *annotate_browser__find_string(struct annotate_browser *browser, in annotate_browser__find_string() argument
528 struct map_symbol *ms = browser->b.priv; in annotate_browser__find_string()
531 struct disasm_line *pos = browser->selection; in annotate_browser__find_string()
533 *idx = browser->b.index; in annotate_browser__find_string()
535 if (disasm_line__filter(&browser->b, &pos->node)) in annotate_browser__find_string()
547 static bool __annotate_browser__search(struct annotate_browser *browser) in __annotate_browser__search() argument
552 dl = annotate_browser__find_string(browser, browser->search_bf, &idx); in __annotate_browser__search()
558 annotate_browser__set_top(browser, dl, idx); in __annotate_browser__search()
559 browser->searching_backwards = false; in __annotate_browser__search()
564 struct disasm_line *annotate_browser__find_string_reverse(struct annotate_browser *browser, in annotate_browser__find_string_reverse() argument
567 struct map_symbol *ms = browser->b.priv; in annotate_browser__find_string_reverse()
570 struct disasm_line *pos = browser->selection; in annotate_browser__find_string_reverse()
572 *idx = browser->b.index; in annotate_browser__find_string_reverse()
574 if (disasm_line__filter(&browser->b, &pos->node)) in annotate_browser__find_string_reverse()
586 static bool __annotate_browser__search_reverse(struct annotate_browser *browser) in __annotate_browser__search_reverse() argument
591 dl = annotate_browser__find_string_reverse(browser, browser->search_bf, &idx); in __annotate_browser__search_reverse()
597 annotate_browser__set_top(browser, dl, idx); in __annotate_browser__search_reverse()
598 browser->searching_backwards = true; in __annotate_browser__search_reverse()
602 static bool annotate_browser__search_window(struct annotate_browser *browser, in annotate_browser__search_window() argument
605 if (ui_browser__input_window("Search", "String: ", browser->search_bf, in annotate_browser__search_window()
608 !*browser->search_bf) in annotate_browser__search_window()
614 static bool annotate_browser__search(struct annotate_browser *browser, int delay_secs) in annotate_browser__search() argument
616 if (annotate_browser__search_window(browser, delay_secs)) in annotate_browser__search()
617 return __annotate_browser__search(browser); in annotate_browser__search()
622 static bool annotate_browser__continue_search(struct annotate_browser *browser, in annotate_browser__continue_search() argument
625 if (!*browser->search_bf) in annotate_browser__continue_search()
626 return annotate_browser__search(browser, delay_secs); in annotate_browser__continue_search()
628 return __annotate_browser__search(browser); in annotate_browser__continue_search()
631 static bool annotate_browser__search_reverse(struct annotate_browser *browser, in annotate_browser__search_reverse() argument
634 if (annotate_browser__search_window(browser, delay_secs)) in annotate_browser__search_reverse()
635 return __annotate_browser__search_reverse(browser); in annotate_browser__search_reverse()
641 bool annotate_browser__continue_search_reverse(struct annotate_browser *browser, in annotate_browser__continue_search_reverse() argument
644 if (!*browser->search_bf) in annotate_browser__continue_search_reverse()
645 return annotate_browser__search_reverse(browser, delay_secs); in annotate_browser__continue_search_reverse()
647 return __annotate_browser__search_reverse(browser); in annotate_browser__continue_search_reverse()
650 static void annotate_browser__update_addr_width(struct annotate_browser *browser) in annotate_browser__update_addr_width() argument
653 browser->target_width = browser->min_addr_width; in annotate_browser__update_addr_width()
655 browser->target_width = browser->max_addr_width; in annotate_browser__update_addr_width()
657 browser->addr_width = browser->target_width; in annotate_browser__update_addr_width()
660 browser->addr_width += browser->jumps_width + 1; in annotate_browser__update_addr_width()
663 static int annotate_browser__run(struct annotate_browser *browser, in annotate_browser__run() argument
668 struct map_symbol *ms = browser->b.priv; in annotate_browser__run()
676 if (ui_browser__show(&browser->b, title, help) < 0) in annotate_browser__run()
679 annotate_browser__calc_percent(browser, evsel); in annotate_browser__run()
681 if (browser->curr_hot) { in annotate_browser__run()
682 annotate_browser__set_rb_top(browser, browser->curr_hot); in annotate_browser__run()
683 browser->b.navkeypressed = false; in annotate_browser__run()
686 nd = browser->curr_hot; in annotate_browser__run()
689 key = ui_browser__run(&browser->b, delay_secs); in annotate_browser__run()
692 annotate_browser__calc_percent(browser, evsel); in annotate_browser__run()
714 nd = rb_last(&browser->entries); in annotate_browser__run()
716 nd = browser->curr_hot; in annotate_browser__run()
722 nd = rb_first(&browser->entries); in annotate_browser__run()
724 nd = browser->curr_hot; in annotate_browser__run()
728 ui_browser__help_window(&browser->b, in annotate_browser__run()
755 nd = browser->curr_hot; in annotate_browser__run()
758 if (annotate_browser__toggle_source(browser)) in annotate_browser__run()
763 annotate_browser__update_addr_width(browser); in annotate_browser__run()
770 annotate_browser__update_addr_width(browser); in annotate_browser__run()
773 if (annotate_browser__search(browser, delay_secs)) { in annotate_browser__run()
779 if (browser->searching_backwards ? in annotate_browser__run()
780 annotate_browser__continue_search_reverse(browser, delay_secs) : in annotate_browser__run()
781 annotate_browser__continue_search(browser, delay_secs)) in annotate_browser__run()
785 if (annotate_browser__search_reverse(browser, delay_secs)) in annotate_browser__run()
792 seq++, browser->b.nr_entries, in annotate_browser__run()
793 browser->b.height, in annotate_browser__run()
794 browser->b.index, in annotate_browser__run()
795 browser->b.top_idx, in annotate_browser__run()
796 browser->nr_asm_entries); in annotate_browser__run()
801 if (browser->selection == NULL) in annotate_browser__run()
803 else if (browser->selection->offset == -1) in annotate_browser__run()
805 else if (!browser->selection->ins) { in annotate_browser__run()
806 if (strcmp(browser->selection->name, "retq")) in annotate_browser__run()
809 } else if (!(annotate_browser__jump(browser) || in annotate_browser__run()
810 annotate_browser__callq(browser, evsel, hbt))) { in annotate_browser__run()
825 annotate_browser__set_rb_top(browser, nd); in annotate_browser__run()
828 ui_browser__hide(&browser->b); in annotate_browser__run()
844 static void annotate_browser__mark_jump_targets(struct annotate_browser *browser, in annotate_browser__mark_jump_targets() argument
848 struct map_symbol *ms = browser->b.priv; in annotate_browser__mark_jump_targets()
856 struct disasm_line *dl = browser->offsets[offset], *dlt; in annotate_browser__mark_jump_targets()
862 dlt = browser->offsets[dl->ops.target.offset]; in annotate_browser__mark_jump_targets()
871 if (++bdlt->jump_sources > browser->max_jump_sources) in annotate_browser__mark_jump_targets()
872 browser->max_jump_sources = bdlt->jump_sources; in annotate_browser__mark_jump_targets()
874 ++browser->nr_jumps; in annotate_browser__mark_jump_targets()
898 struct annotate_browser browser = { in symbol__tui_annotate() local
920 browser.offsets = zalloc(size * sizeof(struct disasm_line *)); in symbol__tui_annotate()
921 if (browser.offsets == NULL) { in symbol__tui_annotate()
939 browser.start = map__rip_2objdump(map, sym->start); in symbol__tui_annotate()
945 if (browser.b.width < line_len) in symbol__tui_annotate()
946 browser.b.width = line_len; in symbol__tui_annotate()
948 bpos->idx = browser.nr_entries++; in symbol__tui_annotate()
950 bpos->idx_asm = browser.nr_asm_entries++; in symbol__tui_annotate()
959 browser.offsets[pos->offset] = pos; in symbol__tui_annotate()
964 annotate_browser__mark_jump_targets(&browser, size); in symbol__tui_annotate()
966 browser.addr_width = browser.target_width = browser.min_addr_width = hex_width(size); in symbol__tui_annotate()
967 browser.max_addr_width = hex_width(sym->end); in symbol__tui_annotate()
968 browser.jumps_width = width_jumps(browser.max_jump_sources); in symbol__tui_annotate()
969 browser.nr_events = nr_pcnt; in symbol__tui_annotate()
970 browser.b.nr_entries = browser.nr_entries; in symbol__tui_annotate()
971 browser.b.entries = &notes->src->source, in symbol__tui_annotate()
972 browser.b.width += 18; /* Percentage */ in symbol__tui_annotate()
975 annotate_browser__init_asm_mode(&browser); in symbol__tui_annotate()
977 annotate_browser__update_addr_width(&browser); in symbol__tui_annotate()
979 ret = annotate_browser__run(&browser, evsel, hbt); in symbol__tui_annotate()
986 free(browser.offsets); in symbol__tui_annotate()