diff options
| author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-09-01 18:25:52 -0400 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-09-05 10:14:50 -0400 |
| commit | be39db9f2932f0ce4e116c71ba5ae2b542e536a7 (patch) | |
| tree | ea3887e9487c3c3955657af77988b563b0fd9039 /tools | |
| parent | c79c809197bf4faaf109d1a7bdc27ecedac375de (diff) | |
perf symbols: Remove symbol_filter_t machinery
We're not using it anymore, few users were, but we really could do
without it, simplify lots of functions by removing it.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-1zng8wdznn00iiz08bb7q3vn@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/perf/arch/powerpc/util/sym-handling.c | 2 | ||||
| -rw-r--r-- | tools/perf/builtin-inject.c | 2 | ||||
| -rw-r--r-- | tools/perf/builtin-kmem.c | 10 | ||||
| -rw-r--r-- | tools/perf/builtin-script.c | 4 | ||||
| -rw-r--r-- | tools/perf/tests/code-reading.c | 4 | ||||
| -rw-r--r-- | tools/perf/tests/vmlinux-kallsyms.c | 8 | ||||
| -rw-r--r-- | tools/perf/ui/browsers/annotate.c | 2 | ||||
| -rw-r--r-- | tools/perf/ui/browsers/map.c | 4 | ||||
| -rw-r--r-- | tools/perf/util/annotate.c | 2 | ||||
| -rw-r--r-- | tools/perf/util/event.c | 8 | ||||
| -rw-r--r-- | tools/perf/util/intel-bts.c | 2 | ||||
| -rw-r--r-- | tools/perf/util/intel-pt.c | 4 | ||||
| -rw-r--r-- | tools/perf/util/machine.c | 19 | ||||
| -rw-r--r-- | tools/perf/util/machine.h | 30 | ||||
| -rw-r--r-- | tools/perf/util/map.c | 37 | ||||
| -rw-r--r-- | tools/perf/util/map.h | 32 | ||||
| -rw-r--r-- | tools/perf/util/probe-event.c | 17 | ||||
| -rw-r--r-- | tools/perf/util/symbol-elf.c | 32 | ||||
| -rw-r--r-- | tools/perf/util/symbol-minimal.c | 4 | ||||
| -rw-r--r-- | tools/perf/util/symbol.c | 102 | ||||
| -rw-r--r-- | tools/perf/util/symbol.h | 18 |
21 files changed, 141 insertions, 202 deletions
diff --git a/tools/perf/arch/powerpc/util/sym-handling.c b/tools/perf/arch/powerpc/util/sym-handling.c index 35745a733100..ed9d5d15d5b6 100644 --- a/tools/perf/arch/powerpc/util/sym-handling.c +++ b/tools/perf/arch/powerpc/util/sym-handling.c | |||
| @@ -108,7 +108,7 @@ void arch__post_process_probe_trace_events(struct perf_probe_event *pev, | |||
| 108 | int i = 0; | 108 | int i = 0; |
| 109 | 109 | ||
| 110 | map = get_target_map(pev->target, pev->uprobes); | 110 | map = get_target_map(pev->target, pev->uprobes); |
| 111 | if (!map || map__load(map, NULL) < 0) | 111 | if (!map || map__load(map) < 0) |
| 112 | return; | 112 | return; |
| 113 | 113 | ||
| 114 | for (i = 0; i < ntevs; i++) { | 114 | for (i = 0; i < ntevs; i++) { |
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c index 73c1c4cc3600..b9bc7e39833a 100644 --- a/tools/perf/builtin-inject.c +++ b/tools/perf/builtin-inject.c | |||
| @@ -429,7 +429,7 @@ static int perf_event__inject_buildid(struct perf_tool *tool, | |||
| 429 | if (al.map != NULL) { | 429 | if (al.map != NULL) { |
| 430 | if (!al.map->dso->hit) { | 430 | if (!al.map->dso->hit) { |
| 431 | al.map->dso->hit = 1; | 431 | al.map->dso->hit = 1; |
| 432 | if (map__load(al.map, NULL) >= 0) { | 432 | if (map__load(al.map) >= 0) { |
| 433 | dso__inject_build_id(al.map->dso, tool, machine); | 433 | dso__inject_build_id(al.map->dso, tool, machine); |
| 434 | /* | 434 | /* |
| 435 | * If this fails, too bad, let the other side | 435 | * If this fails, too bad, let the other side |
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c index fdde1bd3e306..d426dcb18ce9 100644 --- a/tools/perf/builtin-kmem.c +++ b/tools/perf/builtin-kmem.c | |||
| @@ -330,7 +330,7 @@ static int build_alloc_func_list(void) | |||
| 330 | } | 330 | } |
| 331 | 331 | ||
| 332 | kernel_map = machine__kernel_map(machine); | 332 | kernel_map = machine__kernel_map(machine); |
| 333 | if (map__load(kernel_map, NULL) < 0) { | 333 | if (map__load(kernel_map) < 0) { |
| 334 | pr_err("cannot load kernel map\n"); | 334 | pr_err("cannot load kernel map\n"); |
| 335 | return -ENOENT; | 335 | return -ENOENT; |
| 336 | } | 336 | } |
| @@ -979,7 +979,7 @@ static void __print_slab_result(struct rb_root *root, | |||
| 979 | if (is_caller) { | 979 | if (is_caller) { |
| 980 | addr = data->call_site; | 980 | addr = data->call_site; |
| 981 | if (!raw_ip) | 981 | if (!raw_ip) |
| 982 | sym = machine__find_kernel_function(machine, addr, &map, NULL); | 982 | sym = machine__find_kernel_function(machine, addr, &map); |
| 983 | } else | 983 | } else |
| 984 | addr = data->ptr; | 984 | addr = data->ptr; |
| 985 | 985 | ||
| @@ -1043,8 +1043,7 @@ static void __print_page_alloc_result(struct perf_session *session, int n_lines) | |||
| 1043 | char *caller = buf; | 1043 | char *caller = buf; |
| 1044 | 1044 | ||
| 1045 | data = rb_entry(next, struct page_stat, node); | 1045 | data = rb_entry(next, struct page_stat, node); |
| 1046 | sym = machine__find_kernel_function(machine, data->callsite, | 1046 | sym = machine__find_kernel_function(machine, data->callsite, &map); |
| 1047 | &map, NULL); | ||
| 1048 | if (sym && sym->name) | 1047 | if (sym && sym->name) |
| 1049 | caller = sym->name; | 1048 | caller = sym->name; |
| 1050 | else | 1049 | else |
| @@ -1086,8 +1085,7 @@ static void __print_page_caller_result(struct perf_session *session, int n_lines | |||
| 1086 | char *caller = buf; | 1085 | char *caller = buf; |
| 1087 | 1086 | ||
| 1088 | data = rb_entry(next, struct page_stat, node); | 1087 | data = rb_entry(next, struct page_stat, node); |
| 1089 | sym = machine__find_kernel_function(machine, data->callsite, | 1088 | sym = machine__find_kernel_function(machine, data->callsite, &map); |
| 1090 | &map, NULL); | ||
| 1091 | if (sym && sym->name) | 1089 | if (sym && sym->name) |
| 1092 | caller = sym->name; | 1090 | caller = sym->name; |
| 1093 | else | 1091 | else |
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 6b3c8b0d3276..7228d141a789 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c | |||
| @@ -522,11 +522,11 @@ static void print_sample_brstacksym(struct perf_sample *sample, | |||
| 522 | 522 | ||
| 523 | thread__find_addr_map(thread, sample->cpumode, MAP__FUNCTION, from, &alf); | 523 | thread__find_addr_map(thread, sample->cpumode, MAP__FUNCTION, from, &alf); |
| 524 | if (alf.map) | 524 | if (alf.map) |
| 525 | alf.sym = map__find_symbol(alf.map, alf.addr, NULL); | 525 | alf.sym = map__find_symbol(alf.map, alf.addr); |
| 526 | 526 | ||
| 527 | thread__find_addr_map(thread, sample->cpumode, MAP__FUNCTION, to, &alt); | 527 | thread__find_addr_map(thread, sample->cpumode, MAP__FUNCTION, to, &alt); |
| 528 | if (alt.map) | 528 | if (alt.map) |
| 529 | alt.sym = map__find_symbol(alt.map, alt.addr, NULL); | 529 | alt.sym = map__find_symbol(alt.map, alt.addr); |
| 530 | 530 | ||
| 531 | symbol__fprintf_symname_offs(alf.sym, &alf, stdout); | 531 | symbol__fprintf_symname_offs(alf.sym, &alf, stdout); |
| 532 | putchar('/'); | 532 | putchar('/'); |
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c index 2af156a8d4e5..ff5bc6363a79 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c | |||
| @@ -263,7 +263,7 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode, | |||
| 263 | * Converting addresses for use by objdump requires more information. | 263 | * Converting addresses for use by objdump requires more information. |
| 264 | * map__load() does that. See map__rip_2objdump() for details. | 264 | * map__load() does that. See map__rip_2objdump() for details. |
| 265 | */ | 265 | */ |
| 266 | if (map__load(al.map, NULL)) | 266 | if (map__load(al.map)) |
| 267 | return -1; | 267 | return -1; |
| 268 | 268 | ||
| 269 | /* objdump struggles with kcore - try each map only once */ | 269 | /* objdump struggles with kcore - try each map only once */ |
| @@ -511,7 +511,7 @@ static int do_test_code_reading(bool try_kcore) | |||
| 511 | 511 | ||
| 512 | /* Load kernel map */ | 512 | /* Load kernel map */ |
| 513 | map = machine__kernel_map(machine); | 513 | map = machine__kernel_map(machine); |
| 514 | ret = map__load(map, NULL); | 514 | ret = map__load(map); |
| 515 | if (ret < 0) { | 515 | if (ret < 0) { |
| 516 | pr_debug("map__load failed\n"); | 516 | pr_debug("map__load failed\n"); |
| 517 | goto out_err; | 517 | goto out_err; |
diff --git a/tools/perf/tests/vmlinux-kallsyms.c b/tools/perf/tests/vmlinux-kallsyms.c index e6925d6400f2..a5082331f246 100644 --- a/tools/perf/tests/vmlinux-kallsyms.c +++ b/tools/perf/tests/vmlinux-kallsyms.c | |||
| @@ -54,7 +54,7 @@ int test__vmlinux_matches_kallsyms(int subtest __maybe_unused) | |||
| 54 | * be compacted against the list of modules found in the "vmlinux" | 54 | * be compacted against the list of modules found in the "vmlinux" |
| 55 | * code and with the one got from /proc/modules from the "kallsyms" code. | 55 | * code and with the one got from /proc/modules from the "kallsyms" code. |
| 56 | */ | 56 | */ |
| 57 | if (__machine__load_kallsyms(&kallsyms, "/proc/kallsyms", type, true, NULL) <= 0) { | 57 | if (__machine__load_kallsyms(&kallsyms, "/proc/kallsyms", type, true) <= 0) { |
| 58 | pr_debug("dso__load_kallsyms "); | 58 | pr_debug("dso__load_kallsyms "); |
| 59 | goto out; | 59 | goto out; |
| 60 | } | 60 | } |
| @@ -92,7 +92,7 @@ int test__vmlinux_matches_kallsyms(int subtest __maybe_unused) | |||
| 92 | * maps__reloc_vmlinux will notice and set proper ->[un]map_ip routines | 92 | * maps__reloc_vmlinux will notice and set proper ->[un]map_ip routines |
| 93 | * to fixup the symbols. | 93 | * to fixup the symbols. |
| 94 | */ | 94 | */ |
| 95 | if (machine__load_vmlinux_path(&vmlinux, type, NULL) <= 0) { | 95 | if (machine__load_vmlinux_path(&vmlinux, type) <= 0) { |
| 96 | pr_debug("Couldn't find a vmlinux that matches the kernel running on this machine, skipping test\n"); | 96 | pr_debug("Couldn't find a vmlinux that matches the kernel running on this machine, skipping test\n"); |
| 97 | err = TEST_SKIP; | 97 | err = TEST_SKIP; |
| 98 | goto out; | 98 | goto out; |
| @@ -118,7 +118,7 @@ int test__vmlinux_matches_kallsyms(int subtest __maybe_unused) | |||
| 118 | mem_end = vmlinux_map->unmap_ip(vmlinux_map, sym->end); | 118 | mem_end = vmlinux_map->unmap_ip(vmlinux_map, sym->end); |
| 119 | 119 | ||
| 120 | first_pair = machine__find_kernel_symbol(&kallsyms, type, | 120 | first_pair = machine__find_kernel_symbol(&kallsyms, type, |
| 121 | mem_start, NULL, NULL); | 121 | mem_start, NULL); |
| 122 | pair = first_pair; | 122 | pair = first_pair; |
| 123 | 123 | ||
| 124 | if (pair && UM(pair->start) == mem_start) { | 124 | if (pair && UM(pair->start) == mem_start) { |
| @@ -147,7 +147,7 @@ next_pair: | |||
| 147 | */ | 147 | */ |
| 148 | continue; | 148 | continue; |
| 149 | } else { | 149 | } else { |
| 150 | pair = machine__find_kernel_symbol_by_name(&kallsyms, type, sym->name, NULL, NULL); | 150 | pair = machine__find_kernel_symbol_by_name(&kallsyms, type, sym->name, NULL); |
| 151 | if (pair) { | 151 | if (pair) { |
| 152 | if (UM(pair->start) == mem_start) | 152 | if (UM(pair->start) == mem_start) |
| 153 | goto next_pair; | 153 | goto next_pair; |
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c index 2e2d10022355..4c18271c71c9 100644 --- a/tools/perf/ui/browsers/annotate.c +++ b/tools/perf/ui/browsers/annotate.c | |||
| @@ -495,7 +495,7 @@ static bool annotate_browser__callq(struct annotate_browser *browser, | |||
| 495 | if (!ins__is_call(dl->ins)) | 495 | if (!ins__is_call(dl->ins)) |
| 496 | return false; | 496 | return false; |
| 497 | 497 | ||
| 498 | if (map_groups__find_ams(&target, NULL) || | 498 | if (map_groups__find_ams(&target) || |
| 499 | map__rip_2objdump(target.map, target.map->map_ip(target.map, | 499 | map__rip_2objdump(target.map, target.map->map_ip(target.map, |
| 500 | target.addr)) != | 500 | target.addr)) != |
| 501 | dl->ops.target.addr) { | 501 | dl->ops.target.addr) { |
diff --git a/tools/perf/ui/browsers/map.c b/tools/perf/ui/browsers/map.c index 80912778bb6d..98a34664bb7e 100644 --- a/tools/perf/ui/browsers/map.c +++ b/tools/perf/ui/browsers/map.c | |||
| @@ -52,9 +52,9 @@ static int map_browser__search(struct map_browser *browser) | |||
| 52 | 52 | ||
| 53 | if (target[0] == '0' && tolower(target[1]) == 'x') { | 53 | if (target[0] == '0' && tolower(target[1]) == 'x') { |
| 54 | u64 addr = strtoull(target, NULL, 16); | 54 | u64 addr = strtoull(target, NULL, 16); |
| 55 | sym = map__find_symbol(browser->map, addr, NULL); | 55 | sym = map__find_symbol(browser->map, addr); |
| 56 | } else | 56 | } else |
| 57 | sym = map__find_symbol_by_name(browser->map, target, NULL); | 57 | sym = map__find_symbol_by_name(browser->map, target); |
| 58 | 58 | ||
| 59 | if (sym != NULL) { | 59 | if (sym != NULL) { |
| 60 | u32 *idx = symbol__browser_index(sym); | 60 | u32 *idx = symbol__browser_index(sym); |
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 1b59e3129216..2ff6bd74e435 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
| @@ -1077,7 +1077,7 @@ static int symbol__parse_objdump_line(struct symbol *sym, struct map *map, | |||
| 1077 | .addr = dl->ops.target.addr, | 1077 | .addr = dl->ops.target.addr, |
| 1078 | }; | 1078 | }; |
| 1079 | 1079 | ||
| 1080 | if (!map_groups__find_ams(&target, NULL) && | 1080 | if (!map_groups__find_ams(&target) && |
| 1081 | target.sym->start == target.al_addr) | 1081 | target.sym->start == target.al_addr) |
| 1082 | dl->ops.target.name = strdup(target.sym->name); | 1082 | dl->ops.target.name = strdup(target.sym->name); |
| 1083 | } | 1083 | } |
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 2f91183f2779..9ad7d32dba2b 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
| @@ -1286,7 +1286,7 @@ try_again: | |||
| 1286 | * must be done prior to using kernel maps. | 1286 | * must be done prior to using kernel maps. |
| 1287 | */ | 1287 | */ |
| 1288 | if (load_map) | 1288 | if (load_map) |
| 1289 | map__load(al->map, NULL); | 1289 | map__load(al->map); |
| 1290 | al->addr = al->map->map_ip(al->map, al->addr); | 1290 | al->addr = al->map->map_ip(al->map, al->addr); |
| 1291 | } | 1291 | } |
| 1292 | } | 1292 | } |
| @@ -1297,7 +1297,7 @@ void thread__find_addr_location(struct thread *thread, | |||
| 1297 | { | 1297 | { |
| 1298 | thread__find_addr_map(thread, cpumode, type, addr, al); | 1298 | thread__find_addr_map(thread, cpumode, type, addr, al); |
| 1299 | if (al->map != NULL) | 1299 | if (al->map != NULL) |
| 1300 | al->sym = map__find_symbol(al->map, al->addr, NULL); | 1300 | al->sym = map__find_symbol(al->map, al->addr); |
| 1301 | else | 1301 | else |
| 1302 | al->sym = NULL; | 1302 | al->sym = NULL; |
| 1303 | } | 1303 | } |
| @@ -1358,7 +1358,7 @@ int machine__resolve(struct machine *machine, struct addr_location *al, | |||
| 1358 | al->filtered |= (1 << HIST_FILTER__DSO); | 1358 | al->filtered |= (1 << HIST_FILTER__DSO); |
| 1359 | } | 1359 | } |
| 1360 | 1360 | ||
| 1361 | al->sym = map__find_symbol(al->map, al->addr, NULL); | 1361 | al->sym = map__find_symbol(al->map, al->addr); |
| 1362 | } | 1362 | } |
| 1363 | 1363 | ||
| 1364 | if (symbol_conf.sym_list && | 1364 | if (symbol_conf.sym_list && |
| @@ -1414,5 +1414,5 @@ void thread__resolve(struct thread *thread, struct addr_location *al, | |||
| 1414 | al->sym = NULL; | 1414 | al->sym = NULL; |
| 1415 | 1415 | ||
| 1416 | if (al->map) | 1416 | if (al->map) |
| 1417 | al->sym = map__find_symbol(al->map, al->addr, NULL); | 1417 | al->sym = map__find_symbol(al->map, al->addr); |
| 1418 | } | 1418 | } |
diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c index 240b095eddba..f545ec1e758a 100644 --- a/tools/perf/util/intel-bts.c +++ b/tools/perf/util/intel-bts.c | |||
| @@ -346,7 +346,7 @@ static int intel_bts_get_next_insn(struct intel_bts_queue *btsq, u64 ip) | |||
| 346 | goto out_put; | 346 | goto out_put; |
| 347 | 347 | ||
| 348 | /* Load maps to ensure dso->is_64_bit has been updated */ | 348 | /* Load maps to ensure dso->is_64_bit has been updated */ |
| 349 | map__load(al.map, NULL); | 349 | map__load(al.map); |
| 350 | 350 | ||
| 351 | x86_64 = al.map->dso->is_64_bit; | 351 | x86_64 = al.map->dso->is_64_bit; |
| 352 | 352 | ||
diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c index d594052c8184..b9cc353cace2 100644 --- a/tools/perf/util/intel-pt.c +++ b/tools/perf/util/intel-pt.c | |||
| @@ -477,7 +477,7 @@ static int intel_pt_walk_next_insn(struct intel_pt_insn *intel_pt_insn, | |||
| 477 | start_ip = *ip; | 477 | start_ip = *ip; |
| 478 | 478 | ||
| 479 | /* Load maps to ensure dso->is_64_bit has been updated */ | 479 | /* Load maps to ensure dso->is_64_bit has been updated */ |
| 480 | map__load(al.map, NULL); | 480 | map__load(al.map); |
| 481 | 481 | ||
| 482 | x86_64 = al.map->dso->is_64_bit; | 482 | x86_64 = al.map->dso->is_64_bit; |
| 483 | 483 | ||
| @@ -1294,7 +1294,7 @@ static u64 intel_pt_switch_ip(struct intel_pt *pt, u64 *ptss_ip) | |||
| 1294 | if (!map) | 1294 | if (!map) |
| 1295 | return 0; | 1295 | return 0; |
| 1296 | 1296 | ||
| 1297 | if (map__load(map, NULL)) | 1297 | if (map__load(map)) |
| 1298 | return 0; | 1298 | return 0; |
| 1299 | 1299 | ||
| 1300 | start = dso__first_symbol(map->dso, MAP__FUNCTION); | 1300 | start = dso__first_symbol(map->dso, MAP__FUNCTION); |
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 7940ddc98f8c..18e4519abef2 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
| @@ -897,10 +897,10 @@ int machines__create_kernel_maps(struct machines *machines, pid_t pid) | |||
| 897 | } | 897 | } |
| 898 | 898 | ||
| 899 | int __machine__load_kallsyms(struct machine *machine, const char *filename, | 899 | int __machine__load_kallsyms(struct machine *machine, const char *filename, |
| 900 | enum map_type type, bool no_kcore, symbol_filter_t filter) | 900 | enum map_type type, bool no_kcore) |
| 901 | { | 901 | { |
| 902 | struct map *map = machine__kernel_map(machine); | 902 | struct map *map = machine__kernel_map(machine); |
| 903 | int ret = __dso__load_kallsyms(map->dso, filename, map, no_kcore, filter); | 903 | int ret = __dso__load_kallsyms(map->dso, filename, map, no_kcore); |
| 904 | 904 | ||
| 905 | if (ret > 0) { | 905 | if (ret > 0) { |
| 906 | dso__set_loaded(map->dso, type); | 906 | dso__set_loaded(map->dso, type); |
| @@ -916,16 +916,15 @@ int __machine__load_kallsyms(struct machine *machine, const char *filename, | |||
| 916 | } | 916 | } |
| 917 | 917 | ||
| 918 | int machine__load_kallsyms(struct machine *machine, const char *filename, | 918 | int machine__load_kallsyms(struct machine *machine, const char *filename, |
| 919 | enum map_type type, symbol_filter_t filter) | 919 | enum map_type type) |
| 920 | { | 920 | { |
| 921 | return __machine__load_kallsyms(machine, filename, type, false, filter); | 921 | return __machine__load_kallsyms(machine, filename, type, false); |
| 922 | } | 922 | } |
| 923 | 923 | ||
| 924 | int machine__load_vmlinux_path(struct machine *machine, enum map_type type, | 924 | int machine__load_vmlinux_path(struct machine *machine, enum map_type type) |
| 925 | symbol_filter_t filter) | ||
| 926 | { | 925 | { |
| 927 | struct map *map = machine__kernel_map(machine); | 926 | struct map *map = machine__kernel_map(machine); |
| 928 | int ret = dso__load_vmlinux_path(map->dso, map, filter); | 927 | int ret = dso__load_vmlinux_path(map->dso, map); |
| 929 | 928 | ||
| 930 | if (ret > 0) | 929 | if (ret > 0) |
| 931 | dso__set_loaded(map->dso, type); | 930 | dso__set_loaded(map->dso, type); |
| @@ -1294,7 +1293,7 @@ static int machine__process_kernel_mmap_event(struct machine *machine, | |||
| 1294 | /* | 1293 | /* |
| 1295 | * preload dso of guest kernel and modules | 1294 | * preload dso of guest kernel and modules |
| 1296 | */ | 1295 | */ |
| 1297 | dso__load(kernel, machine__kernel_map(machine), NULL); | 1296 | dso__load(kernel, machine__kernel_map(machine)); |
| 1298 | } | 1297 | } |
| 1299 | } | 1298 | } |
| 1300 | return 0; | 1299 | return 0; |
| @@ -2096,7 +2095,7 @@ int machine__get_kernel_start(struct machine *machine) | |||
| 2096 | */ | 2095 | */ |
| 2097 | machine->kernel_start = 1ULL << 63; | 2096 | machine->kernel_start = 1ULL << 63; |
| 2098 | if (map) { | 2097 | if (map) { |
| 2099 | err = map__load(map, NULL); | 2098 | err = map__load(map); |
| 2100 | if (map->start) | 2099 | if (map->start) |
| 2101 | machine->kernel_start = map->start; | 2100 | machine->kernel_start = map->start; |
| 2102 | } | 2101 | } |
| @@ -2112,7 +2111,7 @@ char *machine__resolve_kernel_addr(void *vmachine, unsigned long long *addrp, ch | |||
| 2112 | { | 2111 | { |
| 2113 | struct machine *machine = vmachine; | 2112 | struct machine *machine = vmachine; |
| 2114 | struct map *map; | 2113 | struct map *map; |
| 2115 | struct symbol *sym = map_groups__find_symbol(&machine->kmaps, MAP__FUNCTION, *addrp, &map, NULL); | 2114 | struct symbol *sym = map_groups__find_symbol(&machine->kmaps, MAP__FUNCTION, *addrp, &map); |
| 2116 | 2115 | ||
| 2117 | if (sym == NULL) | 2116 | if (sym == NULL) |
| 2118 | return NULL; | 2117 | return NULL; |
diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h index b9e5588499c5..354de6e56109 100644 --- a/tools/perf/util/machine.h +++ b/tools/perf/util/machine.h | |||
| @@ -174,40 +174,33 @@ size_t machine__fprintf(struct machine *machine, FILE *fp); | |||
| 174 | static inline | 174 | static inline |
| 175 | struct symbol *machine__find_kernel_symbol(struct machine *machine, | 175 | struct symbol *machine__find_kernel_symbol(struct machine *machine, |
| 176 | enum map_type type, u64 addr, | 176 | enum map_type type, u64 addr, |
| 177 | struct map **mapp, | 177 | struct map **mapp) |
| 178 | symbol_filter_t filter) | ||
| 179 | { | 178 | { |
| 180 | return map_groups__find_symbol(&machine->kmaps, type, addr, | 179 | return map_groups__find_symbol(&machine->kmaps, type, addr, mapp); |
| 181 | mapp, filter); | ||
| 182 | } | 180 | } |
| 183 | 181 | ||
| 184 | static inline | 182 | static inline |
| 185 | struct symbol *machine__find_kernel_symbol_by_name(struct machine *machine, | 183 | struct symbol *machine__find_kernel_symbol_by_name(struct machine *machine, |
| 186 | enum map_type type, const char *name, | 184 | enum map_type type, const char *name, |
| 187 | struct map **mapp, | 185 | struct map **mapp) |
| 188 | symbol_filter_t filter) | ||
| 189 | { | 186 | { |
| 190 | return map_groups__find_symbol_by_name(&machine->kmaps, type, name, | 187 | return map_groups__find_symbol_by_name(&machine->kmaps, type, name, mapp); |
| 191 | mapp, filter); | ||
| 192 | } | 188 | } |
| 193 | 189 | ||
| 194 | static inline | 190 | static inline |
| 195 | struct symbol *machine__find_kernel_function(struct machine *machine, u64 addr, | 191 | struct symbol *machine__find_kernel_function(struct machine *machine, u64 addr, |
| 196 | struct map **mapp, | 192 | struct map **mapp) |
| 197 | symbol_filter_t filter) | ||
| 198 | { | 193 | { |
| 199 | return machine__find_kernel_symbol(machine, MAP__FUNCTION, addr, | 194 | return machine__find_kernel_symbol(machine, MAP__FUNCTION, addr, |
| 200 | mapp, filter); | 195 | mapp); |
| 201 | } | 196 | } |
| 202 | 197 | ||
| 203 | static inline | 198 | static inline |
| 204 | struct symbol *machine__find_kernel_function_by_name(struct machine *machine, | 199 | struct symbol *machine__find_kernel_function_by_name(struct machine *machine, |
| 205 | const char *name, | 200 | const char *name, |
| 206 | struct map **mapp, | 201 | struct map **mapp) |
| 207 | symbol_filter_t filter) | ||
| 208 | { | 202 | { |
| 209 | return map_groups__find_function_by_name(&machine->kmaps, name, mapp, | 203 | return map_groups__find_function_by_name(&machine->kmaps, name, mapp); |
| 210 | filter); | ||
| 211 | } | 204 | } |
| 212 | 205 | ||
| 213 | struct map *machine__findnew_module_map(struct machine *machine, u64 start, | 206 | struct map *machine__findnew_module_map(struct machine *machine, u64 start, |
| @@ -215,11 +208,10 @@ struct map *machine__findnew_module_map(struct machine *machine, u64 start, | |||
| 215 | int arch__fix_module_text_start(u64 *start, const char *name); | 208 | int arch__fix_module_text_start(u64 *start, const char *name); |
| 216 | 209 | ||
| 217 | int __machine__load_kallsyms(struct machine *machine, const char *filename, | 210 | int __machine__load_kallsyms(struct machine *machine, const char *filename, |
| 218 | enum map_type type, bool no_kcore, symbol_filter_t filter); | 211 | enum map_type type, bool no_kcore); |
| 219 | int machine__load_kallsyms(struct machine *machine, const char *filename, | 212 | int machine__load_kallsyms(struct machine *machine, const char *filename, |
| 220 | enum map_type type, symbol_filter_t filter); | 213 | enum map_type type); |
| 221 | int machine__load_vmlinux_path(struct machine *machine, enum map_type type, | 214 | int machine__load_vmlinux_path(struct machine *machine, enum map_type type); |
| 222 | symbol_filter_t filter); | ||
| 223 | 215 | ||
| 224 | size_t machine__fprintf_dsos_buildid(struct machine *machine, FILE *fp, | 216 | size_t machine__fprintf_dsos_buildid(struct machine *machine, FILE *fp, |
| 225 | bool (skip)(struct dso *dso, int parm), int parm); | 217 | bool (skip)(struct dso *dso, int parm), int parm); |
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index 728129ac653a..0c54adb07ae9 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c | |||
| @@ -279,7 +279,7 @@ void map__fixup_end(struct map *map) | |||
| 279 | 279 | ||
| 280 | #define DSO__DELETED "(deleted)" | 280 | #define DSO__DELETED "(deleted)" |
| 281 | 281 | ||
| 282 | int map__load(struct map *map, symbol_filter_t filter) | 282 | int map__load(struct map *map) |
| 283 | { | 283 | { |
| 284 | const char *name = map->dso->long_name; | 284 | const char *name = map->dso->long_name; |
| 285 | int nr; | 285 | int nr; |
| @@ -287,7 +287,7 @@ int map__load(struct map *map, symbol_filter_t filter) | |||
| 287 | if (dso__loaded(map->dso, map->type)) | 287 | if (dso__loaded(map->dso, map->type)) |
| 288 | return 0; | 288 | return 0; |
| 289 | 289 | ||
| 290 | nr = dso__load(map->dso, map, filter); | 290 | nr = dso__load(map->dso, map); |
| 291 | if (nr < 0) { | 291 | if (nr < 0) { |
| 292 | if (map->dso->has_build_id) { | 292 | if (map->dso->has_build_id) { |
| 293 | char sbuild_id[SBUILD_ID_SIZE]; | 293 | char sbuild_id[SBUILD_ID_SIZE]; |
| @@ -312,9 +312,6 @@ int map__load(struct map *map, symbol_filter_t filter) | |||
| 312 | pr_warning("%.*s was updated (is prelink enabled?). " | 312 | pr_warning("%.*s was updated (is prelink enabled?). " |
| 313 | "Restart the long running apps that use it!\n", | 313 | "Restart the long running apps that use it!\n", |
| 314 | (int)real_len, name); | 314 | (int)real_len, name); |
| 315 | } else if (filter) { | ||
| 316 | pr_warning("no symbols passed the given filter.\n"); | ||
| 317 | return -2; /* Empty but maybe by the filter */ | ||
| 318 | } else { | 315 | } else { |
| 319 | pr_warning("no symbols found in %s, maybe install " | 316 | pr_warning("no symbols found in %s, maybe install " |
| 320 | "a debug package?\n", name); | 317 | "a debug package?\n", name); |
| @@ -331,19 +328,17 @@ int __weak arch__compare_symbol_names(const char *namea, const char *nameb) | |||
| 331 | return strcmp(namea, nameb); | 328 | return strcmp(namea, nameb); |
| 332 | } | 329 | } |
| 333 | 330 | ||
| 334 | struct symbol *map__find_symbol(struct map *map, u64 addr, | 331 | struct symbol *map__find_symbol(struct map *map, u64 addr) |
| 335 | symbol_filter_t filter) | ||
| 336 | { | 332 | { |
| 337 | if (map__load(map, filter) < 0) | 333 | if (map__load(map) < 0) |
| 338 | return NULL; | 334 | return NULL; |
| 339 | 335 | ||
| 340 | return dso__find_symbol(map->dso, map->type, addr); | 336 | return dso__find_symbol(map->dso, map->type, addr); |
| 341 | } | 337 | } |
| 342 | 338 | ||
| 343 | struct symbol *map__find_symbol_by_name(struct map *map, const char *name, | 339 | struct symbol *map__find_symbol_by_name(struct map *map, const char *name) |
| 344 | symbol_filter_t filter) | ||
| 345 | { | 340 | { |
| 346 | if (map__load(map, filter) < 0) | 341 | if (map__load(map) < 0) |
| 347 | return NULL; | 342 | return NULL; |
| 348 | 343 | ||
| 349 | if (!dso__sorted_by_name(map->dso, map->type)) | 344 | if (!dso__sorted_by_name(map->dso, map->type)) |
| @@ -556,23 +551,22 @@ void map_groups__put(struct map_groups *mg) | |||
| 556 | 551 | ||
| 557 | struct symbol *map_groups__find_symbol(struct map_groups *mg, | 552 | struct symbol *map_groups__find_symbol(struct map_groups *mg, |
| 558 | enum map_type type, u64 addr, | 553 | enum map_type type, u64 addr, |
| 559 | struct map **mapp, | 554 | struct map **mapp) |
| 560 | symbol_filter_t filter) | ||
| 561 | { | 555 | { |
| 562 | struct map *map = map_groups__find(mg, type, addr); | 556 | struct map *map = map_groups__find(mg, type, addr); |
| 563 | 557 | ||
| 564 | /* Ensure map is loaded before using map->map_ip */ | 558 | /* Ensure map is loaded before using map->map_ip */ |
| 565 | if (map != NULL && map__load(map, filter) >= 0) { | 559 | if (map != NULL && map__load(map) >= 0) { |
| 566 | if (mapp != NULL) | 560 | if (mapp != NULL) |
| 567 | *mapp = map; | 561 | *mapp = map; |
| 568 | return map__find_symbol(map, map->map_ip(map, addr), filter); | 562 | return map__find_symbol(map, map->map_ip(map, addr)); |
| 569 | } | 563 | } |
| 570 | 564 | ||
| 571 | return NULL; | 565 | return NULL; |
| 572 | } | 566 | } |
| 573 | 567 | ||
| 574 | struct symbol *maps__find_symbol_by_name(struct maps *maps, const char *name, | 568 | struct symbol *maps__find_symbol_by_name(struct maps *maps, const char *name, |
| 575 | struct map **mapp, symbol_filter_t filter) | 569 | struct map **mapp) |
| 576 | { | 570 | { |
| 577 | struct symbol *sym; | 571 | struct symbol *sym; |
| 578 | struct rb_node *nd; | 572 | struct rb_node *nd; |
| @@ -582,7 +576,7 @@ struct symbol *maps__find_symbol_by_name(struct maps *maps, const char *name, | |||
| 582 | for (nd = rb_first(&maps->entries); nd; nd = rb_next(nd)) { | 576 | for (nd = rb_first(&maps->entries); nd; nd = rb_next(nd)) { |
| 583 | struct map *pos = rb_entry(nd, struct map, rb_node); | 577 | struct map *pos = rb_entry(nd, struct map, rb_node); |
| 584 | 578 | ||
| 585 | sym = map__find_symbol_by_name(pos, name, filter); | 579 | sym = map__find_symbol_by_name(pos, name); |
| 586 | 580 | ||
| 587 | if (sym == NULL) | 581 | if (sym == NULL) |
| 588 | continue; | 582 | continue; |
| @@ -600,15 +594,14 @@ out: | |||
| 600 | struct symbol *map_groups__find_symbol_by_name(struct map_groups *mg, | 594 | struct symbol *map_groups__find_symbol_by_name(struct map_groups *mg, |
| 601 | enum map_type type, | 595 | enum map_type type, |
| 602 | const char *name, | 596 | const char *name, |
| 603 | struct map **mapp, | 597 | struct map **mapp) |
| 604 | symbol_filter_t filter) | ||
| 605 | { | 598 | { |
| 606 | struct symbol *sym = maps__find_symbol_by_name(&mg->maps[type], name, mapp, filter); | 599 | struct symbol *sym = maps__find_symbol_by_name(&mg->maps[type], name, mapp); |
| 607 | 600 | ||
| 608 | return sym; | 601 | return sym; |
| 609 | } | 602 | } |
| 610 | 603 | ||
| 611 | int map_groups__find_ams(struct addr_map_symbol *ams, symbol_filter_t filter) | 604 | int map_groups__find_ams(struct addr_map_symbol *ams) |
| 612 | { | 605 | { |
| 613 | if (ams->addr < ams->map->start || ams->addr >= ams->map->end) { | 606 | if (ams->addr < ams->map->start || ams->addr >= ams->map->end) { |
| 614 | if (ams->map->groups == NULL) | 607 | if (ams->map->groups == NULL) |
| @@ -620,7 +613,7 @@ int map_groups__find_ams(struct addr_map_symbol *ams, symbol_filter_t filter) | |||
| 620 | } | 613 | } |
| 621 | 614 | ||
| 622 | ams->al_addr = ams->map->map_ip(ams->map, ams->addr); | 615 | ams->al_addr = ams->map->map_ip(ams->map, ams->addr); |
| 623 | ams->sym = map__find_symbol(ams->map, ams->al_addr, filter); | 616 | ams->sym = map__find_symbol(ams->map, ams->al_addr); |
| 624 | 617 | ||
| 625 | return ams->sym ? 0 : -1; | 618 | return ams->sym ? 0 : -1; |
| 626 | } | 619 | } |
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h index d83396ceecba..abdacf800c98 100644 --- a/tools/perf/util/map.h +++ b/tools/perf/util/map.h | |||
| @@ -127,17 +127,14 @@ struct thread; | |||
| 127 | * @map: the 'struct map *' in which symbols itereated | 127 | * @map: the 'struct map *' in which symbols itereated |
| 128 | * @sym_name: the symbol name | 128 | * @sym_name: the symbol name |
| 129 | * @pos: the 'struct symbol *' to use as a loop cursor | 129 | * @pos: the 'struct symbol *' to use as a loop cursor |
| 130 | * @filter: to use when loading the DSO | ||
| 131 | */ | 130 | */ |
| 132 | #define __map__for_each_symbol_by_name(map, sym_name, pos, filter) \ | 131 | #define __map__for_each_symbol_by_name(map, sym_name, pos) \ |
| 133 | for (pos = map__find_symbol_by_name(map, sym_name, filter); \ | 132 | for (pos = map__find_symbol_by_name(map, sym_name); \ |
| 134 | pos && arch__compare_symbol_names(pos->name, sym_name) == 0; \ | 133 | pos && arch__compare_symbol_names(pos->name, sym_name) == 0; \ |
| 135 | pos = symbol__next_by_name(pos)) | 134 | pos = symbol__next_by_name(pos)) |
| 136 | 135 | ||
| 137 | #define map__for_each_symbol_by_name(map, sym_name, pos) \ | 136 | #define map__for_each_symbol_by_name(map, sym_name, pos) \ |
| 138 | __map__for_each_symbol_by_name(map, sym_name, (pos), NULL) | 137 | __map__for_each_symbol_by_name(map, sym_name, (pos)) |
| 139 | |||
| 140 | typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym); | ||
| 141 | 138 | ||
| 142 | int arch__compare_symbol_names(const char *namea, const char *nameb); | 139 | int arch__compare_symbol_names(const char *namea, const char *nameb); |
| 143 | void map__init(struct map *map, enum map_type type, | 140 | void map__init(struct map *map, enum map_type type, |
| @@ -173,11 +170,9 @@ size_t map__fprintf_dsoname(struct map *map, FILE *fp); | |||
| 173 | int map__fprintf_srcline(struct map *map, u64 addr, const char *prefix, | 170 | int map__fprintf_srcline(struct map *map, u64 addr, const char *prefix, |
| 174 | FILE *fp); | 171 | FILE *fp); |
| 175 | 172 | ||
| 176 | int map__load(struct map *map, symbol_filter_t filter); | 173 | int map__load(struct map *map); |
| 177 | struct symbol *map__find_symbol(struct map *map, | 174 | struct symbol *map__find_symbol(struct map *map, u64 addr); |
| 178 | u64 addr, symbol_filter_t filter); | 175 | struct symbol *map__find_symbol_by_name(struct map *map, const char *name); |
| 179 | struct symbol *map__find_symbol_by_name(struct map *map, const char *name, | ||
| 180 | symbol_filter_t filter); | ||
| 181 | void map__fixup_start(struct map *map); | 176 | void map__fixup_start(struct map *map); |
| 182 | void map__fixup_end(struct map *map); | 177 | void map__fixup_end(struct map *map); |
| 183 | 178 | ||
| @@ -191,7 +186,7 @@ struct map *maps__find(struct maps *maps, u64 addr); | |||
| 191 | struct map *maps__first(struct maps *maps); | 186 | struct map *maps__first(struct maps *maps); |
| 192 | struct map *map__next(struct map *map); | 187 | struct map *map__next(struct map *map); |
| 193 | struct symbol *maps__find_symbol_by_name(struct maps *maps, const char *name, | 188 | struct symbol *maps__find_symbol_by_name(struct maps *maps, const char *name, |
| 194 | struct map **mapp, symbol_filter_t filter); | 189 | struct map **mapp); |
| 195 | void map_groups__init(struct map_groups *mg, struct machine *machine); | 190 | void map_groups__init(struct map_groups *mg, struct machine *machine); |
| 196 | void map_groups__exit(struct map_groups *mg); | 191 | void map_groups__exit(struct map_groups *mg); |
| 197 | int map_groups__clone(struct thread *thread, | 192 | int map_groups__clone(struct thread *thread, |
| @@ -231,25 +226,22 @@ static inline struct map *map_groups__next(struct map *map) | |||
| 231 | 226 | ||
| 232 | struct symbol *map_groups__find_symbol(struct map_groups *mg, | 227 | struct symbol *map_groups__find_symbol(struct map_groups *mg, |
| 233 | enum map_type type, u64 addr, | 228 | enum map_type type, u64 addr, |
| 234 | struct map **mapp, | 229 | struct map **mapp); |
| 235 | symbol_filter_t filter); | ||
| 236 | 230 | ||
| 237 | struct symbol *map_groups__find_symbol_by_name(struct map_groups *mg, | 231 | struct symbol *map_groups__find_symbol_by_name(struct map_groups *mg, |
| 238 | enum map_type type, | 232 | enum map_type type, |
| 239 | const char *name, | 233 | const char *name, |
| 240 | struct map **mapp, | 234 | struct map **mapp); |
| 241 | symbol_filter_t filter); | ||
| 242 | 235 | ||
| 243 | struct addr_map_symbol; | 236 | struct addr_map_symbol; |
| 244 | 237 | ||
| 245 | int map_groups__find_ams(struct addr_map_symbol *ams, symbol_filter_t filter); | 238 | int map_groups__find_ams(struct addr_map_symbol *ams); |
| 246 | 239 | ||
| 247 | static inline | 240 | static inline |
| 248 | struct symbol *map_groups__find_function_by_name(struct map_groups *mg, | 241 | struct symbol *map_groups__find_function_by_name(struct map_groups *mg, |
| 249 | const char *name, struct map **mapp, | 242 | const char *name, struct map **mapp) |
| 250 | symbol_filter_t filter) | ||
| 251 | { | 243 | { |
| 252 | return map_groups__find_symbol_by_name(mg, MAP__FUNCTION, name, mapp, filter); | 244 | return map_groups__find_symbol_by_name(mg, MAP__FUNCTION, name, mapp); |
| 253 | } | 245 | } |
| 254 | 246 | ||
| 255 | int map_groups__fixup_overlappings(struct map_groups *mg, struct map *map, | 247 | int map_groups__fixup_overlappings(struct map_groups *mg, struct map *map, |
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index a543e9ca581c..bc60ce49720b 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
| @@ -110,13 +110,12 @@ void exit_probe_symbol_maps(void) | |||
| 110 | static struct symbol *__find_kernel_function_by_name(const char *name, | 110 | static struct symbol *__find_kernel_function_by_name(const char *name, |
| 111 | struct map **mapp) | 111 | struct map **mapp) |
| 112 | { | 112 | { |
| 113 | return machine__find_kernel_function_by_name(host_machine, name, mapp, | 113 | return machine__find_kernel_function_by_name(host_machine, name, mapp); |
| 114 | NULL); | ||
| 115 | } | 114 | } |
| 116 | 115 | ||
| 117 | static struct symbol *__find_kernel_function(u64 addr, struct map **mapp) | 116 | static struct symbol *__find_kernel_function(u64 addr, struct map **mapp) |
| 118 | { | 117 | { |
| 119 | return machine__find_kernel_function(host_machine, addr, mapp, NULL); | 118 | return machine__find_kernel_function(host_machine, addr, mapp); |
| 120 | } | 119 | } |
| 121 | 120 | ||
| 122 | static struct ref_reloc_sym *kernel_get_ref_reloc_sym(void) | 121 | static struct ref_reloc_sym *kernel_get_ref_reloc_sym(void) |
| @@ -125,7 +124,7 @@ static struct ref_reloc_sym *kernel_get_ref_reloc_sym(void) | |||
| 125 | struct kmap *kmap; | 124 | struct kmap *kmap; |
| 126 | struct map *map = machine__kernel_map(host_machine); | 125 | struct map *map = machine__kernel_map(host_machine); |
| 127 | 126 | ||
| 128 | if (map__load(map, NULL) < 0) | 127 | if (map__load(map) < 0) |
| 129 | return NULL; | 128 | return NULL; |
| 130 | 129 | ||
| 131 | kmap = map__kmap(map); | 130 | kmap = map__kmap(map); |
| @@ -351,9 +350,9 @@ static int kernel_get_module_dso(const char *module, struct dso **pdso) | |||
| 351 | vmlinux_name = symbol_conf.vmlinux_name; | 350 | vmlinux_name = symbol_conf.vmlinux_name; |
| 352 | dso->load_errno = 0; | 351 | dso->load_errno = 0; |
| 353 | if (vmlinux_name) | 352 | if (vmlinux_name) |
| 354 | ret = dso__load_vmlinux(dso, map, vmlinux_name, false, NULL); | 353 | ret = dso__load_vmlinux(dso, map, vmlinux_name, false); |
| 355 | else | 354 | else |
| 356 | ret = dso__load_vmlinux_path(dso, map, NULL); | 355 | ret = dso__load_vmlinux_path(dso, map); |
| 357 | found: | 356 | found: |
| 358 | *pdso = dso; | 357 | *pdso = dso; |
| 359 | return ret; | 358 | return ret; |
| @@ -1999,7 +1998,7 @@ static int find_perf_probe_point_from_map(struct probe_trace_point *tp, | |||
| 1999 | map = dso__new_map(tp->module); | 1998 | map = dso__new_map(tp->module); |
| 2000 | if (!map) | 1999 | if (!map) |
| 2001 | goto out; | 2000 | goto out; |
| 2002 | sym = map__find_symbol(map, addr, NULL); | 2001 | sym = map__find_symbol(map, addr); |
| 2003 | } else { | 2002 | } else { |
| 2004 | if (tp->symbol && !addr) { | 2003 | if (tp->symbol && !addr) { |
| 2005 | if (kernel_get_symbol_address_by_name(tp->symbol, | 2004 | if (kernel_get_symbol_address_by_name(tp->symbol, |
| @@ -2704,7 +2703,7 @@ static int find_probe_functions(struct map *map, char *name, | |||
| 2704 | struct symbol *sym; | 2703 | struct symbol *sym; |
| 2705 | struct rb_node *tmp; | 2704 | struct rb_node *tmp; |
| 2706 | 2705 | ||
| 2707 | if (map__load(map, NULL) < 0) | 2706 | if (map__load(map) < 0) |
| 2708 | return 0; | 2707 | return 0; |
| 2709 | 2708 | ||
| 2710 | map__for_each_symbol(map, sym, tmp) { | 2709 | map__for_each_symbol(map, sym, tmp) { |
| @@ -3368,7 +3367,7 @@ int show_available_funcs(const char *target, struct strfilter *_filter, | |||
| 3368 | return -EINVAL; | 3367 | return -EINVAL; |
| 3369 | } | 3368 | } |
| 3370 | 3369 | ||
| 3371 | ret = map__load(map, NULL); | 3370 | ret = map__load(map); |
| 3372 | if (ret) { | 3371 | if (ret) { |
| 3373 | if (ret == -2) { | 3372 | if (ret == -2) { |
| 3374 | char *str = strfilter__string(_filter); | 3373 | char *str = strfilter__string(_filter); |
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index bd91a4f67080..99400b0e8f2a 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c | |||
| @@ -254,8 +254,7 @@ static char *demangle_sym(struct dso *dso, int kmodule, const char *elf_name) | |||
| 254 | * And always look at the original dso, not at debuginfo packages, that | 254 | * And always look at the original dso, not at debuginfo packages, that |
| 255 | * have the PLT data stripped out (shdr_rel_plt.sh_type == SHT_NOBITS). | 255 | * have the PLT data stripped out (shdr_rel_plt.sh_type == SHT_NOBITS). |
| 256 | */ | 256 | */ |
| 257 | int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss, struct map *map, | 257 | int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss, struct map *map) |
| 258 | symbol_filter_t filter) | ||
| 259 | { | 258 | { |
| 260 | uint32_t nr_rel_entries, idx; | 259 | uint32_t nr_rel_entries, idx; |
| 261 | GElf_Sym sym; | 260 | GElf_Sym sym; |
| @@ -351,12 +350,8 @@ int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss, struct map * | |||
| 351 | if (!f) | 350 | if (!f) |
| 352 | goto out_elf_end; | 351 | goto out_elf_end; |
| 353 | 352 | ||
| 354 | if (filter && filter(map, f)) | 353 | symbols__insert(&dso->symbols[map->type], f); |
| 355 | symbol__delete(f); | 354 | ++nr; |
| 356 | else { | ||
| 357 | symbols__insert(&dso->symbols[map->type], f); | ||
| 358 | ++nr; | ||
| 359 | } | ||
| 360 | } | 355 | } |
| 361 | } else if (shdr_rel_plt.sh_type == SHT_REL) { | 356 | } else if (shdr_rel_plt.sh_type == SHT_REL) { |
| 362 | GElf_Rel pos_mem, *pos; | 357 | GElf_Rel pos_mem, *pos; |
| @@ -381,12 +376,8 @@ int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss, struct map * | |||
| 381 | if (!f) | 376 | if (!f) |
| 382 | goto out_elf_end; | 377 | goto out_elf_end; |
| 383 | 378 | ||
| 384 | if (filter && filter(map, f)) | 379 | symbols__insert(&dso->symbols[map->type], f); |
| 385 | symbol__delete(f); | 380 | ++nr; |
| 386 | else { | ||
| 387 | symbols__insert(&dso->symbols[map->type], f); | ||
| 388 | ++nr; | ||
| 389 | } | ||
| 390 | } | 381 | } |
| 391 | } | 382 | } |
| 392 | 383 | ||
| @@ -825,9 +816,8 @@ static u64 ref_reloc(struct kmap *kmap) | |||
| 825 | void __weak arch__sym_update(struct symbol *s __maybe_unused, | 816 | void __weak arch__sym_update(struct symbol *s __maybe_unused, |
| 826 | GElf_Sym *sym __maybe_unused) { } | 817 | GElf_Sym *sym __maybe_unused) { } |
| 827 | 818 | ||
| 828 | int dso__load_sym(struct dso *dso, struct map *map, | 819 | int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss, |
| 829 | struct symsrc *syms_ss, struct symsrc *runtime_ss, | 820 | struct symsrc *runtime_ss, int kmodule) |
| 830 | symbol_filter_t filter, int kmodule) | ||
| 831 | { | 821 | { |
| 832 | struct kmap *kmap = dso->kernel ? map__kmap(map) : NULL; | 822 | struct kmap *kmap = dso->kernel ? map__kmap(map) : NULL; |
| 833 | struct map_groups *kmaps = kmap ? map__kmaps(map) : NULL; | 823 | struct map_groups *kmaps = kmap ? map__kmaps(map) : NULL; |
| @@ -1124,12 +1114,8 @@ new_symbol: | |||
| 1124 | 1114 | ||
| 1125 | arch__sym_update(f, &sym); | 1115 | arch__sym_update(f, &sym); |
| 1126 | 1116 | ||
| 1127 | if (filter && filter(curr_map, f)) | 1117 | __symbols__insert(&curr_dso->symbols[curr_map->type], f, dso->kernel); |
| 1128 | symbol__delete(f); | 1118 | nr++; |
| 1129 | else { | ||
| 1130 | __symbols__insert(&curr_dso->symbols[curr_map->type], f, dso->kernel); | ||
| 1131 | nr++; | ||
| 1132 | } | ||
| 1133 | } | 1119 | } |
| 1134 | 1120 | ||
| 1135 | /* | 1121 | /* |
diff --git a/tools/perf/util/symbol-minimal.c b/tools/perf/util/symbol-minimal.c index 48906333a858..11cdde980545 100644 --- a/tools/perf/util/symbol-minimal.c +++ b/tools/perf/util/symbol-minimal.c | |||
| @@ -287,8 +287,7 @@ void symsrc__destroy(struct symsrc *ss) | |||
| 287 | 287 | ||
| 288 | int dso__synthesize_plt_symbols(struct dso *dso __maybe_unused, | 288 | int dso__synthesize_plt_symbols(struct dso *dso __maybe_unused, |
| 289 | struct symsrc *ss __maybe_unused, | 289 | struct symsrc *ss __maybe_unused, |
| 290 | struct map *map __maybe_unused, | 290 | struct map *map __maybe_unused) |
| 291 | symbol_filter_t filter __maybe_unused) | ||
| 292 | { | 291 | { |
| 293 | return 0; | 292 | return 0; |
| 294 | } | 293 | } |
| @@ -334,7 +333,6 @@ enum dso_type dso__type_fd(int fd) | |||
| 334 | int dso__load_sym(struct dso *dso, struct map *map __maybe_unused, | 333 | int dso__load_sym(struct dso *dso, struct map *map __maybe_unused, |
| 335 | struct symsrc *ss, | 334 | struct symsrc *ss, |
| 336 | struct symsrc *runtime_ss __maybe_unused, | 335 | struct symsrc *runtime_ss __maybe_unused, |
| 337 | symbol_filter_t filter __maybe_unused, | ||
| 338 | int kmodule __maybe_unused) | 336 | int kmodule __maybe_unused) |
| 339 | { | 337 | { |
| 340 | unsigned char build_id[BUILD_ID_SIZE]; | 338 | unsigned char build_id[BUILD_ID_SIZE]; |
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 4c5788f30ced..19c9c558454f 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
| @@ -24,10 +24,8 @@ | |||
| 24 | #include <symbol/kallsyms.h> | 24 | #include <symbol/kallsyms.h> |
| 25 | #include <sys/utsname.h> | 25 | #include <sys/utsname.h> |
| 26 | 26 | ||
| 27 | static int dso__load_kernel_sym(struct dso *dso, struct map *map, | 27 | static int dso__load_kernel_sym(struct dso *dso, struct map *map); |
| 28 | symbol_filter_t filter); | 28 | static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map); |
| 29 | static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map, | ||
| 30 | symbol_filter_t filter); | ||
| 31 | static bool symbol__is_idle(const char *name); | 29 | static bool symbol__is_idle(const char *name); |
| 32 | 30 | ||
| 33 | int vmlinux_path__nr_entries; | 31 | int vmlinux_path__nr_entries; |
| @@ -630,8 +628,7 @@ static int dso__load_all_kallsyms(struct dso *dso, const char *filename, | |||
| 630 | return kallsyms__parse(filename, &args, map__process_kallsym_symbol); | 628 | return kallsyms__parse(filename, &args, map__process_kallsym_symbol); |
| 631 | } | 629 | } |
| 632 | 630 | ||
| 633 | static int dso__split_kallsyms_for_kcore(struct dso *dso, struct map *map, | 631 | static int dso__split_kallsyms_for_kcore(struct dso *dso, struct map *map) |
| 634 | symbol_filter_t filter) | ||
| 635 | { | 632 | { |
| 636 | struct map_groups *kmaps = map__kmaps(map); | 633 | struct map_groups *kmaps = map__kmaps(map); |
| 637 | struct map *curr_map; | 634 | struct map *curr_map; |
| @@ -660,7 +657,7 @@ static int dso__split_kallsyms_for_kcore(struct dso *dso, struct map *map, | |||
| 660 | 657 | ||
| 661 | curr_map = map_groups__find(kmaps, map->type, pos->start); | 658 | curr_map = map_groups__find(kmaps, map->type, pos->start); |
| 662 | 659 | ||
| 663 | if (!curr_map || (filter && filter(curr_map, pos))) { | 660 | if (!curr_map) { |
| 664 | symbol__delete(pos); | 661 | symbol__delete(pos); |
| 665 | continue; | 662 | continue; |
| 666 | } | 663 | } |
| @@ -683,8 +680,7 @@ static int dso__split_kallsyms_for_kcore(struct dso *dso, struct map *map, | |||
| 683 | * kernel range is broken in several maps, named [kernel].N, as we don't have | 680 | * kernel range is broken in several maps, named [kernel].N, as we don't have |
| 684 | * the original ELF section names vmlinux have. | 681 | * the original ELF section names vmlinux have. |
| 685 | */ | 682 | */ |
| 686 | static int dso__split_kallsyms(struct dso *dso, struct map *map, u64 delta, | 683 | static int dso__split_kallsyms(struct dso *dso, struct map *map, u64 delta) |
| 687 | symbol_filter_t filter) | ||
| 688 | { | 684 | { |
| 689 | struct map_groups *kmaps = map__kmaps(map); | 685 | struct map_groups *kmaps = map__kmaps(map); |
| 690 | struct machine *machine; | 686 | struct machine *machine; |
| @@ -761,7 +757,7 @@ static int dso__split_kallsyms(struct dso *dso, struct map *map, u64 delta, | |||
| 761 | 757 | ||
| 762 | if (count == 0) { | 758 | if (count == 0) { |
| 763 | curr_map = map; | 759 | curr_map = map; |
| 764 | goto filter_symbol; | 760 | goto add_symbol; |
| 765 | } | 761 | } |
| 766 | 762 | ||
| 767 | if (dso->kernel == DSO_TYPE_GUEST_KERNEL) | 763 | if (dso->kernel == DSO_TYPE_GUEST_KERNEL) |
| @@ -793,18 +789,18 @@ static int dso__split_kallsyms(struct dso *dso, struct map *map, u64 delta, | |||
| 793 | pos->start -= delta; | 789 | pos->start -= delta; |
| 794 | pos->end -= delta; | 790 | pos->end -= delta; |
| 795 | } | 791 | } |
| 796 | filter_symbol: | 792 | add_symbol: |
| 797 | if (filter && filter(curr_map, pos)) { | 793 | if (curr_map != map) { |
| 798 | discard_symbol: rb_erase(&pos->rb_node, root); | 794 | rb_erase(&pos->rb_node, root); |
| 799 | symbol__delete(pos); | 795 | symbols__insert(&curr_map->dso->symbols[curr_map->type], pos); |
| 800 | } else { | 796 | ++moved; |
| 801 | if (curr_map != map) { | 797 | } else |
| 802 | rb_erase(&pos->rb_node, root); | 798 | ++count; |
| 803 | symbols__insert(&curr_map->dso->symbols[curr_map->type], pos); | 799 | |
| 804 | ++moved; | 800 | continue; |
| 805 | } else | 801 | discard_symbol: |
| 806 | ++count; | 802 | rb_erase(&pos->rb_node, root); |
| 807 | } | 803 | symbol__delete(pos); |
| 808 | } | 804 | } |
| 809 | 805 | ||
| 810 | if (curr_map != map && | 806 | if (curr_map != map && |
| @@ -1244,7 +1240,7 @@ static int kallsyms__delta(struct map *map, const char *filename, u64 *delta) | |||
| 1244 | } | 1240 | } |
| 1245 | 1241 | ||
| 1246 | int __dso__load_kallsyms(struct dso *dso, const char *filename, | 1242 | int __dso__load_kallsyms(struct dso *dso, const char *filename, |
| 1247 | struct map *map, bool no_kcore, symbol_filter_t filter) | 1243 | struct map *map, bool no_kcore) |
| 1248 | { | 1244 | { |
| 1249 | u64 delta = 0; | 1245 | u64 delta = 0; |
| 1250 | 1246 | ||
| @@ -1266,19 +1262,18 @@ int __dso__load_kallsyms(struct dso *dso, const char *filename, | |||
| 1266 | dso->symtab_type = DSO_BINARY_TYPE__KALLSYMS; | 1262 | dso->symtab_type = DSO_BINARY_TYPE__KALLSYMS; |
| 1267 | 1263 | ||
| 1268 | if (!no_kcore && !dso__load_kcore(dso, map, filename)) | 1264 | if (!no_kcore && !dso__load_kcore(dso, map, filename)) |
| 1269 | return dso__split_kallsyms_for_kcore(dso, map, filter); | 1265 | return dso__split_kallsyms_for_kcore(dso, map); |
| 1270 | else | 1266 | else |
| 1271 | return dso__split_kallsyms(dso, map, delta, filter); | 1267 | return dso__split_kallsyms(dso, map, delta); |
| 1272 | } | 1268 | } |
| 1273 | 1269 | ||
| 1274 | int dso__load_kallsyms(struct dso *dso, const char *filename, | 1270 | int dso__load_kallsyms(struct dso *dso, const char *filename, |
| 1275 | struct map *map, symbol_filter_t filter) | 1271 | struct map *map) |
| 1276 | { | 1272 | { |
| 1277 | return __dso__load_kallsyms(dso, filename, map, false, filter); | 1273 | return __dso__load_kallsyms(dso, filename, map, false); |
| 1278 | } | 1274 | } |
| 1279 | 1275 | ||
| 1280 | static int dso__load_perf_map(struct dso *dso, struct map *map, | 1276 | static int dso__load_perf_map(struct dso *dso, struct map *map) |
| 1281 | symbol_filter_t filter) | ||
| 1282 | { | 1277 | { |
| 1283 | char *line = NULL; | 1278 | char *line = NULL; |
| 1284 | size_t n; | 1279 | size_t n; |
| @@ -1320,12 +1315,8 @@ static int dso__load_perf_map(struct dso *dso, struct map *map, | |||
| 1320 | if (sym == NULL) | 1315 | if (sym == NULL) |
| 1321 | goto out_delete_line; | 1316 | goto out_delete_line; |
| 1322 | 1317 | ||
| 1323 | if (filter && filter(map, sym)) | 1318 | symbols__insert(&dso->symbols[map->type], sym); |
| 1324 | symbol__delete(sym); | 1319 | nr_syms++; |
| 1325 | else { | ||
| 1326 | symbols__insert(&dso->symbols[map->type], sym); | ||
| 1327 | nr_syms++; | ||
| 1328 | } | ||
| 1329 | } | 1320 | } |
| 1330 | 1321 | ||
| 1331 | free(line); | 1322 | free(line); |
| @@ -1381,7 +1372,7 @@ static bool dso__is_compatible_symtab_type(struct dso *dso, bool kmod, | |||
| 1381 | } | 1372 | } |
| 1382 | } | 1373 | } |
| 1383 | 1374 | ||
| 1384 | int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter) | 1375 | int dso__load(struct dso *dso, struct map *map) |
| 1385 | { | 1376 | { |
| 1386 | char *name; | 1377 | char *name; |
| 1387 | int ret = -1; | 1378 | int ret = -1; |
| @@ -1404,9 +1395,9 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter) | |||
| 1404 | 1395 | ||
| 1405 | if (dso->kernel) { | 1396 | if (dso->kernel) { |
| 1406 | if (dso->kernel == DSO_TYPE_KERNEL) | 1397 | if (dso->kernel == DSO_TYPE_KERNEL) |
| 1407 | ret = dso__load_kernel_sym(dso, map, filter); | 1398 | ret = dso__load_kernel_sym(dso, map); |
| 1408 | else if (dso->kernel == DSO_TYPE_GUEST_KERNEL) | 1399 | else if (dso->kernel == DSO_TYPE_GUEST_KERNEL) |
| 1409 | ret = dso__load_guest_kernel_sym(dso, map, filter); | 1400 | ret = dso__load_guest_kernel_sym(dso, map); |
| 1410 | 1401 | ||
| 1411 | goto out; | 1402 | goto out; |
| 1412 | } | 1403 | } |
| @@ -1430,7 +1421,7 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter) | |||
| 1430 | goto out; | 1421 | goto out; |
| 1431 | } | 1422 | } |
| 1432 | 1423 | ||
| 1433 | ret = dso__load_perf_map(dso, map, filter); | 1424 | ret = dso__load_perf_map(dso, map); |
| 1434 | dso->symtab_type = ret > 0 ? DSO_BINARY_TYPE__JAVA_JIT : | 1425 | dso->symtab_type = ret > 0 ? DSO_BINARY_TYPE__JAVA_JIT : |
| 1435 | DSO_BINARY_TYPE__NOT_FOUND; | 1426 | DSO_BINARY_TYPE__NOT_FOUND; |
| 1436 | goto out; | 1427 | goto out; |
| @@ -1521,14 +1512,14 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter) | |||
| 1521 | kmod = true; | 1512 | kmod = true; |
| 1522 | 1513 | ||
| 1523 | if (syms_ss) | 1514 | if (syms_ss) |
| 1524 | ret = dso__load_sym(dso, map, syms_ss, runtime_ss, filter, kmod); | 1515 | ret = dso__load_sym(dso, map, syms_ss, runtime_ss, kmod); |
| 1525 | else | 1516 | else |
| 1526 | ret = -1; | 1517 | ret = -1; |
| 1527 | 1518 | ||
| 1528 | if (ret > 0) { | 1519 | if (ret > 0) { |
| 1529 | int nr_plt; | 1520 | int nr_plt; |
| 1530 | 1521 | ||
| 1531 | nr_plt = dso__synthesize_plt_symbols(dso, runtime_ss, map, filter); | 1522 | nr_plt = dso__synthesize_plt_symbols(dso, runtime_ss, map); |
| 1532 | if (nr_plt > 0) | 1523 | if (nr_plt > 0) |
| 1533 | ret += nr_plt; | 1524 | ret += nr_plt; |
| 1534 | } | 1525 | } |
| @@ -1567,8 +1558,7 @@ out_unlock: | |||
| 1567 | } | 1558 | } |
| 1568 | 1559 | ||
| 1569 | int dso__load_vmlinux(struct dso *dso, struct map *map, | 1560 | int dso__load_vmlinux(struct dso *dso, struct map *map, |
| 1570 | const char *vmlinux, bool vmlinux_allocated, | 1561 | const char *vmlinux, bool vmlinux_allocated) |
| 1571 | symbol_filter_t filter) | ||
| 1572 | { | 1562 | { |
| 1573 | int err = -1; | 1563 | int err = -1; |
| 1574 | struct symsrc ss; | 1564 | struct symsrc ss; |
| @@ -1588,7 +1578,7 @@ int dso__load_vmlinux(struct dso *dso, struct map *map, | |||
| 1588 | if (symsrc__init(&ss, dso, symfs_vmlinux, symtab_type)) | 1578 | if (symsrc__init(&ss, dso, symfs_vmlinux, symtab_type)) |
| 1589 | return -1; | 1579 | return -1; |
| 1590 | 1580 | ||
| 1591 | err = dso__load_sym(dso, map, &ss, &ss, filter, 0); | 1581 | err = dso__load_sym(dso, map, &ss, &ss, 0); |
| 1592 | symsrc__destroy(&ss); | 1582 | symsrc__destroy(&ss); |
| 1593 | 1583 | ||
| 1594 | if (err > 0) { | 1584 | if (err > 0) { |
| @@ -1604,8 +1594,7 @@ int dso__load_vmlinux(struct dso *dso, struct map *map, | |||
| 1604 | return err; | 1594 | return err; |
| 1605 | } | 1595 | } |
| 1606 | 1596 | ||
| 1607 | int dso__load_vmlinux_path(struct dso *dso, struct map *map, | 1597 | int dso__load_vmlinux_path(struct dso *dso, struct map *map) |
| 1608 | symbol_filter_t filter) | ||
| 1609 | { | 1598 | { |
| 1610 | int i, err = 0; | 1599 | int i, err = 0; |
| 1611 | char *filename = NULL; | 1600 | char *filename = NULL; |
| @@ -1614,7 +1603,7 @@ int dso__load_vmlinux_path(struct dso *dso, struct map *map, | |||
| 1614 | vmlinux_path__nr_entries + 1); | 1603 | vmlinux_path__nr_entries + 1); |
| 1615 | 1604 | ||
| 1616 | for (i = 0; i < vmlinux_path__nr_entries; ++i) { | 1605 | for (i = 0; i < vmlinux_path__nr_entries; ++i) { |
| 1617 | err = dso__load_vmlinux(dso, map, vmlinux_path[i], false, filter); | 1606 | err = dso__load_vmlinux(dso, map, vmlinux_path[i], false); |
| 1618 | if (err > 0) | 1607 | if (err > 0) |
| 1619 | goto out; | 1608 | goto out; |
| 1620 | } | 1609 | } |
| @@ -1622,7 +1611,7 @@ int dso__load_vmlinux_path(struct dso *dso, struct map *map, | |||
| 1622 | if (!symbol_conf.ignore_vmlinux_buildid) | 1611 | if (!symbol_conf.ignore_vmlinux_buildid) |
| 1623 | filename = dso__build_id_filename(dso, NULL, 0); | 1612 | filename = dso__build_id_filename(dso, NULL, 0); |
| 1624 | if (filename != NULL) { | 1613 | if (filename != NULL) { |
| 1625 | err = dso__load_vmlinux(dso, map, filename, true, filter); | 1614 | err = dso__load_vmlinux(dso, map, filename, true); |
| 1626 | if (err > 0) | 1615 | if (err > 0) |
| 1627 | goto out; | 1616 | goto out; |
| 1628 | free(filename); | 1617 | free(filename); |
| @@ -1736,8 +1725,7 @@ proc_kallsyms: | |||
| 1736 | return strdup(path); | 1725 | return strdup(path); |
| 1737 | } | 1726 | } |
| 1738 | 1727 | ||
| 1739 | static int dso__load_kernel_sym(struct dso *dso, struct map *map, | 1728 | static int dso__load_kernel_sym(struct dso *dso, struct map *map) |
| 1740 | symbol_filter_t filter) | ||
| 1741 | { | 1729 | { |
| 1742 | int err; | 1730 | int err; |
| 1743 | const char *kallsyms_filename = NULL; | 1731 | const char *kallsyms_filename = NULL; |
| @@ -1763,12 +1751,11 @@ static int dso__load_kernel_sym(struct dso *dso, struct map *map, | |||
| 1763 | } | 1751 | } |
| 1764 | 1752 | ||
| 1765 | if (!symbol_conf.ignore_vmlinux && symbol_conf.vmlinux_name != NULL) { | 1753 | if (!symbol_conf.ignore_vmlinux && symbol_conf.vmlinux_name != NULL) { |
| 1766 | return dso__load_vmlinux(dso, map, symbol_conf.vmlinux_name, | 1754 | return dso__load_vmlinux(dso, map, symbol_conf.vmlinux_name, false); |
| 1767 | false, filter); | ||
| 1768 | } | 1755 | } |
| 1769 | 1756 | ||
| 1770 | if (!symbol_conf.ignore_vmlinux && vmlinux_path != NULL) { | 1757 | if (!symbol_conf.ignore_vmlinux && vmlinux_path != NULL) { |
| 1771 | err = dso__load_vmlinux_path(dso, map, filter); | 1758 | err = dso__load_vmlinux_path(dso, map); |
| 1772 | if (err > 0) | 1759 | if (err > 0) |
| 1773 | return err; | 1760 | return err; |
| 1774 | } | 1761 | } |
| @@ -1784,7 +1771,7 @@ static int dso__load_kernel_sym(struct dso *dso, struct map *map, | |||
| 1784 | kallsyms_filename = kallsyms_allocated_filename; | 1771 | kallsyms_filename = kallsyms_allocated_filename; |
| 1785 | 1772 | ||
| 1786 | do_kallsyms: | 1773 | do_kallsyms: |
| 1787 | err = dso__load_kallsyms(dso, kallsyms_filename, map, filter); | 1774 | err = dso__load_kallsyms(dso, kallsyms_filename, map); |
| 1788 | if (err > 0) | 1775 | if (err > 0) |
| 1789 | pr_debug("Using %s for symbols\n", kallsyms_filename); | 1776 | pr_debug("Using %s for symbols\n", kallsyms_filename); |
| 1790 | free(kallsyms_allocated_filename); | 1777 | free(kallsyms_allocated_filename); |
| @@ -1799,8 +1786,7 @@ do_kallsyms: | |||
| 1799 | return err; | 1786 | return err; |
| 1800 | } | 1787 | } |
| 1801 | 1788 | ||
| 1802 | static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map, | 1789 | static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map) |
| 1803 | symbol_filter_t filter) | ||
| 1804 | { | 1790 | { |
| 1805 | int err; | 1791 | int err; |
| 1806 | const char *kallsyms_filename = NULL; | 1792 | const char *kallsyms_filename = NULL; |
| @@ -1822,7 +1808,7 @@ static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map, | |||
| 1822 | if (symbol_conf.default_guest_vmlinux_name != NULL) { | 1808 | if (symbol_conf.default_guest_vmlinux_name != NULL) { |
| 1823 | err = dso__load_vmlinux(dso, map, | 1809 | err = dso__load_vmlinux(dso, map, |
| 1824 | symbol_conf.default_guest_vmlinux_name, | 1810 | symbol_conf.default_guest_vmlinux_name, |
| 1825 | false, filter); | 1811 | false); |
| 1826 | return err; | 1812 | return err; |
| 1827 | } | 1813 | } |
| 1828 | 1814 | ||
| @@ -1834,7 +1820,7 @@ static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map, | |||
| 1834 | kallsyms_filename = path; | 1820 | kallsyms_filename = path; |
| 1835 | } | 1821 | } |
| 1836 | 1822 | ||
| 1837 | err = dso__load_kallsyms(dso, kallsyms_filename, map, filter); | 1823 | err = dso__load_kallsyms(dso, kallsyms_filename, map); |
| 1838 | if (err > 0) | 1824 | if (err > 0) |
| 1839 | pr_debug("Using %s for symbols\n", kallsyms_filename); | 1825 | pr_debug("Using %s for symbols\n", kallsyms_filename); |
| 1840 | if (err > 0 && !dso__is_kcore(dso)) { | 1826 | if (err > 0 && !dso__is_kcore(dso)) { |
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index 72d29312a694..0dacfb7d5b67 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h | |||
| @@ -241,16 +241,13 @@ int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name, | |||
| 241 | bool symsrc__has_symtab(struct symsrc *ss); | 241 | bool symsrc__has_symtab(struct symsrc *ss); |
| 242 | bool symsrc__possibly_runtime(struct symsrc *ss); | 242 | bool symsrc__possibly_runtime(struct symsrc *ss); |
| 243 | 243 | ||
| 244 | int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter); | 244 | int dso__load(struct dso *dso, struct map *map); |
| 245 | int dso__load_vmlinux(struct dso *dso, struct map *map, | 245 | int dso__load_vmlinux(struct dso *dso, struct map *map, |
| 246 | const char *vmlinux, bool vmlinux_allocated, | 246 | const char *vmlinux, bool vmlinux_allocated); |
| 247 | symbol_filter_t filter); | 247 | int dso__load_vmlinux_path(struct dso *dso, struct map *map); |
| 248 | int dso__load_vmlinux_path(struct dso *dso, struct map *map, | ||
| 249 | symbol_filter_t filter); | ||
| 250 | int __dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map, | 248 | int __dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map, |
| 251 | bool no_kcore, symbol_filter_t filter); | 249 | bool no_kcore); |
| 252 | int dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map, | 250 | int dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map); |
| 253 | symbol_filter_t filter); | ||
| 254 | 251 | ||
| 255 | void dso__insert_symbol(struct dso *dso, enum map_type type, | 252 | void dso__insert_symbol(struct dso *dso, enum map_type type, |
| 256 | struct symbol *sym); | 253 | struct symbol *sym); |
| @@ -298,10 +295,9 @@ int symbol__config_symfs(const struct option *opt __maybe_unused, | |||
| 298 | const char *dir, int unset __maybe_unused); | 295 | const char *dir, int unset __maybe_unused); |
| 299 | 296 | ||
| 300 | int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss, | 297 | int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss, |
| 301 | struct symsrc *runtime_ss, symbol_filter_t filter, | 298 | struct symsrc *runtime_ss, int kmodule); |
| 302 | int kmodule); | ||
| 303 | int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss, | 299 | int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss, |
| 304 | struct map *map, symbol_filter_t filter); | 300 | struct map *map); |
| 305 | 301 | ||
| 306 | void __symbols__insert(struct rb_root *symbols, struct symbol *sym, bool kernel); | 302 | void __symbols__insert(struct rb_root *symbols, struct symbol *sym, bool kernel); |
| 307 | void symbols__insert(struct rb_root *symbols, struct symbol *sym); | 303 | void symbols__insert(struct rb_root *symbols, struct symbol *sym); |
