annotate.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748
  1. /*
  2. * Copyright (C) 2011, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
  3. *
  4. * Parts came from builtin-annotate.c, see those files for further
  5. * copyright notes.
  6. *
  7. * Released under the GPL v2. (and only v2, not any later version)
  8. */
  9. #include "util.h"
  10. #include "build-id.h"
  11. #include "color.h"
  12. #include "cache.h"
  13. #include "symbol.h"
  14. #include "debug.h"
  15. #include "annotate.h"
  16. #include <pthread.h>
  17. const char *disassembler_style;
  18. static int jump_ops__parse_target(const char *operands, u64 *target)
  19. {
  20. const char *s = strchr(operands, '+');
  21. if (s++ == NULL)
  22. return -1;
  23. *target = strtoll(s, NULL, 16);
  24. return 0;
  25. }
  26. static struct ins_ops jump_ops = {
  27. .parse_target = jump_ops__parse_target,
  28. };
  29. bool ins__is_jump(const struct ins *ins)
  30. {
  31. return ins->ops == &jump_ops;
  32. }
  33. /*
  34. * Must be sorted by name!
  35. */
  36. static struct ins instructions[] = {
  37. { .name = "ja", .ops = &jump_ops, },
  38. { .name = "je", .ops = &jump_ops, },
  39. { .name = "jmp", .ops = &jump_ops, },
  40. { .name = "jmpq", .ops = &jump_ops, },
  41. { .name = "jne", .ops = &jump_ops, },
  42. { .name = "js", .ops = &jump_ops, },
  43. };
  44. static int ins__cmp(const void *name, const void *insp)
  45. {
  46. const struct ins *ins = insp;
  47. return strcmp(name, ins->name);
  48. }
  49. static struct ins *ins__find(const char *name)
  50. {
  51. const int nmemb = ARRAY_SIZE(instructions);
  52. return bsearch(name, instructions, nmemb, sizeof(struct ins), ins__cmp);
  53. }
  54. int symbol__annotate_init(struct map *map __used, struct symbol *sym)
  55. {
  56. struct annotation *notes = symbol__annotation(sym);
  57. pthread_mutex_init(&notes->lock, NULL);
  58. return 0;
  59. }
  60. int symbol__alloc_hist(struct symbol *sym)
  61. {
  62. struct annotation *notes = symbol__annotation(sym);
  63. const size_t size = sym->end - sym->start + 1;
  64. size_t sizeof_sym_hist = (sizeof(struct sym_hist) + size * sizeof(u64));
  65. notes->src = zalloc(sizeof(*notes->src) + symbol_conf.nr_events * sizeof_sym_hist);
  66. if (notes->src == NULL)
  67. return -1;
  68. notes->src->sizeof_sym_hist = sizeof_sym_hist;
  69. notes->src->nr_histograms = symbol_conf.nr_events;
  70. INIT_LIST_HEAD(&notes->src->source);
  71. return 0;
  72. }
  73. void symbol__annotate_zero_histograms(struct symbol *sym)
  74. {
  75. struct annotation *notes = symbol__annotation(sym);
  76. pthread_mutex_lock(&notes->lock);
  77. if (notes->src != NULL)
  78. memset(notes->src->histograms, 0,
  79. notes->src->nr_histograms * notes->src->sizeof_sym_hist);
  80. pthread_mutex_unlock(&notes->lock);
  81. }
  82. int symbol__inc_addr_samples(struct symbol *sym, struct map *map,
  83. int evidx, u64 addr)
  84. {
  85. unsigned offset;
  86. struct annotation *notes;
  87. struct sym_hist *h;
  88. notes = symbol__annotation(sym);
  89. if (notes->src == NULL)
  90. return -ENOMEM;
  91. pr_debug3("%s: addr=%#" PRIx64 "\n", __func__, map->unmap_ip(map, addr));
  92. if (addr < sym->start || addr > sym->end)
  93. return -ERANGE;
  94. offset = addr - sym->start;
  95. h = annotation__histogram(notes, evidx);
  96. h->sum++;
  97. h->addr[offset]++;
  98. pr_debug3("%#" PRIx64 " %s: period++ [addr: %#" PRIx64 ", %#" PRIx64
  99. ", evidx=%d] => %" PRIu64 "\n", sym->start, sym->name,
  100. addr, addr - sym->start, evidx, h->addr[offset]);
  101. return 0;
  102. }
  103. static void disasm_line__init_ins(struct disasm_line *dl)
  104. {
  105. dl->ins = ins__find(dl->name);
  106. if (dl->ins == NULL)
  107. return;
  108. if (!dl->ins->ops)
  109. return;
  110. if (dl->ins->ops->parse_target)
  111. dl->ins->ops->parse_target(dl->operands, &dl->target);
  112. }
  113. static struct disasm_line *disasm_line__new(s64 offset, char *line, size_t privsize)
  114. {
  115. struct disasm_line *dl = zalloc(sizeof(*dl) + privsize);
  116. if (dl != NULL) {
  117. dl->offset = offset;
  118. dl->line = strdup(line);
  119. if (dl->line == NULL)
  120. goto out_delete;
  121. if (offset != -1) {
  122. char *name = dl->line, tmp;
  123. while (isspace(name[0]))
  124. ++name;
  125. if (name[0] == '\0')
  126. goto out_delete;
  127. dl->operands = name + 1;
  128. while (dl->operands[0] != '\0' &&
  129. !isspace(dl->operands[0]))
  130. ++dl->operands;
  131. tmp = dl->operands[0];
  132. dl->operands[0] = '\0';
  133. dl->name = strdup(name);
  134. if (dl->name == NULL)
  135. goto out_free_line;
  136. dl->operands[0] = tmp;
  137. if (dl->operands[0] != '\0') {
  138. dl->operands++;
  139. while (isspace(dl->operands[0]))
  140. ++dl->operands;
  141. }
  142. disasm_line__init_ins(dl);
  143. }
  144. }
  145. return dl;
  146. out_free_line:
  147. free(dl->line);
  148. out_delete:
  149. free(dl);
  150. return NULL;
  151. }
  152. void disasm_line__free(struct disasm_line *dl)
  153. {
  154. free(dl->line);
  155. free(dl->name);
  156. free(dl);
  157. }
  158. static void disasm__add(struct list_head *head, struct disasm_line *line)
  159. {
  160. list_add_tail(&line->node, head);
  161. }
  162. struct disasm_line *disasm__get_next_ip_line(struct list_head *head, struct disasm_line *pos)
  163. {
  164. list_for_each_entry_continue(pos, head, node)
  165. if (pos->offset >= 0)
  166. return pos;
  167. return NULL;
  168. }
  169. static int disasm_line__print(struct disasm_line *dl, struct symbol *sym, u64 start,
  170. int evidx, u64 len, int min_pcnt, int printed,
  171. int max_lines, struct disasm_line *queue)
  172. {
  173. static const char *prev_line;
  174. static const char *prev_color;
  175. if (dl->offset != -1) {
  176. const char *path = NULL;
  177. unsigned int hits = 0;
  178. double percent = 0.0;
  179. const char *color;
  180. struct annotation *notes = symbol__annotation(sym);
  181. struct source_line *src_line = notes->src->lines;
  182. struct sym_hist *h = annotation__histogram(notes, evidx);
  183. s64 offset = dl->offset;
  184. const u64 addr = start + offset;
  185. struct disasm_line *next;
  186. next = disasm__get_next_ip_line(&notes->src->source, dl);
  187. while (offset < (s64)len &&
  188. (next == NULL || offset < next->offset)) {
  189. if (src_line) {
  190. if (path == NULL)
  191. path = src_line[offset].path;
  192. percent += src_line[offset].percent;
  193. } else
  194. hits += h->addr[offset];
  195. ++offset;
  196. }
  197. if (src_line == NULL && h->sum)
  198. percent = 100.0 * hits / h->sum;
  199. if (percent < min_pcnt)
  200. return -1;
  201. if (max_lines && printed >= max_lines)
  202. return 1;
  203. if (queue != NULL) {
  204. list_for_each_entry_from(queue, &notes->src->source, node) {
  205. if (queue == dl)
  206. break;
  207. disasm_line__print(queue, sym, start, evidx, len,
  208. 0, 0, 1, NULL);
  209. }
  210. }
  211. color = get_percent_color(percent);
  212. /*
  213. * Also color the filename and line if needed, with
  214. * the same color than the percentage. Don't print it
  215. * twice for close colored addr with the same filename:line
  216. */
  217. if (path) {
  218. if (!prev_line || strcmp(prev_line, path)
  219. || color != prev_color) {
  220. color_fprintf(stdout, color, " %s", path);
  221. prev_line = path;
  222. prev_color = color;
  223. }
  224. }
  225. color_fprintf(stdout, color, " %7.2f", percent);
  226. printf(" : ");
  227. color_fprintf(stdout, PERF_COLOR_MAGENTA, " %" PRIx64 ":", addr);
  228. color_fprintf(stdout, PERF_COLOR_BLUE, "%s\n", dl->line);
  229. } else if (max_lines && printed >= max_lines)
  230. return 1;
  231. else {
  232. if (queue)
  233. return -1;
  234. if (!*dl->line)
  235. printf(" :\n");
  236. else
  237. printf(" : %s\n", dl->line);
  238. }
  239. return 0;
  240. }
  241. static int symbol__parse_objdump_line(struct symbol *sym, struct map *map,
  242. FILE *file, size_t privsize)
  243. {
  244. struct annotation *notes = symbol__annotation(sym);
  245. struct disasm_line *dl;
  246. char *line = NULL, *parsed_line, *tmp, *tmp2, *c;
  247. size_t line_len;
  248. s64 line_ip, offset = -1;
  249. if (getline(&line, &line_len, file) < 0)
  250. return -1;
  251. if (!line)
  252. return -1;
  253. while (line_len != 0 && isspace(line[line_len - 1]))
  254. line[--line_len] = '\0';
  255. c = strchr(line, '\n');
  256. if (c)
  257. *c = 0;
  258. line_ip = -1;
  259. parsed_line = line;
  260. /*
  261. * Strip leading spaces:
  262. */
  263. tmp = line;
  264. while (*tmp) {
  265. if (*tmp != ' ')
  266. break;
  267. tmp++;
  268. }
  269. if (*tmp) {
  270. /*
  271. * Parse hexa addresses followed by ':'
  272. */
  273. line_ip = strtoull(tmp, &tmp2, 16);
  274. if (*tmp2 != ':' || tmp == tmp2 || tmp2[1] == '\0')
  275. line_ip = -1;
  276. }
  277. if (line_ip != -1) {
  278. u64 start = map__rip_2objdump(map, sym->start),
  279. end = map__rip_2objdump(map, sym->end);
  280. offset = line_ip - start;
  281. if (offset < 0 || (u64)line_ip > end)
  282. offset = -1;
  283. else
  284. parsed_line = tmp2 + 1;
  285. }
  286. dl = disasm_line__new(offset, parsed_line, privsize);
  287. free(line);
  288. if (dl == NULL)
  289. return -1;
  290. disasm__add(&notes->src->source, dl);
  291. return 0;
  292. }
  293. int symbol__annotate(struct symbol *sym, struct map *map, size_t privsize)
  294. {
  295. struct dso *dso = map->dso;
  296. char *filename = dso__build_id_filename(dso, NULL, 0);
  297. bool free_filename = true;
  298. char command[PATH_MAX * 2];
  299. FILE *file;
  300. int err = 0;
  301. char symfs_filename[PATH_MAX];
  302. if (filename) {
  303. snprintf(symfs_filename, sizeof(symfs_filename), "%s%s",
  304. symbol_conf.symfs, filename);
  305. }
  306. if (filename == NULL) {
  307. if (dso->has_build_id) {
  308. pr_err("Can't annotate %s: not enough memory\n",
  309. sym->name);
  310. return -ENOMEM;
  311. }
  312. goto fallback;
  313. } else if (readlink(symfs_filename, command, sizeof(command)) < 0 ||
  314. strstr(command, "[kernel.kallsyms]") ||
  315. access(symfs_filename, R_OK)) {
  316. free(filename);
  317. fallback:
  318. /*
  319. * If we don't have build-ids or the build-id file isn't in the
  320. * cache, or is just a kallsyms file, well, lets hope that this
  321. * DSO is the same as when 'perf record' ran.
  322. */
  323. filename = dso->long_name;
  324. snprintf(symfs_filename, sizeof(symfs_filename), "%s%s",
  325. symbol_conf.symfs, filename);
  326. free_filename = false;
  327. }
  328. if (dso->symtab_type == SYMTAB__KALLSYMS) {
  329. char bf[BUILD_ID_SIZE * 2 + 16] = " with build id ";
  330. char *build_id_msg = NULL;
  331. if (dso->annotate_warned)
  332. goto out_free_filename;
  333. if (dso->has_build_id) {
  334. build_id__sprintf(dso->build_id,
  335. sizeof(dso->build_id), bf + 15);
  336. build_id_msg = bf;
  337. }
  338. err = -ENOENT;
  339. dso->annotate_warned = 1;
  340. pr_err("Can't annotate %s:\n\n"
  341. "No vmlinux file%s\nwas found in the path.\n\n"
  342. "Please use:\n\n"
  343. " perf buildid-cache -av vmlinux\n\n"
  344. "or:\n\n"
  345. " --vmlinux vmlinux\n",
  346. sym->name, build_id_msg ?: "");
  347. goto out_free_filename;
  348. }
  349. pr_debug("%s: filename=%s, sym=%s, start=%#" PRIx64 ", end=%#" PRIx64 "\n", __func__,
  350. filename, sym->name, map->unmap_ip(map, sym->start),
  351. map->unmap_ip(map, sym->end));
  352. pr_debug("annotating [%p] %30s : [%p] %30s\n",
  353. dso, dso->long_name, sym, sym->name);
  354. snprintf(command, sizeof(command),
  355. "objdump %s%s --start-address=0x%016" PRIx64
  356. " --stop-address=0x%016" PRIx64
  357. " -d %s %s -C %s|grep -v %s|expand",
  358. disassembler_style ? "-M " : "",
  359. disassembler_style ? disassembler_style : "",
  360. map__rip_2objdump(map, sym->start),
  361. map__rip_2objdump(map, sym->end+1),
  362. symbol_conf.annotate_asm_raw ? "" : "--no-show-raw",
  363. symbol_conf.annotate_src ? "-S" : "",
  364. symfs_filename, filename);
  365. pr_debug("Executing: %s\n", command);
  366. file = popen(command, "r");
  367. if (!file)
  368. goto out_free_filename;
  369. while (!feof(file))
  370. if (symbol__parse_objdump_line(sym, map, file, privsize) < 0)
  371. break;
  372. pclose(file);
  373. out_free_filename:
  374. if (free_filename)
  375. free(filename);
  376. return err;
  377. }
  378. static void insert_source_line(struct rb_root *root, struct source_line *src_line)
  379. {
  380. struct source_line *iter;
  381. struct rb_node **p = &root->rb_node;
  382. struct rb_node *parent = NULL;
  383. while (*p != NULL) {
  384. parent = *p;
  385. iter = rb_entry(parent, struct source_line, node);
  386. if (src_line->percent > iter->percent)
  387. p = &(*p)->rb_left;
  388. else
  389. p = &(*p)->rb_right;
  390. }
  391. rb_link_node(&src_line->node, parent, p);
  392. rb_insert_color(&src_line->node, root);
  393. }
  394. static void symbol__free_source_line(struct symbol *sym, int len)
  395. {
  396. struct annotation *notes = symbol__annotation(sym);
  397. struct source_line *src_line = notes->src->lines;
  398. int i;
  399. for (i = 0; i < len; i++)
  400. free(src_line[i].path);
  401. free(src_line);
  402. notes->src->lines = NULL;
  403. }
  404. /* Get the filename:line for the colored entries */
  405. static int symbol__get_source_line(struct symbol *sym, struct map *map,
  406. int evidx, struct rb_root *root, int len,
  407. const char *filename)
  408. {
  409. u64 start;
  410. int i;
  411. char cmd[PATH_MAX * 2];
  412. struct source_line *src_line;
  413. struct annotation *notes = symbol__annotation(sym);
  414. struct sym_hist *h = annotation__histogram(notes, evidx);
  415. if (!h->sum)
  416. return 0;
  417. src_line = notes->src->lines = calloc(len, sizeof(struct source_line));
  418. if (!notes->src->lines)
  419. return -1;
  420. start = map__rip_2objdump(map, sym->start);
  421. for (i = 0; i < len; i++) {
  422. char *path = NULL;
  423. size_t line_len;
  424. u64 offset;
  425. FILE *fp;
  426. src_line[i].percent = 100.0 * h->addr[i] / h->sum;
  427. if (src_line[i].percent <= 0.5)
  428. continue;
  429. offset = start + i;
  430. sprintf(cmd, "addr2line -e %s %016" PRIx64, filename, offset);
  431. fp = popen(cmd, "r");
  432. if (!fp)
  433. continue;
  434. if (getline(&path, &line_len, fp) < 0 || !line_len)
  435. goto next;
  436. src_line[i].path = malloc(sizeof(char) * line_len + 1);
  437. if (!src_line[i].path)
  438. goto next;
  439. strcpy(src_line[i].path, path);
  440. insert_source_line(root, &src_line[i]);
  441. next:
  442. pclose(fp);
  443. }
  444. return 0;
  445. }
  446. static void print_summary(struct rb_root *root, const char *filename)
  447. {
  448. struct source_line *src_line;
  449. struct rb_node *node;
  450. printf("\nSorted summary for file %s\n", filename);
  451. printf("----------------------------------------------\n\n");
  452. if (RB_EMPTY_ROOT(root)) {
  453. printf(" Nothing higher than %1.1f%%\n", MIN_GREEN);
  454. return;
  455. }
  456. node = rb_first(root);
  457. while (node) {
  458. double percent;
  459. const char *color;
  460. char *path;
  461. src_line = rb_entry(node, struct source_line, node);
  462. percent = src_line->percent;
  463. color = get_percent_color(percent);
  464. path = src_line->path;
  465. color_fprintf(stdout, color, " %7.2f %s", percent, path);
  466. node = rb_next(node);
  467. }
  468. }
  469. static void symbol__annotate_hits(struct symbol *sym, int evidx)
  470. {
  471. struct annotation *notes = symbol__annotation(sym);
  472. struct sym_hist *h = annotation__histogram(notes, evidx);
  473. u64 len = sym->end - sym->start, offset;
  474. for (offset = 0; offset < len; ++offset)
  475. if (h->addr[offset] != 0)
  476. printf("%*" PRIx64 ": %" PRIu64 "\n", BITS_PER_LONG / 2,
  477. sym->start + offset, h->addr[offset]);
  478. printf("%*s: %" PRIu64 "\n", BITS_PER_LONG / 2, "h->sum", h->sum);
  479. }
  480. int symbol__annotate_printf(struct symbol *sym, struct map *map, int evidx,
  481. bool full_paths, int min_pcnt, int max_lines,
  482. int context)
  483. {
  484. struct dso *dso = map->dso;
  485. const char *filename = dso->long_name, *d_filename;
  486. struct annotation *notes = symbol__annotation(sym);
  487. struct disasm_line *pos, *queue = NULL;
  488. u64 start = map__rip_2objdump(map, sym->start);
  489. int printed = 2, queue_len = 0;
  490. int more = 0;
  491. u64 len;
  492. if (full_paths)
  493. d_filename = filename;
  494. else
  495. d_filename = basename(filename);
  496. len = sym->end - sym->start;
  497. printf(" Percent | Source code & Disassembly of %s\n", d_filename);
  498. printf("------------------------------------------------\n");
  499. if (verbose)
  500. symbol__annotate_hits(sym, evidx);
  501. list_for_each_entry(pos, &notes->src->source, node) {
  502. if (context && queue == NULL) {
  503. queue = pos;
  504. queue_len = 0;
  505. }
  506. switch (disasm_line__print(pos, sym, start, evidx, len,
  507. min_pcnt, printed, max_lines,
  508. queue)) {
  509. case 0:
  510. ++printed;
  511. if (context) {
  512. printed += queue_len;
  513. queue = NULL;
  514. queue_len = 0;
  515. }
  516. break;
  517. case 1:
  518. /* filtered by max_lines */
  519. ++more;
  520. break;
  521. case -1:
  522. default:
  523. /*
  524. * Filtered by min_pcnt or non IP lines when
  525. * context != 0
  526. */
  527. if (!context)
  528. break;
  529. if (queue_len == context)
  530. queue = list_entry(queue->node.next, typeof(*queue), node);
  531. else
  532. ++queue_len;
  533. break;
  534. }
  535. }
  536. return more;
  537. }
  538. void symbol__annotate_zero_histogram(struct symbol *sym, int evidx)
  539. {
  540. struct annotation *notes = symbol__annotation(sym);
  541. struct sym_hist *h = annotation__histogram(notes, evidx);
  542. memset(h, 0, notes->src->sizeof_sym_hist);
  543. }
  544. void symbol__annotate_decay_histogram(struct symbol *sym, int evidx)
  545. {
  546. struct annotation *notes = symbol__annotation(sym);
  547. struct sym_hist *h = annotation__histogram(notes, evidx);
  548. int len = sym->end - sym->start, offset;
  549. h->sum = 0;
  550. for (offset = 0; offset < len; ++offset) {
  551. h->addr[offset] = h->addr[offset] * 7 / 8;
  552. h->sum += h->addr[offset];
  553. }
  554. }
  555. void disasm__purge(struct list_head *head)
  556. {
  557. struct disasm_line *pos, *n;
  558. list_for_each_entry_safe(pos, n, head, node) {
  559. list_del(&pos->node);
  560. disasm_line__free(pos);
  561. }
  562. }
  563. static size_t disasm_line__fprintf(struct disasm_line *dl, FILE *fp)
  564. {
  565. size_t printed;
  566. if (dl->offset == -1)
  567. return fprintf(fp, "%s\n", dl->line);
  568. printed = fprintf(fp, "%#" PRIx64 " %s", dl->offset, dl->name);
  569. if (dl->operands[0] != '\0') {
  570. printed += fprintf(fp, "%.*s %s\n", 6 - (int)printed, " ",
  571. dl->operands);
  572. }
  573. return printed + fprintf(fp, "\n");
  574. }
  575. size_t disasm__fprintf(struct list_head *head, FILE *fp)
  576. {
  577. struct disasm_line *pos;
  578. size_t printed = 0;
  579. list_for_each_entry(pos, head, node)
  580. printed += disasm_line__fprintf(pos, fp);
  581. return printed;
  582. }
  583. int symbol__tty_annotate(struct symbol *sym, struct map *map, int evidx,
  584. bool print_lines, bool full_paths, int min_pcnt,
  585. int max_lines)
  586. {
  587. struct dso *dso = map->dso;
  588. const char *filename = dso->long_name;
  589. struct rb_root source_line = RB_ROOT;
  590. u64 len;
  591. if (symbol__annotate(sym, map, 0) < 0)
  592. return -1;
  593. len = sym->end - sym->start;
  594. if (print_lines) {
  595. symbol__get_source_line(sym, map, evidx, &source_line,
  596. len, filename);
  597. print_summary(&source_line, filename);
  598. }
  599. symbol__annotate_printf(sym, map, evidx, full_paths,
  600. min_pcnt, max_lines, 0);
  601. if (print_lines)
  602. symbol__free_source_line(sym, len);
  603. disasm__purge(&symbol__annotation(sym)->src->source);
  604. return 0;
  605. }