diff options
Diffstat (limited to 'tools/perf/util/symbol-elf.c')
-rw-r--r-- | tools/perf/util/symbol-elf.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index d75349979e65..1e23a5bfb044 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <inttypes.h> | 6 | #include <inttypes.h> |
7 | 7 | ||
8 | #include "symbol.h" | 8 | #include "symbol.h" |
9 | #include "machine.h" | ||
9 | #include "vdso.h" | 10 | #include "vdso.h" |
10 | #include <symbol/kallsyms.h> | 11 | #include <symbol/kallsyms.h> |
11 | #include "debug.h" | 12 | #include "debug.h" |
@@ -680,6 +681,11 @@ static u64 ref_reloc(struct kmap *kmap) | |||
680 | return 0; | 681 | return 0; |
681 | } | 682 | } |
682 | 683 | ||
684 | static bool want_demangle(bool is_kernel_sym) | ||
685 | { | ||
686 | return is_kernel_sym ? symbol_conf.demangle_kernel : symbol_conf.demangle; | ||
687 | } | ||
688 | |||
683 | int dso__load_sym(struct dso *dso, struct map *map, | 689 | int dso__load_sym(struct dso *dso, struct map *map, |
684 | struct symsrc *syms_ss, struct symsrc *runtime_ss, | 690 | struct symsrc *syms_ss, struct symsrc *runtime_ss, |
685 | symbol_filter_t filter, int kmodule) | 691 | symbol_filter_t filter, int kmodule) |
@@ -712,6 +718,14 @@ int dso__load_sym(struct dso *dso, struct map *map, | |||
712 | symbols__delete(&dso->symbols[map->type]); | 718 | symbols__delete(&dso->symbols[map->type]); |
713 | 719 | ||
714 | if (!syms_ss->symtab) { | 720 | if (!syms_ss->symtab) { |
721 | /* | ||
722 | * If the vmlinux is stripped, fail so we will fall back | ||
723 | * to using kallsyms. The vmlinux runtime symbols aren't | ||
724 | * of much use. | ||
725 | */ | ||
726 | if (dso->kernel) | ||
727 | goto out_elf_end; | ||
728 | |||
715 | syms_ss->symtab = syms_ss->dynsym; | 729 | syms_ss->symtab = syms_ss->dynsym; |
716 | syms_ss->symshdr = syms_ss->dynshdr; | 730 | syms_ss->symshdr = syms_ss->dynshdr; |
717 | } | 731 | } |
@@ -736,7 +750,7 @@ int dso__load_sym(struct dso *dso, struct map *map, | |||
736 | if (symstrs == NULL) | 750 | if (symstrs == NULL) |
737 | goto out_elf_end; | 751 | goto out_elf_end; |
738 | 752 | ||
739 | sec_strndx = elf_getscn(elf, ehdr.e_shstrndx); | 753 | sec_strndx = elf_getscn(runtime_ss->elf, runtime_ss->ehdr.e_shstrndx); |
740 | if (sec_strndx == NULL) | 754 | if (sec_strndx == NULL) |
741 | goto out_elf_end; | 755 | goto out_elf_end; |
742 | 756 | ||
@@ -916,7 +930,11 @@ int dso__load_sym(struct dso *dso, struct map *map, | |||
916 | } | 930 | } |
917 | curr_dso->symtab_type = dso->symtab_type; | 931 | curr_dso->symtab_type = dso->symtab_type; |
918 | map_groups__insert(kmap->kmaps, curr_map); | 932 | map_groups__insert(kmap->kmaps, curr_map); |
919 | dsos__add(&dso->node, curr_dso); | 933 | /* |
934 | * The new DSO should go to the kernel DSOS | ||
935 | */ | ||
936 | dsos__add(&map->groups->machine->kernel_dsos, | ||
937 | curr_dso); | ||
920 | dso__set_loaded(curr_dso, map->type); | 938 | dso__set_loaded(curr_dso, map->type); |
921 | } else | 939 | } else |
922 | curr_dso = curr_map->dso; | 940 | curr_dso = curr_map->dso; |
@@ -938,9 +956,12 @@ new_symbol: | |||
938 | * DWARF DW_compile_unit has this, but we don't always have access | 956 | * DWARF DW_compile_unit has this, but we don't always have access |
939 | * to it... | 957 | * to it... |
940 | */ | 958 | */ |
941 | if (symbol_conf.demangle) { | 959 | if (want_demangle(dso->kernel || kmodule)) { |
942 | demangled = bfd_demangle(NULL, elf_name, | 960 | int demangle_flags = DMGL_NO_OPTS; |
943 | DMGL_PARAMS | DMGL_ANSI); | 961 | if (verbose) |
962 | demangle_flags = DMGL_PARAMS | DMGL_ANSI; | ||
963 | |||
964 | demangled = bfd_demangle(NULL, elf_name, demangle_flags); | ||
944 | if (demangled != NULL) | 965 | if (demangled != NULL) |
945 | elf_name = demangled; | 966 | elf_name = demangled; |
946 | } | 967 | } |