annotate.c (27eb2c4b3d3e13f376a359e293c212a2e9407af5) annotate.c (34f77abcb34e1da4ee3ca5c5a41b673664eee1fa)
1#include "../../util/util.h"
2#include "../browser.h"
3#include "../helpline.h"
4#include "../libslang.h"
5#include "../ui.h"
6#include "../util.h"
7#include "../../util/annotate.h"
8#include "../../util/hist.h"

--- 414 unchanged lines hidden (view full) ---

423}
424
425static void annotate_browser__init_asm_mode(struct annotate_browser *browser)
426{
427 ui_browser__reset_index(&browser->b);
428 browser->b.nr_entries = browser->nr_asm_entries;
429}
430
1#include "../../util/util.h"
2#include "../browser.h"
3#include "../helpline.h"
4#include "../libslang.h"
5#include "../ui.h"
6#include "../util.h"
7#include "../../util/annotate.h"
8#include "../../util/hist.h"

--- 414 unchanged lines hidden (view full) ---

423}
424
425static void annotate_browser__init_asm_mode(struct annotate_browser *browser)
426{
427 ui_browser__reset_index(&browser->b);
428 browser->b.nr_entries = browser->nr_asm_entries;
429}
430
431#define SYM_TITLE_MAX_SIZE (PATH_MAX + 64)
432
433static int sym_title(struct symbol *sym, struct map *map, char *title,
434 size_t sz)
435{
436 return snprintf(title, sz, "%s %s", sym->name, map->dso->long_name);
437}
438
431static bool annotate_browser__callq(struct annotate_browser *browser,
432 struct perf_evsel *evsel,
433 struct hist_browser_timer *hbt)
434{
435 struct map_symbol *ms = browser->b.priv;
436 struct disasm_line *dl = browser->selection;
437 struct symbol *sym = ms->sym;
438 struct annotation *notes;
439 struct symbol *target;
440 u64 ip;
439static bool annotate_browser__callq(struct annotate_browser *browser,
440 struct perf_evsel *evsel,
441 struct hist_browser_timer *hbt)
442{
443 struct map_symbol *ms = browser->b.priv;
444 struct disasm_line *dl = browser->selection;
445 struct symbol *sym = ms->sym;
446 struct annotation *notes;
447 struct symbol *target;
448 u64 ip;
449 char title[SYM_TITLE_MAX_SIZE];
441
442 if (!ins__is_call(dl->ins))
443 return false;
444
445 ip = ms->map->map_ip(ms->map, dl->ops.target.addr);
446 target = map__find_symbol(ms->map, ip, NULL);
447 if (target == NULL) {
448 ui_helpline__puts("The called function was not found.");

--- 7 unchanged lines hidden (view full) ---

456 pthread_mutex_unlock(&notes->lock);
457 ui__warning("Not enough memory for annotating '%s' symbol!\n",
458 target->name);
459 return true;
460 }
461
462 pthread_mutex_unlock(&notes->lock);
463 symbol__tui_annotate(target, ms->map, evsel, hbt);
450
451 if (!ins__is_call(dl->ins))
452 return false;
453
454 ip = ms->map->map_ip(ms->map, dl->ops.target.addr);
455 target = map__find_symbol(ms->map, ip, NULL);
456 if (target == NULL) {
457 ui_helpline__puts("The called function was not found.");

--- 7 unchanged lines hidden (view full) ---

465 pthread_mutex_unlock(&notes->lock);
466 ui__warning("Not enough memory for annotating '%s' symbol!\n",
467 target->name);
468 return true;
469 }
470
471 pthread_mutex_unlock(&notes->lock);
472 symbol__tui_annotate(target, ms->map, evsel, hbt);
464 ui_browser__show_title(&browser->b, sym->name);
473 sym_title(sym, ms->map, title, sizeof(title));
474 ui_browser__show_title(&browser->b, title);
465 return true;
466}
467
468static
469struct disasm_line *annotate_browser__find_offset(struct annotate_browser *browser,
470 s64 offset, s64 *idx)
471{
472 struct map_symbol *ms = browser->b.priv;

--- 175 unchanged lines hidden (view full) ---

648 struct hist_browser_timer *hbt)
649{
650 struct rb_node *nd = NULL;
651 struct map_symbol *ms = browser->b.priv;
652 struct symbol *sym = ms->sym;
653 const char *help = "Press 'h' for help on key bindings";
654 int delay_secs = hbt ? hbt->refresh : 0;
655 int key;
475 return true;
476}
477
478static
479struct disasm_line *annotate_browser__find_offset(struct annotate_browser *browser,
480 s64 offset, s64 *idx)
481{
482 struct map_symbol *ms = browser->b.priv;

--- 175 unchanged lines hidden (view full) ---

658 struct hist_browser_timer *hbt)
659{
660 struct rb_node *nd = NULL;
661 struct map_symbol *ms = browser->b.priv;
662 struct symbol *sym = ms->sym;
663 const char *help = "Press 'h' for help on key bindings";
664 int delay_secs = hbt ? hbt->refresh : 0;
665 int key;
666 char title[SYM_TITLE_MAX_SIZE];
656
667
657 if (ui_browser__show(&browser->b, sym->name, help) < 0)
668 sym_title(sym, ms->map, title, sizeof(title));
669 if (ui_browser__show(&browser->b, title, help) < 0)
658 return -1;
659
660 annotate_browser__calc_percent(browser, evsel);
661
662 if (browser->curr_hot) {
663 annotate_browser__set_rb_top(browser, browser->curr_hot);
664 browser->b.navkeypressed = false;
665 }

--- 344 unchanged lines hidden ---
670 return -1;
671
672 annotate_browser__calc_percent(browser, evsel);
673
674 if (browser->curr_hot) {
675 annotate_browser__set_rb_top(browser, browser->curr_hot);
676 browser->b.navkeypressed = false;
677 }

--- 344 unchanged lines hidden ---