diff options
Diffstat (limited to 'tools/perf/util/symbol.c')
-rw-r--r-- | tools/perf/util/symbol.c | 134 |
1 files changed, 59 insertions, 75 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 0a4898480d6d..8f0208ce237a 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -76,7 +76,7 @@ static void kernel_maps__fixup_end(void) | |||
76 | } | 76 | } |
77 | 77 | ||
78 | static struct symbol *symbol__new(u64 start, u64 len, const char *name, | 78 | static struct symbol *symbol__new(u64 start, u64 len, const char *name, |
79 | unsigned int priv_size, int v) | 79 | unsigned int priv_size) |
80 | { | 80 | { |
81 | size_t namelen = strlen(name) + 1; | 81 | size_t namelen = strlen(name) + 1; |
82 | struct symbol *self = calloc(1, priv_size + sizeof(*self) + namelen); | 82 | struct symbol *self = calloc(1, priv_size + sizeof(*self) + namelen); |
@@ -91,8 +91,7 @@ static struct symbol *symbol__new(u64 start, u64 len, const char *name, | |||
91 | self->start = start; | 91 | self->start = start; |
92 | self->end = len ? start + len - 1 : start; | 92 | self->end = len ? start + len - 1 : start; |
93 | 93 | ||
94 | if (v > 2) | 94 | pr_debug3("%s: %s %#Lx-%#Lx\n", __func__, name, start, self->end); |
95 | printf("%s: %s %#Lx-%#Lx\n", __func__, name, start, self->end); | ||
96 | 95 | ||
97 | memcpy(self->name, name, namelen); | 96 | memcpy(self->name, name, namelen); |
98 | 97 | ||
@@ -209,7 +208,7 @@ size_t dso__fprintf(struct dso *self, FILE *fp) | |||
209 | * so that we can in the next step set the symbol ->end address and then | 208 | * so that we can in the next step set the symbol ->end address and then |
210 | * call kernel_maps__split_kallsyms. | 209 | * call kernel_maps__split_kallsyms. |
211 | */ | 210 | */ |
212 | static int kernel_maps__load_all_kallsyms(int v) | 211 | static int kernel_maps__load_all_kallsyms(void) |
213 | { | 212 | { |
214 | char *line = NULL; | 213 | char *line = NULL; |
215 | size_t n; | 214 | size_t n; |
@@ -252,7 +251,7 @@ static int kernel_maps__load_all_kallsyms(int v) | |||
252 | * Will fix up the end later, when we have all symbols sorted. | 251 | * Will fix up the end later, when we have all symbols sorted. |
253 | */ | 252 | */ |
254 | sym = symbol__new(start, 0, symbol_name, | 253 | sym = symbol__new(start, 0, symbol_name, |
255 | kernel_map->dso->sym_priv_size, v); | 254 | kernel_map->dso->sym_priv_size); |
256 | 255 | ||
257 | if (sym == NULL) | 256 | if (sym == NULL) |
258 | goto out_delete_line; | 257 | goto out_delete_line; |
@@ -300,8 +299,8 @@ static int kernel_maps__split_kallsyms(symbol_filter_t filter, int use_modules) | |||
300 | if (strcmp(map->dso->name, module)) { | 299 | if (strcmp(map->dso->name, module)) { |
301 | map = kernel_maps__find_by_dso_name(module); | 300 | map = kernel_maps__find_by_dso_name(module); |
302 | if (!map) { | 301 | if (!map) { |
303 | fputs("/proc/{kallsyms,modules} " | 302 | pr_err("/proc/{kallsyms,modules} " |
304 | "inconsistency!\n", stderr); | 303 | "inconsistency!\n"); |
305 | return -1; | 304 | return -1; |
306 | } | 305 | } |
307 | } | 306 | } |
@@ -351,10 +350,9 @@ delete_symbol: | |||
351 | } | 350 | } |
352 | 351 | ||
353 | 352 | ||
354 | static int kernel_maps__load_kallsyms(symbol_filter_t filter, | 353 | static int kernel_maps__load_kallsyms(symbol_filter_t filter, int use_modules) |
355 | int use_modules, int v) | ||
356 | { | 354 | { |
357 | if (kernel_maps__load_all_kallsyms(v)) | 355 | if (kernel_maps__load_all_kallsyms()) |
358 | return -1; | 356 | return -1; |
359 | 357 | ||
360 | dso__fixup_sym_end(kernel_map->dso); | 358 | dso__fixup_sym_end(kernel_map->dso); |
@@ -362,9 +360,9 @@ static int kernel_maps__load_kallsyms(symbol_filter_t filter, | |||
362 | return kernel_maps__split_kallsyms(filter, use_modules); | 360 | return kernel_maps__split_kallsyms(filter, use_modules); |
363 | } | 361 | } |
364 | 362 | ||
365 | static size_t kernel_maps__fprintf(FILE *fp, int v) | 363 | static size_t kernel_maps__fprintf(FILE *fp) |
366 | { | 364 | { |
367 | size_t printed = fprintf(stderr, "Kernel maps:\n"); | 365 | size_t printed = fprintf(fp, "Kernel maps:\n"); |
368 | struct rb_node *nd; | 366 | struct rb_node *nd; |
369 | 367 | ||
370 | for (nd = rb_first(&kernel_maps); nd; nd = rb_next(nd)) { | 368 | for (nd = rb_first(&kernel_maps); nd; nd = rb_next(nd)) { |
@@ -372,17 +370,17 @@ static size_t kernel_maps__fprintf(FILE *fp, int v) | |||
372 | 370 | ||
373 | printed += fprintf(fp, "Map:"); | 371 | printed += fprintf(fp, "Map:"); |
374 | printed += map__fprintf(pos, fp); | 372 | printed += map__fprintf(pos, fp); |
375 | if (v > 1) { | 373 | if (verbose > 1) { |
376 | printed += dso__fprintf(pos->dso, fp); | 374 | printed += dso__fprintf(pos->dso, fp); |
377 | printed += fprintf(fp, "--\n"); | 375 | printed += fprintf(fp, "--\n"); |
378 | } | 376 | } |
379 | } | 377 | } |
380 | 378 | ||
381 | return printed + fprintf(stderr, "END kernel maps\n"); | 379 | return printed + fprintf(fp, "END kernel maps\n"); |
382 | } | 380 | } |
383 | 381 | ||
384 | static int dso__load_perf_map(struct dso *self, struct map *map, | 382 | static int dso__load_perf_map(struct dso *self, struct map *map, |
385 | symbol_filter_t filter, int v) | 383 | symbol_filter_t filter) |
386 | { | 384 | { |
387 | char *line = NULL; | 385 | char *line = NULL; |
388 | size_t n; | 386 | size_t n; |
@@ -420,7 +418,7 @@ static int dso__load_perf_map(struct dso *self, struct map *map, | |||
420 | continue; | 418 | continue; |
421 | 419 | ||
422 | sym = symbol__new(start, size, line + len, | 420 | sym = symbol__new(start, size, line + len, |
423 | self->sym_priv_size, v); | 421 | self->sym_priv_size); |
424 | 422 | ||
425 | if (sym == NULL) | 423 | if (sym == NULL) |
426 | goto out_delete_line; | 424 | goto out_delete_line; |
@@ -534,7 +532,7 @@ static Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep, | |||
534 | * And always look at the original dso, not at debuginfo packages, that | 532 | * And always look at the original dso, not at debuginfo packages, that |
535 | * have the PLT data stripped out (shdr_rel_plt.sh_type == SHT_NOBITS). | 533 | * have the PLT data stripped out (shdr_rel_plt.sh_type == SHT_NOBITS). |
536 | */ | 534 | */ |
537 | static int dso__synthesize_plt_symbols(struct dso *self, int v) | 535 | static int dso__synthesize_plt_symbols(struct dso *self) |
538 | { | 536 | { |
539 | uint32_t nr_rel_entries, idx; | 537 | uint32_t nr_rel_entries, idx; |
540 | GElf_Sym sym; | 538 | GElf_Sym sym; |
@@ -618,7 +616,7 @@ static int dso__synthesize_plt_symbols(struct dso *self, int v) | |||
618 | "%s@plt", elf_sym__name(&sym, symstrs)); | 616 | "%s@plt", elf_sym__name(&sym, symstrs)); |
619 | 617 | ||
620 | f = symbol__new(plt_offset, shdr_plt.sh_entsize, | 618 | f = symbol__new(plt_offset, shdr_plt.sh_entsize, |
621 | sympltname, self->sym_priv_size, v); | 619 | sympltname, self->sym_priv_size); |
622 | if (!f) | 620 | if (!f) |
623 | goto out_elf_end; | 621 | goto out_elf_end; |
624 | 622 | ||
@@ -636,7 +634,7 @@ static int dso__synthesize_plt_symbols(struct dso *self, int v) | |||
636 | "%s@plt", elf_sym__name(&sym, symstrs)); | 634 | "%s@plt", elf_sym__name(&sym, symstrs)); |
637 | 635 | ||
638 | f = symbol__new(plt_offset, shdr_plt.sh_entsize, | 636 | f = symbol__new(plt_offset, shdr_plt.sh_entsize, |
639 | sympltname, self->sym_priv_size, v); | 637 | sympltname, self->sym_priv_size); |
640 | if (!f) | 638 | if (!f) |
641 | goto out_elf_end; | 639 | goto out_elf_end; |
642 | 640 | ||
@@ -654,14 +652,14 @@ out_close: | |||
654 | if (err == 0) | 652 | if (err == 0) |
655 | return nr; | 653 | return nr; |
656 | out: | 654 | out: |
657 | fprintf(stderr, "%s: problems reading %s PLT info.\n", | 655 | pr_warning("%s: problems reading %s PLT info.\n", |
658 | __func__, self->long_name); | 656 | __func__, self->long_name); |
659 | return 0; | 657 | return 0; |
660 | } | 658 | } |
661 | 659 | ||
662 | static int dso__load_sym(struct dso *self, struct map *map, const char *name, | 660 | static int dso__load_sym(struct dso *self, struct map *map, const char *name, |
663 | int fd, symbol_filter_t filter, int kernel, | 661 | int fd, symbol_filter_t filter, int kernel, |
664 | int kmodule, int v) | 662 | int kmodule) |
665 | { | 663 | { |
666 | struct map *curr_map = map; | 664 | struct map *curr_map = map; |
667 | struct dso *curr_dso = self; | 665 | struct dso *curr_dso = self; |
@@ -680,15 +678,12 @@ static int dso__load_sym(struct dso *self, struct map *map, const char *name, | |||
680 | 678 | ||
681 | elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); | 679 | elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); |
682 | if (elf == NULL) { | 680 | if (elf == NULL) { |
683 | if (v) | 681 | pr_err("%s: cannot read %s ELF file.\n", __func__, name); |
684 | fprintf(stderr, "%s: cannot read %s ELF file.\n", | ||
685 | __func__, name); | ||
686 | goto out_close; | 682 | goto out_close; |
687 | } | 683 | } |
688 | 684 | ||
689 | if (gelf_getehdr(elf, &ehdr) == NULL) { | 685 | if (gelf_getehdr(elf, &ehdr) == NULL) { |
690 | if (v) | 686 | pr_err("%s: cannot get elf header.\n", __func__); |
691 | fprintf(stderr, "%s: cannot get elf header.\n", __func__); | ||
692 | goto out_elf_end; | 687 | goto out_elf_end; |
693 | } | 688 | } |
694 | 689 | ||
@@ -794,10 +789,9 @@ static int dso__load_sym(struct dso *self, struct map *map, const char *name, | |||
794 | } | 789 | } |
795 | 790 | ||
796 | if (curr_dso->adjust_symbols) { | 791 | if (curr_dso->adjust_symbols) { |
797 | if (v > 2) | 792 | pr_debug2("adjusting symbol: st_value: %Lx sh_addr: " |
798 | printf("adjusting symbol: st_value: %Lx sh_addr: %Lx sh_offset: %Lx\n", | 793 | "%Lx sh_offset: %Lx\n", (u64)sym.st_value, |
799 | (u64)sym.st_value, (u64)shdr.sh_addr, (u64)shdr.sh_offset); | 794 | (u64)shdr.sh_addr, (u64)shdr.sh_offset); |
800 | |||
801 | sym.st_value -= shdr.sh_addr - shdr.sh_offset; | 795 | sym.st_value -= shdr.sh_addr - shdr.sh_offset; |
802 | } | 796 | } |
803 | /* | 797 | /* |
@@ -810,7 +804,7 @@ static int dso__load_sym(struct dso *self, struct map *map, const char *name, | |||
810 | elf_name = demangled; | 804 | elf_name = demangled; |
811 | new_symbol: | 805 | new_symbol: |
812 | f = symbol__new(sym.st_value, sym.st_size, elf_name, | 806 | f = symbol__new(sym.st_value, sym.st_size, elf_name, |
813 | curr_dso->sym_priv_size, v); | 807 | curr_dso->sym_priv_size); |
814 | free(demangled); | 808 | free(demangled); |
815 | if (!f) | 809 | if (!f) |
816 | goto out_elf_end; | 810 | goto out_elf_end; |
@@ -837,7 +831,7 @@ out_close: | |||
837 | 831 | ||
838 | #define BUILD_ID_SIZE 128 | 832 | #define BUILD_ID_SIZE 128 |
839 | 833 | ||
840 | static char *dso__read_build_id(struct dso *self, int v) | 834 | static char *dso__read_build_id(struct dso *self) |
841 | { | 835 | { |
842 | int i; | 836 | int i; |
843 | GElf_Ehdr ehdr; | 837 | GElf_Ehdr ehdr; |
@@ -854,15 +848,13 @@ static char *dso__read_build_id(struct dso *self, int v) | |||
854 | 848 | ||
855 | elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); | 849 | elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); |
856 | if (elf == NULL) { | 850 | if (elf == NULL) { |
857 | if (v) | 851 | pr_err("%s: cannot read %s ELF file.\n", __func__, |
858 | fprintf(stderr, "%s: cannot read %s ELF file.\n", | 852 | self->long_name); |
859 | __func__, self->long_name); | ||
860 | goto out_close; | 853 | goto out_close; |
861 | } | 854 | } |
862 | 855 | ||
863 | if (gelf_getehdr(elf, &ehdr) == NULL) { | 856 | if (gelf_getehdr(elf, &ehdr) == NULL) { |
864 | if (v) | 857 | pr_err("%s: cannot get elf header.\n", __func__); |
865 | fprintf(stderr, "%s: cannot get elf header.\n", __func__); | ||
866 | goto out_elf_end; | 858 | goto out_elf_end; |
867 | } | 859 | } |
868 | 860 | ||
@@ -884,8 +876,7 @@ static char *dso__read_build_id(struct dso *self, int v) | |||
884 | ++raw; | 876 | ++raw; |
885 | bid += 2; | 877 | bid += 2; |
886 | } | 878 | } |
887 | if (v >= 2) | 879 | pr_debug2("%s(%s): %s\n", __func__, self->long_name, build_id); |
888 | printf("%s(%s): %s\n", __func__, self->long_name, build_id); | ||
889 | out_elf_end: | 880 | out_elf_end: |
890 | elf_end(elf); | 881 | elf_end(elf); |
891 | out_close: | 882 | out_close: |
@@ -911,8 +902,7 @@ char dso__symtab_origin(const struct dso *self) | |||
911 | return origin[self->origin]; | 902 | return origin[self->origin]; |
912 | } | 903 | } |
913 | 904 | ||
914 | int dso__load(struct dso *self, struct map *map, | 905 | int dso__load(struct dso *self, struct map *map, symbol_filter_t filter) |
915 | symbol_filter_t filter, int v) | ||
916 | { | 906 | { |
917 | int size = PATH_MAX; | 907 | int size = PATH_MAX; |
918 | char *name = malloc(size), *build_id = NULL; | 908 | char *name = malloc(size), *build_id = NULL; |
@@ -925,7 +915,7 @@ int dso__load(struct dso *self, struct map *map, | |||
925 | self->adjust_symbols = 0; | 915 | self->adjust_symbols = 0; |
926 | 916 | ||
927 | if (strncmp(self->name, "/tmp/perf-", 10) == 0) { | 917 | if (strncmp(self->name, "/tmp/perf-", 10) == 0) { |
928 | ret = dso__load_perf_map(self, map, filter, v); | 918 | ret = dso__load_perf_map(self, map, filter); |
929 | self->origin = ret > 0 ? DSO__ORIG_JAVA_JIT : | 919 | self->origin = ret > 0 ? DSO__ORIG_JAVA_JIT : |
930 | DSO__ORIG_NOT_FOUND; | 920 | DSO__ORIG_NOT_FOUND; |
931 | return ret; | 921 | return ret; |
@@ -946,7 +936,7 @@ more: | |||
946 | self->long_name); | 936 | self->long_name); |
947 | break; | 937 | break; |
948 | case DSO__ORIG_BUILDID: | 938 | case DSO__ORIG_BUILDID: |
949 | build_id = dso__read_build_id(self, v); | 939 | build_id = dso__read_build_id(self); |
950 | if (build_id != NULL) { | 940 | if (build_id != NULL) { |
951 | snprintf(name, size, | 941 | snprintf(name, size, |
952 | "/usr/lib/debug/.build-id/%.2s/%s.debug", | 942 | "/usr/lib/debug/.build-id/%.2s/%s.debug", |
@@ -967,7 +957,7 @@ more: | |||
967 | fd = open(name, O_RDONLY); | 957 | fd = open(name, O_RDONLY); |
968 | } while (fd < 0); | 958 | } while (fd < 0); |
969 | 959 | ||
970 | ret = dso__load_sym(self, map, name, fd, filter, 0, 0, v); | 960 | ret = dso__load_sym(self, map, name, fd, filter, 0, 0); |
971 | close(fd); | 961 | close(fd); |
972 | 962 | ||
973 | /* | 963 | /* |
@@ -977,7 +967,7 @@ more: | |||
977 | goto more; | 967 | goto more; |
978 | 968 | ||
979 | if (ret > 0) { | 969 | if (ret > 0) { |
980 | int nr_plt = dso__synthesize_plt_symbols(self, v); | 970 | int nr_plt = dso__synthesize_plt_symbols(self); |
981 | if (nr_plt > 0) | 971 | if (nr_plt > 0) |
982 | ret += nr_plt; | 972 | ret += nr_plt; |
983 | } | 973 | } |
@@ -1025,34 +1015,29 @@ struct map *kernel_maps__find_by_dso_name(const char *name) | |||
1025 | } | 1015 | } |
1026 | 1016 | ||
1027 | static int dso__load_module_sym(struct dso *self, struct map *map, | 1017 | static int dso__load_module_sym(struct dso *self, struct map *map, |
1028 | symbol_filter_t filter, int v) | 1018 | symbol_filter_t filter) |
1029 | { | 1019 | { |
1030 | int err = 0, fd = open(self->long_name, O_RDONLY); | 1020 | int err = 0, fd = open(self->long_name, O_RDONLY); |
1031 | 1021 | ||
1032 | if (fd < 0) { | 1022 | if (fd < 0) { |
1033 | if (v) | 1023 | pr_err("%s: cannot open %s\n", __func__, self->long_name); |
1034 | fprintf(stderr, "%s: cannot open %s\n", | ||
1035 | __func__, self->long_name); | ||
1036 | return err; | 1024 | return err; |
1037 | } | 1025 | } |
1038 | 1026 | ||
1039 | err = dso__load_sym(self, map, self->long_name, fd, filter, 0, 1, v); | 1027 | err = dso__load_sym(self, map, self->long_name, fd, filter, 0, 1); |
1040 | close(fd); | 1028 | close(fd); |
1041 | 1029 | ||
1042 | return err; | 1030 | return err; |
1043 | } | 1031 | } |
1044 | 1032 | ||
1045 | static int dsos__load_modules_sym_dir(char *dirname, | 1033 | static int dsos__load_modules_sym_dir(char *dirname, symbol_filter_t filter) |
1046 | symbol_filter_t filter, int v) | ||
1047 | { | 1034 | { |
1048 | struct dirent *dent; | 1035 | struct dirent *dent; |
1049 | int nr_symbols = 0, err; | 1036 | int nr_symbols = 0, err; |
1050 | DIR *dir = opendir(dirname); | 1037 | DIR *dir = opendir(dirname); |
1051 | 1038 | ||
1052 | if (!dir) { | 1039 | if (!dir) { |
1053 | if (v) | 1040 | pr_err("%s: cannot open %s dir\n", __func__, dirname); |
1054 | fprintf(stderr, "%s: cannot open %s dir\n", __func__, | ||
1055 | dirname); | ||
1056 | return -1; | 1041 | return -1; |
1057 | } | 1042 | } |
1058 | 1043 | ||
@@ -1066,7 +1051,7 @@ static int dsos__load_modules_sym_dir(char *dirname, | |||
1066 | 1051 | ||
1067 | snprintf(path, sizeof(path), "%s/%s", | 1052 | snprintf(path, sizeof(path), "%s/%s", |
1068 | dirname, dent->d_name); | 1053 | dirname, dent->d_name); |
1069 | err = dsos__load_modules_sym_dir(path, filter, v); | 1054 | err = dsos__load_modules_sym_dir(path, filter); |
1070 | if (err < 0) | 1055 | if (err < 0) |
1071 | goto failure; | 1056 | goto failure; |
1072 | } else { | 1057 | } else { |
@@ -1092,7 +1077,7 @@ static int dsos__load_modules_sym_dir(char *dirname, | |||
1092 | if (map->dso->long_name == NULL) | 1077 | if (map->dso->long_name == NULL) |
1093 | goto failure; | 1078 | goto failure; |
1094 | 1079 | ||
1095 | err = dso__load_module_sym(map->dso, map, filter, v); | 1080 | err = dso__load_module_sym(map->dso, map, filter); |
1096 | if (err < 0) | 1081 | if (err < 0) |
1097 | goto failure; | 1082 | goto failure; |
1098 | last = rb_last(&map->dso->syms); | 1083 | last = rb_last(&map->dso->syms); |
@@ -1119,7 +1104,7 @@ failure: | |||
1119 | return -1; | 1104 | return -1; |
1120 | } | 1105 | } |
1121 | 1106 | ||
1122 | static int dsos__load_modules_sym(symbol_filter_t filter, int v) | 1107 | static int dsos__load_modules_sym(symbol_filter_t filter) |
1123 | { | 1108 | { |
1124 | struct utsname uts; | 1109 | struct utsname uts; |
1125 | char modules_path[PATH_MAX]; | 1110 | char modules_path[PATH_MAX]; |
@@ -1130,7 +1115,7 @@ static int dsos__load_modules_sym(symbol_filter_t filter, int v) | |||
1130 | snprintf(modules_path, sizeof(modules_path), "/lib/modules/%s/kernel", | 1115 | snprintf(modules_path, sizeof(modules_path), "/lib/modules/%s/kernel", |
1131 | uts.release); | 1116 | uts.release); |
1132 | 1117 | ||
1133 | return dsos__load_modules_sym_dir(modules_path, filter, v); | 1118 | return dsos__load_modules_sym_dir(modules_path, filter); |
1134 | } | 1119 | } |
1135 | 1120 | ||
1136 | /* | 1121 | /* |
@@ -1225,15 +1210,14 @@ out_failure: | |||
1225 | } | 1210 | } |
1226 | 1211 | ||
1227 | static int dso__load_vmlinux(struct dso *self, struct map *map, | 1212 | static int dso__load_vmlinux(struct dso *self, struct map *map, |
1228 | const char *vmlinux, | 1213 | const char *vmlinux, symbol_filter_t filter) |
1229 | symbol_filter_t filter, int v) | ||
1230 | { | 1214 | { |
1231 | int err, fd = open(vmlinux, O_RDONLY); | 1215 | int err, fd = open(vmlinux, O_RDONLY); |
1232 | 1216 | ||
1233 | if (fd < 0) | 1217 | if (fd < 0) |
1234 | return -1; | 1218 | return -1; |
1235 | 1219 | ||
1236 | err = dso__load_sym(self, map, self->long_name, fd, filter, 1, 0, v); | 1220 | err = dso__load_sym(self, map, self->long_name, fd, filter, 1, 0); |
1237 | 1221 | ||
1238 | close(fd); | 1222 | close(fd); |
1239 | 1223 | ||
@@ -1241,7 +1225,7 @@ static int dso__load_vmlinux(struct dso *self, struct map *map, | |||
1241 | } | 1225 | } |
1242 | 1226 | ||
1243 | int dsos__load_kernel(const char *vmlinux, unsigned int sym_priv_size, | 1227 | int dsos__load_kernel(const char *vmlinux, unsigned int sym_priv_size, |
1244 | symbol_filter_t filter, int v, int use_modules) | 1228 | symbol_filter_t filter, int use_modules) |
1245 | { | 1229 | { |
1246 | int err = -1; | 1230 | int err = -1; |
1247 | struct dso *dso = dso__new(vmlinux, sym_priv_size); | 1231 | struct dso *dso = dso__new(vmlinux, sym_priv_size); |
@@ -1257,26 +1241,26 @@ int dsos__load_kernel(const char *vmlinux, unsigned int sym_priv_size, | |||
1257 | kernel_map->map_ip = kernel_map->unmap_ip = identity__map_ip; | 1241 | kernel_map->map_ip = kernel_map->unmap_ip = identity__map_ip; |
1258 | 1242 | ||
1259 | if (use_modules && dsos__load_modules(sym_priv_size) < 0) { | 1243 | if (use_modules && dsos__load_modules(sym_priv_size) < 0) { |
1260 | fprintf(stderr, "Failed to load list of modules in use! " | 1244 | pr_warning("Failed to load list of modules in use! " |
1261 | "Continuing...\n"); | 1245 | "Continuing...\n"); |
1262 | use_modules = 0; | 1246 | use_modules = 0; |
1263 | } | 1247 | } |
1264 | 1248 | ||
1265 | if (vmlinux) { | 1249 | if (vmlinux) { |
1266 | err = dso__load_vmlinux(dso, kernel_map, vmlinux, filter, v); | 1250 | err = dso__load_vmlinux(dso, kernel_map, vmlinux, filter); |
1267 | if (err > 0 && use_modules) { | 1251 | if (err > 0 && use_modules) { |
1268 | int syms = dsos__load_modules_sym(filter, v); | 1252 | int syms = dsos__load_modules_sym(filter); |
1269 | 1253 | ||
1270 | if (syms < 0) | 1254 | if (syms < 0) |
1271 | fprintf(stderr, "Failed to read module symbols!" | 1255 | pr_warning("Failed to read module symbols!" |
1272 | " Continuing...\n"); | 1256 | " Continuing...\n"); |
1273 | else | 1257 | else |
1274 | err += syms; | 1258 | err += syms; |
1275 | } | 1259 | } |
1276 | } | 1260 | } |
1277 | 1261 | ||
1278 | if (err <= 0) | 1262 | if (err <= 0) |
1279 | err = kernel_maps__load_kallsyms(filter, use_modules, v); | 1263 | err = kernel_maps__load_kallsyms(filter, use_modules); |
1280 | 1264 | ||
1281 | if (err > 0) { | 1265 | if (err > 0) { |
1282 | struct rb_node *node = rb_first(&dso->syms); | 1266 | struct rb_node *node = rb_first(&dso->syms); |
@@ -1296,8 +1280,8 @@ int dsos__load_kernel(const char *vmlinux, unsigned int sym_priv_size, | |||
1296 | kernel_maps__fixup_end(); | 1280 | kernel_maps__fixup_end(); |
1297 | dsos__add(dso); | 1281 | dsos__add(dso); |
1298 | 1282 | ||
1299 | if (v > 0) | 1283 | if (verbose) |
1300 | kernel_maps__fprintf(stderr, v); | 1284 | kernel_maps__fprintf(stderr); |
1301 | } | 1285 | } |
1302 | 1286 | ||
1303 | return err; | 1287 | return err; |
@@ -1355,8 +1339,8 @@ void dsos__fprintf(FILE *fp) | |||
1355 | 1339 | ||
1356 | int load_kernel(unsigned int sym_priv_size, symbol_filter_t filter) | 1340 | int load_kernel(unsigned int sym_priv_size, symbol_filter_t filter) |
1357 | { | 1341 | { |
1358 | if (dsos__load_kernel(vmlinux_name, sym_priv_size, | 1342 | if (dsos__load_kernel(vmlinux_name, sym_priv_size, filter, |
1359 | filter, verbose, modules) <= 0) | 1343 | modules) <= 0) |
1360 | return -1; | 1344 | return -1; |
1361 | 1345 | ||
1362 | vdso = dso__new("[vdso]", 0); | 1346 | vdso = dso__new("[vdso]", 0); |