Merge tag 'locks-v3.16-2' of git://git.samba.org/jlayton/linux
[linux/fpc-iii.git] / tools / perf / util / dso.c
blob819f10414f084a38722ecec1f3be747ebe7a36c7
1 #include <asm/bug.h>
2 #include <sys/time.h>
3 #include <sys/resource.h>
4 #include "symbol.h"
5 #include "dso.h"
6 #include "machine.h"
7 #include "util.h"
8 #include "debug.h"
10 char dso__symtab_origin(const struct dso *dso)
12 static const char origin[] = {
13 [DSO_BINARY_TYPE__KALLSYMS] = 'k',
14 [DSO_BINARY_TYPE__VMLINUX] = 'v',
15 [DSO_BINARY_TYPE__JAVA_JIT] = 'j',
16 [DSO_BINARY_TYPE__DEBUGLINK] = 'l',
17 [DSO_BINARY_TYPE__BUILD_ID_CACHE] = 'B',
18 [DSO_BINARY_TYPE__FEDORA_DEBUGINFO] = 'f',
19 [DSO_BINARY_TYPE__UBUNTU_DEBUGINFO] = 'u',
20 [DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO] = 'o',
21 [DSO_BINARY_TYPE__BUILDID_DEBUGINFO] = 'b',
22 [DSO_BINARY_TYPE__SYSTEM_PATH_DSO] = 'd',
23 [DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE] = 'K',
24 [DSO_BINARY_TYPE__GUEST_KALLSYMS] = 'g',
25 [DSO_BINARY_TYPE__GUEST_KMODULE] = 'G',
26 [DSO_BINARY_TYPE__GUEST_VMLINUX] = 'V',
29 if (dso == NULL || dso->symtab_type == DSO_BINARY_TYPE__NOT_FOUND)
30 return '!';
31 return origin[dso->symtab_type];
34 int dso__read_binary_type_filename(const struct dso *dso,
35 enum dso_binary_type type,
36 char *root_dir, char *filename, size_t size)
38 char build_id_hex[BUILD_ID_SIZE * 2 + 1];
39 int ret = 0;
41 switch (type) {
42 case DSO_BINARY_TYPE__DEBUGLINK: {
43 char *debuglink;
45 strncpy(filename, dso->long_name, size);
46 debuglink = filename + dso->long_name_len;
47 while (debuglink != filename && *debuglink != '/')
48 debuglink--;
49 if (*debuglink == '/')
50 debuglink++;
51 ret = filename__read_debuglink(dso->long_name, debuglink,
52 size - (debuglink - filename));
54 break;
55 case DSO_BINARY_TYPE__BUILD_ID_CACHE:
56 /* skip the locally configured cache if a symfs is given */
57 if (symbol_conf.symfs[0] ||
58 (dso__build_id_filename(dso, filename, size) == NULL))
59 ret = -1;
60 break;
62 case DSO_BINARY_TYPE__FEDORA_DEBUGINFO:
63 snprintf(filename, size, "%s/usr/lib/debug%s.debug",
64 symbol_conf.symfs, dso->long_name);
65 break;
67 case DSO_BINARY_TYPE__UBUNTU_DEBUGINFO:
68 snprintf(filename, size, "%s/usr/lib/debug%s",
69 symbol_conf.symfs, dso->long_name);
70 break;
72 case DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO:
74 const char *last_slash;
75 size_t len;
76 size_t dir_size;
78 last_slash = dso->long_name + dso->long_name_len;
79 while (last_slash != dso->long_name && *last_slash != '/')
80 last_slash--;
82 len = scnprintf(filename, size, "%s", symbol_conf.symfs);
83 dir_size = last_slash - dso->long_name + 2;
84 if (dir_size > (size - len)) {
85 ret = -1;
86 break;
88 len += scnprintf(filename + len, dir_size, "%s", dso->long_name);
89 len += scnprintf(filename + len , size - len, ".debug%s",
90 last_slash);
91 break;
94 case DSO_BINARY_TYPE__BUILDID_DEBUGINFO:
95 if (!dso->has_build_id) {
96 ret = -1;
97 break;
100 build_id__sprintf(dso->build_id,
101 sizeof(dso->build_id),
102 build_id_hex);
103 snprintf(filename, size,
104 "%s/usr/lib/debug/.build-id/%.2s/%s.debug",
105 symbol_conf.symfs, build_id_hex, build_id_hex + 2);
106 break;
108 case DSO_BINARY_TYPE__VMLINUX:
109 case DSO_BINARY_TYPE__GUEST_VMLINUX:
110 case DSO_BINARY_TYPE__SYSTEM_PATH_DSO:
111 snprintf(filename, size, "%s%s",
112 symbol_conf.symfs, dso->long_name);
113 break;
115 case DSO_BINARY_TYPE__GUEST_KMODULE:
116 snprintf(filename, size, "%s%s%s", symbol_conf.symfs,
117 root_dir, dso->long_name);
118 break;
120 case DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE:
121 snprintf(filename, size, "%s%s", symbol_conf.symfs,
122 dso->long_name);
123 break;
125 case DSO_BINARY_TYPE__KCORE:
126 case DSO_BINARY_TYPE__GUEST_KCORE:
127 snprintf(filename, size, "%s", dso->long_name);
128 break;
130 default:
131 case DSO_BINARY_TYPE__KALLSYMS:
132 case DSO_BINARY_TYPE__GUEST_KALLSYMS:
133 case DSO_BINARY_TYPE__JAVA_JIT:
134 case DSO_BINARY_TYPE__NOT_FOUND:
135 ret = -1;
136 break;
139 return ret;
143 * Global list of open DSOs and the counter.
145 static LIST_HEAD(dso__data_open);
146 static long dso__data_open_cnt;
148 static void dso__list_add(struct dso *dso)
150 list_add_tail(&dso->data.open_entry, &dso__data_open);
151 dso__data_open_cnt++;
154 static void dso__list_del(struct dso *dso)
156 list_del(&dso->data.open_entry);
157 WARN_ONCE(dso__data_open_cnt <= 0,
158 "DSO data fd counter out of bounds.");
159 dso__data_open_cnt--;
162 static void close_first_dso(void);
164 static int do_open(char *name)
166 int fd;
168 do {
169 fd = open(name, O_RDONLY);
170 if (fd >= 0)
171 return fd;
173 pr_debug("dso open failed, mmap: %s\n", strerror(errno));
174 if (!dso__data_open_cnt || errno != EMFILE)
175 break;
177 close_first_dso();
178 } while (1);
180 return -1;
183 static int __open_dso(struct dso *dso, struct machine *machine)
185 int fd;
186 char *root_dir = (char *)"";
187 char *name = malloc(PATH_MAX);
189 if (!name)
190 return -ENOMEM;
192 if (machine)
193 root_dir = machine->root_dir;
195 if (dso__read_binary_type_filename(dso, dso->binary_type,
196 root_dir, name, PATH_MAX)) {
197 free(name);
198 return -EINVAL;
201 fd = do_open(name);
202 free(name);
203 return fd;
206 static void check_data_close(void);
209 * dso_close - Open DSO data file
210 * @dso: dso object
212 * Open @dso's data file descriptor and updates
213 * list/count of open DSO objects.
215 static int open_dso(struct dso *dso, struct machine *machine)
217 int fd = __open_dso(dso, machine);
219 if (fd > 0) {
220 dso__list_add(dso);
222 * Check if we crossed the allowed number
223 * of opened DSOs and close one if needed.
225 check_data_close();
228 return fd;
231 static void close_data_fd(struct dso *dso)
233 if (dso->data.fd >= 0) {
234 close(dso->data.fd);
235 dso->data.fd = -1;
236 dso->data.file_size = 0;
237 dso__list_del(dso);
242 * dso_close - Close DSO data file
243 * @dso: dso object
245 * Close @dso's data file descriptor and updates
246 * list/count of open DSO objects.
248 static void close_dso(struct dso *dso)
250 close_data_fd(dso);
253 static void close_first_dso(void)
255 struct dso *dso;
257 dso = list_first_entry(&dso__data_open, struct dso, data.open_entry);
258 close_dso(dso);
261 static rlim_t get_fd_limit(void)
263 struct rlimit l;
264 rlim_t limit = 0;
266 /* Allow half of the current open fd limit. */
267 if (getrlimit(RLIMIT_NOFILE, &l) == 0) {
268 if (l.rlim_cur == RLIM_INFINITY)
269 limit = l.rlim_cur;
270 else
271 limit = l.rlim_cur / 2;
272 } else {
273 pr_err("failed to get fd limit\n");
274 limit = 1;
277 return limit;
280 static bool may_cache_fd(void)
282 static rlim_t limit;
284 if (!limit)
285 limit = get_fd_limit();
287 if (limit == RLIM_INFINITY)
288 return true;
290 return limit > (rlim_t) dso__data_open_cnt;
294 * Check and close LRU dso if we crossed allowed limit
295 * for opened dso file descriptors. The limit is half
296 * of the RLIMIT_NOFILE files opened.
298 static void check_data_close(void)
300 bool cache_fd = may_cache_fd();
302 if (!cache_fd)
303 close_first_dso();
307 * dso__data_close - Close DSO data file
308 * @dso: dso object
310 * External interface to close @dso's data file descriptor.
312 void dso__data_close(struct dso *dso)
314 close_dso(dso);
318 * dso__data_fd - Get dso's data file descriptor
319 * @dso: dso object
320 * @machine: machine object
322 * External interface to find dso's file, open it and
323 * returns file descriptor.
325 int dso__data_fd(struct dso *dso, struct machine *machine)
327 enum dso_binary_type binary_type_data[] = {
328 DSO_BINARY_TYPE__BUILD_ID_CACHE,
329 DSO_BINARY_TYPE__SYSTEM_PATH_DSO,
330 DSO_BINARY_TYPE__NOT_FOUND,
332 int i = 0;
334 if (dso->data.fd >= 0)
335 return dso->data.fd;
337 if (dso->binary_type != DSO_BINARY_TYPE__NOT_FOUND) {
338 dso->data.fd = open_dso(dso, machine);
339 return dso->data.fd;
342 do {
343 int fd;
345 dso->binary_type = binary_type_data[i++];
347 fd = open_dso(dso, machine);
348 if (fd >= 0)
349 return dso->data.fd = fd;
351 } while (dso->binary_type != DSO_BINARY_TYPE__NOT_FOUND);
353 return -EINVAL;
356 static void
357 dso_cache__free(struct rb_root *root)
359 struct rb_node *next = rb_first(root);
361 while (next) {
362 struct dso_cache *cache;
364 cache = rb_entry(next, struct dso_cache, rb_node);
365 next = rb_next(&cache->rb_node);
366 rb_erase(&cache->rb_node, root);
367 free(cache);
371 static struct dso_cache *dso_cache__find(const struct rb_root *root, u64 offset)
373 struct rb_node * const *p = &root->rb_node;
374 const struct rb_node *parent = NULL;
375 struct dso_cache *cache;
377 while (*p != NULL) {
378 u64 end;
380 parent = *p;
381 cache = rb_entry(parent, struct dso_cache, rb_node);
382 end = cache->offset + DSO__DATA_CACHE_SIZE;
384 if (offset < cache->offset)
385 p = &(*p)->rb_left;
386 else if (offset >= end)
387 p = &(*p)->rb_right;
388 else
389 return cache;
391 return NULL;
394 static void
395 dso_cache__insert(struct rb_root *root, struct dso_cache *new)
397 struct rb_node **p = &root->rb_node;
398 struct rb_node *parent = NULL;
399 struct dso_cache *cache;
400 u64 offset = new->offset;
402 while (*p != NULL) {
403 u64 end;
405 parent = *p;
406 cache = rb_entry(parent, struct dso_cache, rb_node);
407 end = cache->offset + DSO__DATA_CACHE_SIZE;
409 if (offset < cache->offset)
410 p = &(*p)->rb_left;
411 else if (offset >= end)
412 p = &(*p)->rb_right;
415 rb_link_node(&new->rb_node, parent, p);
416 rb_insert_color(&new->rb_node, root);
419 static ssize_t
420 dso_cache__memcpy(struct dso_cache *cache, u64 offset,
421 u8 *data, u64 size)
423 u64 cache_offset = offset - cache->offset;
424 u64 cache_size = min(cache->size - cache_offset, size);
426 memcpy(data, cache->data + cache_offset, cache_size);
427 return cache_size;
430 static ssize_t
431 dso_cache__read(struct dso *dso, u64 offset, u8 *data, ssize_t size)
433 struct dso_cache *cache;
434 ssize_t ret;
436 do {
437 u64 cache_offset;
439 ret = -ENOMEM;
441 cache = zalloc(sizeof(*cache) + DSO__DATA_CACHE_SIZE);
442 if (!cache)
443 break;
445 cache_offset = offset & DSO__DATA_CACHE_MASK;
446 ret = -EINVAL;
448 if (-1 == lseek(dso->data.fd, cache_offset, SEEK_SET))
449 break;
451 ret = read(dso->data.fd, cache->data, DSO__DATA_CACHE_SIZE);
452 if (ret <= 0)
453 break;
455 cache->offset = cache_offset;
456 cache->size = ret;
457 dso_cache__insert(&dso->data.cache, cache);
459 ret = dso_cache__memcpy(cache, offset, data, size);
461 } while (0);
463 if (ret <= 0)
464 free(cache);
466 return ret;
469 static ssize_t dso_cache_read(struct dso *dso, u64 offset,
470 u8 *data, ssize_t size)
472 struct dso_cache *cache;
474 cache = dso_cache__find(&dso->data.cache, offset);
475 if (cache)
476 return dso_cache__memcpy(cache, offset, data, size);
477 else
478 return dso_cache__read(dso, offset, data, size);
482 * Reads and caches dso data DSO__DATA_CACHE_SIZE size chunks
483 * in the rb_tree. Any read to already cached data is served
484 * by cached data.
486 static ssize_t cached_read(struct dso *dso, u64 offset, u8 *data, ssize_t size)
488 ssize_t r = 0;
489 u8 *p = data;
491 do {
492 ssize_t ret;
494 ret = dso_cache_read(dso, offset, p, size);
495 if (ret < 0)
496 return ret;
498 /* Reached EOF, return what we have. */
499 if (!ret)
500 break;
502 BUG_ON(ret > size);
504 r += ret;
505 p += ret;
506 offset += ret;
507 size -= ret;
509 } while (size);
511 return r;
514 static int data_file_size(struct dso *dso)
516 struct stat st;
518 if (!dso->data.file_size) {
519 if (fstat(dso->data.fd, &st)) {
520 pr_err("dso mmap failed, fstat: %s\n", strerror(errno));
521 return -1;
523 dso->data.file_size = st.st_size;
526 return 0;
529 static ssize_t data_read_offset(struct dso *dso, u64 offset,
530 u8 *data, ssize_t size)
532 if (data_file_size(dso))
533 return -1;
535 /* Check the offset sanity. */
536 if (offset > dso->data.file_size)
537 return -1;
539 if (offset + size < offset)
540 return -1;
542 return cached_read(dso, offset, data, size);
546 * dso__data_read_offset - Read data from dso file offset
547 * @dso: dso object
548 * @machine: machine object
549 * @offset: file offset
550 * @data: buffer to store data
551 * @size: size of the @data buffer
553 * External interface to read data from dso file offset. Open
554 * dso data file and use cached_read to get the data.
556 ssize_t dso__data_read_offset(struct dso *dso, struct machine *machine,
557 u64 offset, u8 *data, ssize_t size)
559 if (dso__data_fd(dso, machine) < 0)
560 return -1;
562 return data_read_offset(dso, offset, data, size);
566 * dso__data_read_addr - Read data from dso address
567 * @dso: dso object
568 * @machine: machine object
569 * @add: virtual memory address
570 * @data: buffer to store data
571 * @size: size of the @data buffer
573 * External interface to read data from dso address.
575 ssize_t dso__data_read_addr(struct dso *dso, struct map *map,
576 struct machine *machine, u64 addr,
577 u8 *data, ssize_t size)
579 u64 offset = map->map_ip(map, addr);
580 return dso__data_read_offset(dso, machine, offset, data, size);
583 struct map *dso__new_map(const char *name)
585 struct map *map = NULL;
586 struct dso *dso = dso__new(name);
588 if (dso)
589 map = map__new2(0, dso, MAP__FUNCTION);
591 return map;
594 struct dso *dso__kernel_findnew(struct machine *machine, const char *name,
595 const char *short_name, int dso_type)
598 * The kernel dso could be created by build_id processing.
600 struct dso *dso = __dsos__findnew(&machine->kernel_dsos, name);
603 * We need to run this in all cases, since during the build_id
604 * processing we had no idea this was the kernel dso.
606 if (dso != NULL) {
607 dso__set_short_name(dso, short_name, false);
608 dso->kernel = dso_type;
611 return dso;
614 void dso__set_long_name(struct dso *dso, const char *name, bool name_allocated)
616 if (name == NULL)
617 return;
619 if (dso->long_name_allocated)
620 free((char *)dso->long_name);
622 dso->long_name = name;
623 dso->long_name_len = strlen(name);
624 dso->long_name_allocated = name_allocated;
627 void dso__set_short_name(struct dso *dso, const char *name, bool name_allocated)
629 if (name == NULL)
630 return;
632 if (dso->short_name_allocated)
633 free((char *)dso->short_name);
635 dso->short_name = name;
636 dso->short_name_len = strlen(name);
637 dso->short_name_allocated = name_allocated;
640 static void dso__set_basename(struct dso *dso)
643 * basename() may modify path buffer, so we must pass
644 * a copy.
646 char *base, *lname = strdup(dso->long_name);
648 if (!lname)
649 return;
652 * basename() may return a pointer to internal
653 * storage which is reused in subsequent calls
654 * so copy the result.
656 base = strdup(basename(lname));
658 free(lname);
660 if (!base)
661 return;
663 dso__set_short_name(dso, base, true);
666 int dso__name_len(const struct dso *dso)
668 if (!dso)
669 return strlen("[unknown]");
670 if (verbose)
671 return dso->long_name_len;
673 return dso->short_name_len;
676 bool dso__loaded(const struct dso *dso, enum map_type type)
678 return dso->loaded & (1 << type);
681 bool dso__sorted_by_name(const struct dso *dso, enum map_type type)
683 return dso->sorted_by_name & (1 << type);
686 void dso__set_sorted_by_name(struct dso *dso, enum map_type type)
688 dso->sorted_by_name |= (1 << type);
691 struct dso *dso__new(const char *name)
693 struct dso *dso = calloc(1, sizeof(*dso) + strlen(name) + 1);
695 if (dso != NULL) {
696 int i;
697 strcpy(dso->name, name);
698 dso__set_long_name(dso, dso->name, false);
699 dso__set_short_name(dso, dso->name, false);
700 for (i = 0; i < MAP__NR_TYPES; ++i)
701 dso->symbols[i] = dso->symbol_names[i] = RB_ROOT;
702 dso->data.cache = RB_ROOT;
703 dso->data.fd = -1;
704 dso->symtab_type = DSO_BINARY_TYPE__NOT_FOUND;
705 dso->binary_type = DSO_BINARY_TYPE__NOT_FOUND;
706 dso->loaded = 0;
707 dso->rel = 0;
708 dso->sorted_by_name = 0;
709 dso->has_build_id = 0;
710 dso->has_srcline = 1;
711 dso->a2l_fails = 1;
712 dso->kernel = DSO_TYPE_USER;
713 dso->needs_swap = DSO_SWAP__UNSET;
714 INIT_LIST_HEAD(&dso->node);
715 INIT_LIST_HEAD(&dso->data.open_entry);
718 return dso;
721 void dso__delete(struct dso *dso)
723 int i;
724 for (i = 0; i < MAP__NR_TYPES; ++i)
725 symbols__delete(&dso->symbols[i]);
727 if (dso->short_name_allocated) {
728 zfree((char **)&dso->short_name);
729 dso->short_name_allocated = false;
732 if (dso->long_name_allocated) {
733 zfree((char **)&dso->long_name);
734 dso->long_name_allocated = false;
737 dso__data_close(dso);
738 dso_cache__free(&dso->data.cache);
739 dso__free_a2l(dso);
740 zfree(&dso->symsrc_filename);
741 free(dso);
744 void dso__set_build_id(struct dso *dso, void *build_id)
746 memcpy(dso->build_id, build_id, sizeof(dso->build_id));
747 dso->has_build_id = 1;
750 bool dso__build_id_equal(const struct dso *dso, u8 *build_id)
752 return memcmp(dso->build_id, build_id, sizeof(dso->build_id)) == 0;
755 void dso__read_running_kernel_build_id(struct dso *dso, struct machine *machine)
757 char path[PATH_MAX];
759 if (machine__is_default_guest(machine))
760 return;
761 sprintf(path, "%s/sys/kernel/notes", machine->root_dir);
762 if (sysfs__read_build_id(path, dso->build_id,
763 sizeof(dso->build_id)) == 0)
764 dso->has_build_id = true;
767 int dso__kernel_module_get_build_id(struct dso *dso,
768 const char *root_dir)
770 char filename[PATH_MAX];
772 * kernel module short names are of the form "[module]" and
773 * we need just "module" here.
775 const char *name = dso->short_name + 1;
777 snprintf(filename, sizeof(filename),
778 "%s/sys/module/%.*s/notes/.note.gnu.build-id",
779 root_dir, (int)strlen(name) - 1, name);
781 if (sysfs__read_build_id(filename, dso->build_id,
782 sizeof(dso->build_id)) == 0)
783 dso->has_build_id = true;
785 return 0;
788 bool __dsos__read_build_ids(struct list_head *head, bool with_hits)
790 bool have_build_id = false;
791 struct dso *pos;
793 list_for_each_entry(pos, head, node) {
794 if (with_hits && !pos->hit)
795 continue;
796 if (pos->has_build_id) {
797 have_build_id = true;
798 continue;
800 if (filename__read_build_id(pos->long_name, pos->build_id,
801 sizeof(pos->build_id)) > 0) {
802 have_build_id = true;
803 pos->has_build_id = true;
807 return have_build_id;
810 void dsos__add(struct list_head *head, struct dso *dso)
812 list_add_tail(&dso->node, head);
815 struct dso *dsos__find(const struct list_head *head, const char *name, bool cmp_short)
817 struct dso *pos;
819 if (cmp_short) {
820 list_for_each_entry(pos, head, node)
821 if (strcmp(pos->short_name, name) == 0)
822 return pos;
823 return NULL;
825 list_for_each_entry(pos, head, node)
826 if (strcmp(pos->long_name, name) == 0)
827 return pos;
828 return NULL;
831 struct dso *__dsos__findnew(struct list_head *head, const char *name)
833 struct dso *dso = dsos__find(head, name, false);
835 if (!dso) {
836 dso = dso__new(name);
837 if (dso != NULL) {
838 dsos__add(head, dso);
839 dso__set_basename(dso);
843 return dso;
846 size_t __dsos__fprintf_buildid(struct list_head *head, FILE *fp,
847 bool (skip)(struct dso *dso, int parm), int parm)
849 struct dso *pos;
850 size_t ret = 0;
852 list_for_each_entry(pos, head, node) {
853 if (skip && skip(pos, parm))
854 continue;
855 ret += dso__fprintf_buildid(pos, fp);
856 ret += fprintf(fp, " %s\n", pos->long_name);
858 return ret;
861 size_t __dsos__fprintf(struct list_head *head, FILE *fp)
863 struct dso *pos;
864 size_t ret = 0;
866 list_for_each_entry(pos, head, node) {
867 int i;
868 for (i = 0; i < MAP__NR_TYPES; ++i)
869 ret += dso__fprintf(pos, i, fp);
872 return ret;
875 size_t dso__fprintf_buildid(struct dso *dso, FILE *fp)
877 char sbuild_id[BUILD_ID_SIZE * 2 + 1];
879 build_id__sprintf(dso->build_id, sizeof(dso->build_id), sbuild_id);
880 return fprintf(fp, "%s", sbuild_id);
883 size_t dso__fprintf(struct dso *dso, enum map_type type, FILE *fp)
885 struct rb_node *nd;
886 size_t ret = fprintf(fp, "dso: %s (", dso->short_name);
888 if (dso->short_name != dso->long_name)
889 ret += fprintf(fp, "%s, ", dso->long_name);
890 ret += fprintf(fp, "%s, %sloaded, ", map_type__name[type],
891 dso__loaded(dso, type) ? "" : "NOT ");
892 ret += dso__fprintf_buildid(dso, fp);
893 ret += fprintf(fp, ")\n");
894 for (nd = rb_first(&dso->symbols[type]); nd; nd = rb_next(nd)) {
895 struct symbol *pos = rb_entry(nd, struct symbol, rb_node);
896 ret += symbol__fprintf(pos, fp);
899 return ret;