annotate.c 18 KB

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