Lines Matching refs:browser

34 static inline struct annotation *browser__annotation(struct ui_browser *browser)  in browser__annotation()  argument
36 struct map_symbol *ms = browser->priv; in browser__annotation()
40 static bool disasm_line__filter(struct ui_browser *browser __maybe_unused, void *entry) in disasm_line__filter()
46 static int ui_browser__jumps_percent_color(struct ui_browser *browser, int nr, bool current) in ui_browser__jumps_percent_color() argument
48 struct annotation *notes = browser__annotation(browser); in ui_browser__jumps_percent_color()
50 if (current && (!browser->use_navkeypressed || browser->navkeypressed)) in ui_browser__jumps_percent_color()
59 static int ui_browser__set_jumps_percent_color(void *browser, int nr, bool current) in ui_browser__set_jumps_percent_color() argument
61 int color = ui_browser__jumps_percent_color(browser, nr, current); in ui_browser__set_jumps_percent_color()
62 return ui_browser__set_color(browser, color); in ui_browser__set_jumps_percent_color()
65 static int annotate_browser__set_color(void *browser, int color) in annotate_browser__set_color() argument
67 return ui_browser__set_color(browser, color); in annotate_browser__set_color()
70 static void annotate_browser__write_graph(void *browser, int graph) in annotate_browser__write_graph() argument
72 ui_browser__write_graph(browser, graph); in annotate_browser__write_graph()
75 static void annotate_browser__set_percent_color(void *browser, double percent, bool current) in annotate_browser__set_percent_color() argument
77 ui_browser__set_percent_color(browser, percent, current); in annotate_browser__set_percent_color()
80 static void annotate_browser__printf(void *browser, const char *fmt, ...) in annotate_browser__printf() argument
85 ui_browser__vprintf(browser, fmt, args); in annotate_browser__printf()
89 static void annotate_browser__write(struct ui_browser *browser, void *entry, int row) in annotate_browser__write() argument
91 struct annotate_browser *ab = container_of(browser, struct annotate_browser, b); in annotate_browser__write()
92 struct annotation *notes = browser__annotation(browser); in annotate_browser__write()
94 const bool is_current_entry = ui_browser__is_current_entry(browser, row); in annotate_browser__write()
100 (browser->use_navkeypressed && in annotate_browser__write()
101 !browser->navkeypressed))), in annotate_browser__write()
102 .width = browser->width, in annotate_browser__write()
103 .obj = browser, in annotate_browser__write()
112 if (!browser->navkeypressed) in annotate_browser__write()
149 static void annotate_browser__draw_current_jump(struct ui_browser *browser) in annotate_browser__draw_current_jump() argument
151 struct annotate_browser *ab = container_of(browser, struct annotate_browser, b); in annotate_browser__draw_current_jump()
207 ui_browser__set_color(browser, HE_COLORSET_JUMP_ARROWS); in annotate_browser__draw_current_jump()
208 __ui_browser__line_arrow(browser, in annotate_browser__draw_current_jump()
214 ui_browser__mark_fused(browser, in annotate_browser__draw_current_jump()
220 static unsigned int annotate_browser__refresh(struct ui_browser *browser) in annotate_browser__refresh() argument
222 struct annotation *notes = browser__annotation(browser); in annotate_browser__refresh()
223 int ret = ui_browser__list_head_refresh(browser); in annotate_browser__refresh()
227 annotate_browser__draw_current_jump(browser); in annotate_browser__refresh()
229 ui_browser__set_color(browser, HE_COLORSET_NORMAL); in annotate_browser__refresh()
230 __ui_browser__vline(browser, pcnt_width, 0, browser->rows - 1); in annotate_browser__refresh()
248 static void disasm_rb_tree__insert(struct annotate_browser *browser, in disasm_rb_tree__insert() argument
251 struct rb_root *root = &browser->entries; in disasm_rb_tree__insert()
269 static void annotate_browser__set_top(struct annotate_browser *browser, in annotate_browser__set_top() argument
274 ui_browser__refresh_dimensions(&browser->b); in annotate_browser__set_top()
275 back = browser->b.height / 2; in annotate_browser__set_top()
276 browser->b.top_idx = browser->b.index = idx; in annotate_browser__set_top()
278 while (browser->b.top_idx != 0 && back != 0) { in annotate_browser__set_top()
284 --browser->b.top_idx; in annotate_browser__set_top()
288 browser->b.top = pos; in annotate_browser__set_top()
289 browser->b.navkeypressed = true; in annotate_browser__set_top()
292 static void annotate_browser__set_rb_top(struct annotate_browser *browser, in annotate_browser__set_rb_top() argument
300 annotate_browser__set_top(browser, pos, idx); in annotate_browser__set_rb_top()
301 browser->curr_hot = nd; in annotate_browser__set_rb_top()
304 static void annotate_browser__calc_percent(struct annotate_browser *browser, in annotate_browser__calc_percent() argument
307 struct map_symbol *ms = browser->b.priv; in annotate_browser__calc_percent()
312 browser->entries = RB_ROOT; in annotate_browser__calc_percent()
341 disasm_rb_tree__insert(browser, &pos->al); in annotate_browser__calc_percent()
345 browser->curr_hot = rb_last(&browser->entries); in annotate_browser__calc_percent()
349 struct annotate_browser *browser, in annotate_browser__find_next_asm_line() argument
355 list_for_each_entry_continue(it, browser->b.entries, node) { in annotate_browser__find_next_asm_line()
362 list_for_each_entry_continue_reverse(it, browser->b.entries, node) { in annotate_browser__find_next_asm_line()
371 static bool annotate_browser__toggle_source(struct annotate_browser *browser) in annotate_browser__toggle_source() argument
373 struct annotation *notes = browser__annotation(&browser->b); in annotate_browser__toggle_source()
375 off_t offset = browser->b.index - browser->b.top_idx; in annotate_browser__toggle_source()
377 browser->b.seek(&browser->b, offset, SEEK_CUR); in annotate_browser__toggle_source()
378 al = list_entry(browser->b.top, struct annotation_line, node); in annotate_browser__toggle_source()
384 browser->b.nr_entries = notes->src->nr_entries; in annotate_browser__toggle_source()
386 browser->b.seek(&browser->b, -offset, SEEK_CUR); in annotate_browser__toggle_source()
387 browser->b.top_idx = al->idx - offset; in annotate_browser__toggle_source()
388 browser->b.index = al->idx; in annotate_browser__toggle_source()
392 al = annotate_browser__find_next_asm_line(browser, al); in annotate_browser__toggle_source()
394 browser->b.seek(&browser->b, -offset, SEEK_CUR); in annotate_browser__toggle_source()
402 browser->b.nr_entries = notes->src->nr_asm_entries; in annotate_browser__toggle_source()
404 browser->b.seek(&browser->b, -offset, SEEK_CUR); in annotate_browser__toggle_source()
405 browser->b.top_idx = al->idx_asm - offset; in annotate_browser__toggle_source()
406 browser->b.index = al->idx_asm; in annotate_browser__toggle_source()
414 static void annotate_browser__show_full_location(struct ui_browser *browser) in annotate_browser__show_full_location() argument
416 struct annotate_browser *ab = container_of(browser, struct annotate_browser, b); in annotate_browser__show_full_location()
431 static void ui_browser__init_asm_mode(struct ui_browser *browser) in ui_browser__init_asm_mode() argument
433 struct annotation *notes = browser__annotation(browser); in ui_browser__init_asm_mode()
434 ui_browser__reset_index(browser); in ui_browser__init_asm_mode()
435 browser->nr_entries = notes->src->nr_asm_entries; in ui_browser__init_asm_mode()
455 static bool annotate_browser__callq(struct annotate_browser *browser, in annotate_browser__callq() argument
459 struct map_symbol *ms = browser->b.priv, target_ms; in annotate_browser__callq()
460 struct disasm_line *dl = disasm_line(browser->selection); in annotate_browser__callq()
485 ui_browser__show_title(&browser->b, title); in annotate_browser__callq()
490 struct disasm_line *annotate_browser__find_offset(struct annotate_browser *browser, in annotate_browser__find_offset() argument
493 struct annotation *notes = browser__annotation(&browser->b); in annotate_browser__find_offset()
507 static bool annotate_browser__jump(struct annotate_browser *browser, in annotate_browser__jump() argument
511 struct disasm_line *dl = disasm_line(browser->selection); in annotate_browser__jump()
519 annotate_browser__callq(browser, evsel, hbt); in annotate_browser__jump()
524 dl = annotate_browser__find_offset(browser, offset, &idx); in annotate_browser__jump()
530 annotate_browser__set_top(browser, &dl->al, idx); in annotate_browser__jump()
536 struct annotation_line *annotate_browser__find_string(struct annotate_browser *browser, in annotate_browser__find_string() argument
539 struct annotation *notes = browser__annotation(&browser->b); in annotate_browser__find_string()
540 struct annotation_line *al = browser->selection; in annotate_browser__find_string()
542 *idx = browser->b.index; in annotate_browser__find_string()
556 static bool __annotate_browser__search(struct annotate_browser *browser) in __annotate_browser__search() argument
561 al = annotate_browser__find_string(browser, browser->search_bf, &idx); in __annotate_browser__search()
567 annotate_browser__set_top(browser, al, idx); in __annotate_browser__search()
568 browser->searching_backwards = false; in __annotate_browser__search()
573 struct annotation_line *annotate_browser__find_string_reverse(struct annotate_browser *browser, in annotate_browser__find_string_reverse() argument
576 struct annotation *notes = browser__annotation(&browser->b); in annotate_browser__find_string_reverse()
577 struct annotation_line *al = browser->selection; in annotate_browser__find_string_reverse()
579 *idx = browser->b.index; in annotate_browser__find_string_reverse()
593 static bool __annotate_browser__search_reverse(struct annotate_browser *browser) in __annotate_browser__search_reverse() argument
598 al = annotate_browser__find_string_reverse(browser, browser->search_bf, &idx); in __annotate_browser__search_reverse()
604 annotate_browser__set_top(browser, al, idx); in __annotate_browser__search_reverse()
605 browser->searching_backwards = true; in __annotate_browser__search_reverse()
609 static bool annotate_browser__search_window(struct annotate_browser *browser, in annotate_browser__search_window() argument
612 if (ui_browser__input_window("Search", "String: ", browser->search_bf, in annotate_browser__search_window()
615 !*browser->search_bf) in annotate_browser__search_window()
621 static bool annotate_browser__search(struct annotate_browser *browser, int delay_secs) in annotate_browser__search() argument
623 if (annotate_browser__search_window(browser, delay_secs)) in annotate_browser__search()
624 return __annotate_browser__search(browser); in annotate_browser__search()
629 static bool annotate_browser__continue_search(struct annotate_browser *browser, in annotate_browser__continue_search() argument
632 if (!*browser->search_bf) in annotate_browser__continue_search()
633 return annotate_browser__search(browser, delay_secs); in annotate_browser__continue_search()
635 return __annotate_browser__search(browser); in annotate_browser__continue_search()
638 static bool annotate_browser__search_reverse(struct annotate_browser *browser, in annotate_browser__search_reverse() argument
641 if (annotate_browser__search_window(browser, delay_secs)) in annotate_browser__search_reverse()
642 return __annotate_browser__search_reverse(browser); in annotate_browser__search_reverse()
648 bool annotate_browser__continue_search_reverse(struct annotate_browser *browser, in annotate_browser__continue_search_reverse() argument
651 if (!*browser->search_bf) in annotate_browser__continue_search_reverse()
652 return annotate_browser__search_reverse(browser, delay_secs); in annotate_browser__continue_search_reverse()
654 return __annotate_browser__search_reverse(browser); in annotate_browser__continue_search_reverse()
657 static int annotate_browser__show(struct ui_browser *browser, char *title, const char *help) in annotate_browser__show() argument
659 struct map_symbol *ms = browser->priv; in annotate_browser__show()
663 if (ui_browser__show(browser, title, help) < 0) in annotate_browser__show()
668 ui_browser__gotorc_title(browser, 0, 0); in annotate_browser__show()
669 ui_browser__set_color(browser, HE_COLORSET_ROOT); in annotate_browser__show()
670 ui_browser__write_nstring(browser, symbol_dso, browser->width + 1); in annotate_browser__show()
707 static int annotate_browser__run(struct annotate_browser *browser, in annotate_browser__run() argument
713 struct map_symbol *ms = browser->b.priv; in annotate_browser__run()
723 if (annotate_browser__show(&browser->b, title, help) < 0) in annotate_browser__run()
726 annotate_browser__calc_percent(browser, evsel); in annotate_browser__run()
728 if (browser->curr_hot) { in annotate_browser__run()
729 annotate_browser__set_rb_top(browser, browser->curr_hot); in annotate_browser__run()
730 browser->b.navkeypressed = false; in annotate_browser__run()
733 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()
809 annotate_browser__show(&browser->b, title, help); in annotate_browser__run()
815 annotate_browser__show_full_location (&browser->b); in annotate_browser__run()
818 nd = browser->curr_hot; in annotate_browser__run()
821 if (annotate_browser__toggle_source(browser)) in annotate_browser__run()
840 if (annotate_browser__search(browser, delay_secs)) { in annotate_browser__run()
846 if (browser->searching_backwards ? in annotate_browser__run()
847 annotate_browser__continue_search_reverse(browser, delay_secs) : in annotate_browser__run()
848 annotate_browser__continue_search(browser, delay_secs)) in annotate_browser__run()
852 if (annotate_browser__search_reverse(browser, delay_secs)) in annotate_browser__run()
859 seq++, browser->b.nr_entries, in annotate_browser__run()
860 browser->b.height, in annotate_browser__run()
861 browser->b.index, in annotate_browser__run()
862 browser->b.top_idx, in annotate_browser__run()
869 struct disasm_line *dl = disasm_line(browser->selection); in annotate_browser__run()
871 if (browser->selection == NULL) in annotate_browser__run()
873 else if (browser->selection->offset == -1) in annotate_browser__run()
879 else if (!(annotate_browser__jump(browser, evsel, hbt) || in annotate_browser__run()
880 annotate_browser__callq(browser, evsel, hbt))) { in annotate_browser__run()
910 annotate_browser__show(&browser->b, title, help); in annotate_browser__run()
914 ui_browser__help_window(&browser->b, br_cntr_text); in annotate_browser__run()
916 ui_browser__help_window(&browser->b, in annotate_browser__run()
935 annotate_browser__set_rb_top(browser, nd); in annotate_browser__run()
938 ui_browser__hide(&browser->b); in annotate_browser__run()
965 struct annotate_browser browser = { in symbol__tui_annotate() local
988 err = symbol__annotate2(ms, evsel, &browser.arch); in symbol__tui_annotate()
1000 browser.b.width = notes->src->widths.max_line_len; in symbol__tui_annotate()
1001 browser.b.nr_entries = notes->src->nr_entries; in symbol__tui_annotate()
1002 browser.b.entries = &notes->src->source; in symbol__tui_annotate()
1003 browser.b.width += 18; /* Percentage */ in symbol__tui_annotate()
1006 ui_browser__init_asm_mode(&browser.b); in symbol__tui_annotate()
1008 ret = annotate_browser__run(&browser, evsel, hbt); in symbol__tui_annotate()