annotate.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714
  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"
  9. #include "../../util/sort.h"
  10. #include "../../util/symbol.h"
  11. #include <pthread.h>
  12. #include <newt.h>
  13. struct browser_disasm_line {
  14. struct rb_node rb_node;
  15. double percent;
  16. u32 idx;
  17. int idx_asm;
  18. bool jump_target;
  19. };
  20. struct annotate_browser {
  21. struct ui_browser b;
  22. struct rb_root entries;
  23. struct rb_node *curr_hot;
  24. struct disasm_line *selection;
  25. struct disasm_line **offsets;
  26. u64 start;
  27. int nr_asm_entries;
  28. int nr_entries;
  29. bool hide_src_code;
  30. bool use_offset;
  31. bool searching_backwards;
  32. u8 offset_width;
  33. char search_bf[128];
  34. };
  35. static inline struct browser_disasm_line *disasm_line__browser(struct disasm_line *dl)
  36. {
  37. return (struct browser_disasm_line *)(dl + 1);
  38. }
  39. static bool disasm_line__filter(struct ui_browser *browser, void *entry)
  40. {
  41. struct annotate_browser *ab = container_of(browser, struct annotate_browser, b);
  42. if (ab->hide_src_code) {
  43. struct disasm_line *dl = list_entry(entry, struct disasm_line, node);
  44. return dl->offset == -1;
  45. }
  46. return false;
  47. }
  48. static void annotate_browser__write(struct ui_browser *self, void *entry, int row)
  49. {
  50. struct annotate_browser *ab = container_of(self, struct annotate_browser, b);
  51. struct disasm_line *dl = list_entry(entry, struct disasm_line, node);
  52. struct browser_disasm_line *bdl = disasm_line__browser(dl);
  53. bool current_entry = ui_browser__is_current_entry(self, row);
  54. bool change_color = (!ab->hide_src_code &&
  55. (!current_entry || (self->use_navkeypressed &&
  56. !self->navkeypressed)));
  57. int width = self->width;
  58. if (dl->offset != -1) {
  59. ui_browser__set_percent_color(self, bdl->percent, current_entry);
  60. slsmg_printf(" %7.2f ", bdl->percent);
  61. } else {
  62. ui_browser__set_percent_color(self, 0, current_entry);
  63. slsmg_write_nstring(" ", 9);
  64. }
  65. SLsmg_set_char_set(1);
  66. SLsmg_write_char(SLSMG_VLINE_CHAR);
  67. SLsmg_set_char_set(0);
  68. SLsmg_write_char(' ');
  69. /* The scroll bar isn't being used */
  70. if (!self->navkeypressed)
  71. width += 1;
  72. if (dl->offset != -1 && change_color)
  73. ui_browser__set_color(self, HE_COLORSET_CODE);
  74. if (!*dl->line)
  75. slsmg_write_nstring(" ", width - 10);
  76. else if (dl->offset == -1)
  77. slsmg_write_nstring(dl->line, width - 10);
  78. else {
  79. char bf[256];
  80. u64 addr = dl->offset;
  81. int printed, color = -1;
  82. if (!ab->use_offset)
  83. addr += ab->start;
  84. if (!ab->use_offset) {
  85. printed = scnprintf(bf, sizeof(bf), "%" PRIx64 ":", addr);
  86. } else {
  87. if (bdl->jump_target) {
  88. printed = scnprintf(bf, sizeof(bf), "%*" PRIx64 ":",
  89. ab->offset_width, addr);
  90. } else {
  91. printed = scnprintf(bf, sizeof(bf), "%*s ",
  92. ab->offset_width, " ");
  93. }
  94. }
  95. if (change_color)
  96. color = ui_browser__set_color(self, HE_COLORSET_ADDR);
  97. slsmg_write_nstring(bf, printed);
  98. if (change_color)
  99. ui_browser__set_color(self, color);
  100. if (dl->ins && dl->ins->ops->scnprintf) {
  101. dl->ins->ops->scnprintf(dl->ins, bf, sizeof(bf),
  102. !ab->use_offset ? dl->operands : NULL,
  103. dl->target);
  104. slsmg_write_nstring(" ", 2);
  105. printed += 2;
  106. } else
  107. scnprintf(bf, sizeof(bf), " %-6.6s %s", dl->name, dl->operands);
  108. slsmg_write_nstring(bf, width - 10 - printed);
  109. }
  110. if (current_entry)
  111. ab->selection = dl;
  112. }
  113. static double disasm_line__calc_percent(struct disasm_line *dl, struct symbol *sym, int evidx)
  114. {
  115. double percent = 0.0;
  116. if (dl->offset != -1) {
  117. int len = sym->end - sym->start;
  118. unsigned int hits = 0;
  119. struct annotation *notes = symbol__annotation(sym);
  120. struct source_line *src_line = notes->src->lines;
  121. struct sym_hist *h = annotation__histogram(notes, evidx);
  122. s64 offset = dl->offset;
  123. struct disasm_line *next;
  124. next = disasm__get_next_ip_line(&notes->src->source, dl);
  125. while (offset < (s64)len &&
  126. (next == NULL || offset < next->offset)) {
  127. if (src_line) {
  128. percent += src_line[offset].percent;
  129. } else
  130. hits += h->addr[offset];
  131. ++offset;
  132. }
  133. /*
  134. * If the percentage wasn't already calculated in
  135. * symbol__get_source_line, do it now:
  136. */
  137. if (src_line == NULL && h->sum)
  138. percent = 100.0 * hits / h->sum;
  139. }
  140. return percent;
  141. }
  142. static void disasm_rb_tree__insert(struct rb_root *root, struct browser_disasm_line *bdl)
  143. {
  144. struct rb_node **p = &root->rb_node;
  145. struct rb_node *parent = NULL;
  146. struct browser_disasm_line *l;
  147. while (*p != NULL) {
  148. parent = *p;
  149. l = rb_entry(parent, struct browser_disasm_line, rb_node);
  150. if (bdl->percent < l->percent)
  151. p = &(*p)->rb_left;
  152. else
  153. p = &(*p)->rb_right;
  154. }
  155. rb_link_node(&bdl->rb_node, parent, p);
  156. rb_insert_color(&bdl->rb_node, root);
  157. }
  158. static void annotate_browser__set_top(struct annotate_browser *self,
  159. struct disasm_line *pos, u32 idx)
  160. {
  161. unsigned back;
  162. ui_browser__refresh_dimensions(&self->b);
  163. back = self->b.height / 2;
  164. self->b.top_idx = self->b.index = idx;
  165. while (self->b.top_idx != 0 && back != 0) {
  166. pos = list_entry(pos->node.prev, struct disasm_line, node);
  167. if (disasm_line__filter(&self->b, &pos->node))
  168. continue;
  169. --self->b.top_idx;
  170. --back;
  171. }
  172. self->b.top = pos;
  173. self->b.navkeypressed = true;
  174. }
  175. static void annotate_browser__set_rb_top(struct annotate_browser *browser,
  176. struct rb_node *nd)
  177. {
  178. struct browser_disasm_line *bpos;
  179. struct disasm_line *pos;
  180. bpos = rb_entry(nd, struct browser_disasm_line, rb_node);
  181. pos = ((struct disasm_line *)bpos) - 1;
  182. annotate_browser__set_top(browser, pos, bpos->idx);
  183. browser->curr_hot = nd;
  184. }
  185. static void annotate_browser__calc_percent(struct annotate_browser *browser,
  186. int evidx)
  187. {
  188. struct map_symbol *ms = browser->b.priv;
  189. struct symbol *sym = ms->sym;
  190. struct annotation *notes = symbol__annotation(sym);
  191. struct disasm_line *pos;
  192. browser->entries = RB_ROOT;
  193. pthread_mutex_lock(&notes->lock);
  194. list_for_each_entry(pos, &notes->src->source, node) {
  195. struct browser_disasm_line *bpos = disasm_line__browser(pos);
  196. bpos->percent = disasm_line__calc_percent(pos, sym, evidx);
  197. if (bpos->percent < 0.01) {
  198. RB_CLEAR_NODE(&bpos->rb_node);
  199. continue;
  200. }
  201. disasm_rb_tree__insert(&browser->entries, bpos);
  202. }
  203. pthread_mutex_unlock(&notes->lock);
  204. browser->curr_hot = rb_last(&browser->entries);
  205. }
  206. static bool annotate_browser__toggle_source(struct annotate_browser *browser)
  207. {
  208. struct disasm_line *dl;
  209. struct browser_disasm_line *bdl;
  210. off_t offset = browser->b.index - browser->b.top_idx;
  211. browser->b.seek(&browser->b, offset, SEEK_CUR);
  212. dl = list_entry(browser->b.top, struct disasm_line, node);
  213. bdl = disasm_line__browser(dl);
  214. if (browser->hide_src_code) {
  215. if (bdl->idx_asm < offset)
  216. offset = bdl->idx;
  217. browser->b.nr_entries = browser->nr_entries;
  218. browser->hide_src_code = false;
  219. browser->b.seek(&browser->b, -offset, SEEK_CUR);
  220. browser->b.top_idx = bdl->idx - offset;
  221. browser->b.index = bdl->idx;
  222. } else {
  223. if (bdl->idx_asm < 0) {
  224. ui_helpline__puts("Only available for assembly lines.");
  225. browser->b.seek(&browser->b, -offset, SEEK_CUR);
  226. return false;
  227. }
  228. if (bdl->idx_asm < offset)
  229. offset = bdl->idx_asm;
  230. browser->b.nr_entries = browser->nr_asm_entries;
  231. browser->hide_src_code = true;
  232. browser->b.seek(&browser->b, -offset, SEEK_CUR);
  233. browser->b.top_idx = bdl->idx_asm - offset;
  234. browser->b.index = bdl->idx_asm;
  235. }
  236. return true;
  237. }
  238. static bool annotate_browser__callq(struct annotate_browser *browser,
  239. int evidx, void (*timer)(void *arg),
  240. void *arg, int delay_secs)
  241. {
  242. struct map_symbol *ms = browser->b.priv;
  243. struct disasm_line *dl = browser->selection;
  244. struct symbol *sym = ms->sym;
  245. struct annotation *notes;
  246. struct symbol *target;
  247. u64 ip;
  248. if (!ins__is_call(dl->ins))
  249. return false;
  250. ip = ms->map->map_ip(ms->map, dl->target);
  251. target = map__find_symbol(ms->map, ip, NULL);
  252. if (target == NULL) {
  253. ui_helpline__puts("The called function was not found.");
  254. return true;
  255. }
  256. notes = symbol__annotation(target);
  257. pthread_mutex_lock(&notes->lock);
  258. if (notes->src == NULL && symbol__alloc_hist(target) < 0) {
  259. pthread_mutex_unlock(&notes->lock);
  260. ui__warning("Not enough memory for annotating '%s' symbol!\n",
  261. target->name);
  262. return true;
  263. }
  264. pthread_mutex_unlock(&notes->lock);
  265. symbol__tui_annotate(target, ms->map, evidx, timer, arg, delay_secs);
  266. ui_browser__show_title(&browser->b, sym->name);
  267. return true;
  268. }
  269. static
  270. struct disasm_line *annotate_browser__find_offset(struct annotate_browser *browser,
  271. s64 offset, s64 *idx)
  272. {
  273. struct map_symbol *ms = browser->b.priv;
  274. struct symbol *sym = ms->sym;
  275. struct annotation *notes = symbol__annotation(sym);
  276. struct disasm_line *pos;
  277. *idx = 0;
  278. list_for_each_entry(pos, &notes->src->source, node) {
  279. if (pos->offset == offset)
  280. return pos;
  281. if (!disasm_line__filter(&browser->b, &pos->node))
  282. ++*idx;
  283. }
  284. return NULL;
  285. }
  286. static bool annotate_browser__jump(struct annotate_browser *browser)
  287. {
  288. struct disasm_line *dl = browser->selection;
  289. s64 idx;
  290. if (!ins__is_jump(dl->ins))
  291. return false;
  292. dl = annotate_browser__find_offset(browser, dl->target, &idx);
  293. if (dl == NULL) {
  294. ui_helpline__puts("Invallid jump offset");
  295. return true;
  296. }
  297. annotate_browser__set_top(browser, dl, idx);
  298. return true;
  299. }
  300. static
  301. struct disasm_line *annotate_browser__find_string(struct annotate_browser *browser,
  302. char *s, s64 *idx)
  303. {
  304. struct map_symbol *ms = browser->b.priv;
  305. struct symbol *sym = ms->sym;
  306. struct annotation *notes = symbol__annotation(sym);
  307. struct disasm_line *pos = browser->selection;
  308. *idx = browser->b.index;
  309. list_for_each_entry_continue(pos, &notes->src->source, node) {
  310. if (disasm_line__filter(&browser->b, &pos->node))
  311. continue;
  312. ++*idx;
  313. if (pos->line && strstr(pos->line, s) != NULL)
  314. return pos;
  315. }
  316. return NULL;
  317. }
  318. static bool __annotate_browser__search(struct annotate_browser *browser)
  319. {
  320. struct disasm_line *dl;
  321. s64 idx;
  322. dl = annotate_browser__find_string(browser, browser->search_bf, &idx);
  323. if (dl == NULL) {
  324. ui_helpline__puts("String not found!");
  325. return false;
  326. }
  327. annotate_browser__set_top(browser, dl, idx);
  328. browser->searching_backwards = false;
  329. return true;
  330. }
  331. static
  332. struct disasm_line *annotate_browser__find_string_reverse(struct annotate_browser *browser,
  333. char *s, s64 *idx)
  334. {
  335. struct map_symbol *ms = browser->b.priv;
  336. struct symbol *sym = ms->sym;
  337. struct annotation *notes = symbol__annotation(sym);
  338. struct disasm_line *pos = browser->selection;
  339. *idx = browser->b.index;
  340. list_for_each_entry_continue_reverse(pos, &notes->src->source, node) {
  341. if (disasm_line__filter(&browser->b, &pos->node))
  342. continue;
  343. --*idx;
  344. if (pos->line && strstr(pos->line, s) != NULL)
  345. return pos;
  346. }
  347. return NULL;
  348. }
  349. static bool __annotate_browser__search_reverse(struct annotate_browser *browser)
  350. {
  351. struct disasm_line *dl;
  352. s64 idx;
  353. dl = annotate_browser__find_string_reverse(browser, browser->search_bf, &idx);
  354. if (dl == NULL) {
  355. ui_helpline__puts("String not found!");
  356. return false;
  357. }
  358. annotate_browser__set_top(browser, dl, idx);
  359. browser->searching_backwards = true;
  360. return true;
  361. }
  362. static bool annotate_browser__search_window(struct annotate_browser *browser,
  363. int delay_secs)
  364. {
  365. if (ui_browser__input_window("Search", "String: ", browser->search_bf,
  366. "ENTER: OK, ESC: Cancel",
  367. delay_secs * 2) != K_ENTER ||
  368. !*browser->search_bf)
  369. return false;
  370. return true;
  371. }
  372. static bool annotate_browser__search(struct annotate_browser *browser, int delay_secs)
  373. {
  374. if (annotate_browser__search_window(browser, delay_secs))
  375. return __annotate_browser__search(browser);
  376. return false;
  377. }
  378. static bool annotate_browser__continue_search(struct annotate_browser *browser,
  379. int delay_secs)
  380. {
  381. if (!*browser->search_bf)
  382. return annotate_browser__search(browser, delay_secs);
  383. return __annotate_browser__search(browser);
  384. }
  385. static bool annotate_browser__search_reverse(struct annotate_browser *browser,
  386. int delay_secs)
  387. {
  388. if (annotate_browser__search_window(browser, delay_secs))
  389. return __annotate_browser__search_reverse(browser);
  390. return false;
  391. }
  392. static
  393. bool annotate_browser__continue_search_reverse(struct annotate_browser *browser,
  394. int delay_secs)
  395. {
  396. if (!*browser->search_bf)
  397. return annotate_browser__search_reverse(browser, delay_secs);
  398. return __annotate_browser__search_reverse(browser);
  399. }
  400. static int annotate_browser__run(struct annotate_browser *self, int evidx,
  401. void(*timer)(void *arg),
  402. void *arg, int delay_secs)
  403. {
  404. struct rb_node *nd = NULL;
  405. struct map_symbol *ms = self->b.priv;
  406. struct symbol *sym = ms->sym;
  407. const char *help = "<-/ESC: Exit, TAB/shift+TAB: Cycle hot lines, "
  408. "H: Go to hottest line, ->/ENTER: Line action, "
  409. "O: Toggle offset view, "
  410. "S: Toggle source code view";
  411. int key;
  412. if (ui_browser__show(&self->b, sym->name, help) < 0)
  413. return -1;
  414. annotate_browser__calc_percent(self, evidx);
  415. if (self->curr_hot) {
  416. annotate_browser__set_rb_top(self, self->curr_hot);
  417. self->b.navkeypressed = false;
  418. }
  419. nd = self->curr_hot;
  420. while (1) {
  421. key = ui_browser__run(&self->b, delay_secs);
  422. if (delay_secs != 0) {
  423. annotate_browser__calc_percent(self, evidx);
  424. /*
  425. * Current line focus got out of the list of most active
  426. * lines, NULL it so that if TAB|UNTAB is pressed, we
  427. * move to curr_hot (current hottest line).
  428. */
  429. if (nd != NULL && RB_EMPTY_NODE(nd))
  430. nd = NULL;
  431. }
  432. switch (key) {
  433. case K_TIMER:
  434. if (timer != NULL)
  435. timer(arg);
  436. if (delay_secs != 0)
  437. symbol__annotate_decay_histogram(sym, evidx);
  438. continue;
  439. case K_TAB:
  440. if (nd != NULL) {
  441. nd = rb_prev(nd);
  442. if (nd == NULL)
  443. nd = rb_last(&self->entries);
  444. } else
  445. nd = self->curr_hot;
  446. break;
  447. case K_UNTAB:
  448. if (nd != NULL)
  449. nd = rb_next(nd);
  450. if (nd == NULL)
  451. nd = rb_first(&self->entries);
  452. else
  453. nd = self->curr_hot;
  454. break;
  455. case 'H':
  456. case 'h':
  457. nd = self->curr_hot;
  458. break;
  459. case 'S':
  460. case 's':
  461. if (annotate_browser__toggle_source(self))
  462. ui_helpline__puts(help);
  463. continue;
  464. case 'O':
  465. case 'o':
  466. self->use_offset = !self->use_offset;
  467. continue;
  468. case '/':
  469. if (annotate_browser__search(self, delay_secs)) {
  470. show_help:
  471. ui_helpline__puts(help);
  472. }
  473. continue;
  474. case 'n':
  475. if (self->searching_backwards ?
  476. annotate_browser__continue_search_reverse(self, delay_secs) :
  477. annotate_browser__continue_search(self, delay_secs))
  478. goto show_help;
  479. continue;
  480. case '?':
  481. if (annotate_browser__search_reverse(self, delay_secs))
  482. goto show_help;
  483. continue;
  484. case K_ENTER:
  485. case K_RIGHT:
  486. if (self->selection == NULL)
  487. ui_helpline__puts("Huh? No selection. Report to linux-kernel@vger.kernel.org");
  488. else if (self->selection->offset == -1)
  489. ui_helpline__puts("Actions are only available for assembly lines.");
  490. else if (!self->selection->ins ||
  491. !(annotate_browser__jump(self) ||
  492. annotate_browser__callq(self, evidx, timer, arg, delay_secs)))
  493. ui_helpline__puts("Actions are only available for the 'callq' and jump instructions.");
  494. continue;
  495. case K_LEFT:
  496. case K_ESC:
  497. case 'q':
  498. case CTRL('c'):
  499. goto out;
  500. default:
  501. continue;
  502. }
  503. if (nd != NULL)
  504. annotate_browser__set_rb_top(self, nd);
  505. }
  506. out:
  507. ui_browser__hide(&self->b);
  508. return key;
  509. }
  510. int hist_entry__tui_annotate(struct hist_entry *he, int evidx,
  511. void(*timer)(void *arg), void *arg, int delay_secs)
  512. {
  513. return symbol__tui_annotate(he->ms.sym, he->ms.map, evidx,
  514. timer, arg, delay_secs);
  515. }
  516. static void annotate_browser__mark_jump_targets(struct annotate_browser *browser,
  517. size_t size)
  518. {
  519. u64 offset;
  520. for (offset = 0; offset < size; ++offset) {
  521. struct disasm_line *dl = browser->offsets[offset], *dlt;
  522. struct browser_disasm_line *bdlt;
  523. if (!dl || !dl->ins || !ins__is_jump(dl->ins))
  524. continue;
  525. if (dl->target >= size) {
  526. ui__error("jump to after symbol!\n"
  527. "size: %zx, jump target: %" PRIx64,
  528. size, dl->target);
  529. continue;
  530. }
  531. dlt = browser->offsets[dl->target];
  532. bdlt = disasm_line__browser(dlt);
  533. bdlt->jump_target = true;
  534. }
  535. }
  536. int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,
  537. void(*timer)(void *arg), void *arg,
  538. int delay_secs)
  539. {
  540. struct disasm_line *pos, *n;
  541. struct annotation *notes;
  542. const size_t size = symbol__size(sym);
  543. struct map_symbol ms = {
  544. .map = map,
  545. .sym = sym,
  546. };
  547. struct annotate_browser browser = {
  548. .b = {
  549. .refresh = ui_browser__list_head_refresh,
  550. .seek = ui_browser__list_head_seek,
  551. .write = annotate_browser__write,
  552. .filter = disasm_line__filter,
  553. .priv = &ms,
  554. .use_navkeypressed = true,
  555. },
  556. .use_offset = true,
  557. };
  558. int ret = -1;
  559. if (sym == NULL)
  560. return -1;
  561. if (map->dso->annotate_warned)
  562. return -1;
  563. browser.offsets = zalloc(size * sizeof(struct disasm_line *));
  564. if (browser.offsets == NULL) {
  565. ui__error("Not enough memory!");
  566. return -1;
  567. }
  568. if (symbol__annotate(sym, map, sizeof(struct browser_disasm_line)) < 0) {
  569. ui__error("%s", ui_helpline__last_msg);
  570. goto out_free_offsets;
  571. }
  572. ui_helpline__push("Press <- or ESC to exit");
  573. notes = symbol__annotation(sym);
  574. browser.start = map__rip_2objdump(map, sym->start);
  575. list_for_each_entry(pos, &notes->src->source, node) {
  576. struct browser_disasm_line *bpos;
  577. size_t line_len = strlen(pos->line);
  578. if (browser.b.width < line_len)
  579. browser.b.width = line_len;
  580. bpos = disasm_line__browser(pos);
  581. bpos->idx = browser.nr_entries++;
  582. if (pos->offset != -1) {
  583. bpos->idx_asm = browser.nr_asm_entries++;
  584. browser.offsets[pos->offset] = pos;
  585. } else
  586. bpos->idx_asm = -1;
  587. }
  588. annotate_browser__mark_jump_targets(&browser, size);
  589. browser.offset_width = hex_width(size);
  590. browser.b.nr_entries = browser.nr_entries;
  591. browser.b.entries = &notes->src->source,
  592. browser.b.width += 18; /* Percentage */
  593. ret = annotate_browser__run(&browser, evidx, timer, arg, delay_secs);
  594. list_for_each_entry_safe(pos, n, &notes->src->source, node) {
  595. list_del(&pos->node);
  596. disasm_line__free(pos);
  597. }
  598. out_free_offsets:
  599. free(browser.offsets);
  600. return ret;
  601. }