diff --git a/tools/perf/arch/powerpc/util/skip-callchain-idx.c b/tools/perf/arch/powerpc/util/skip-callchain-idx.c index 0c370f81e00280c6428ddfe0975584edcb9d02a7..3598b8b75d274c8ebcc6fc0452091dec34c797b7 100644 --- a/tools/perf/arch/powerpc/util/skip-callchain-idx.c +++ b/tools/perf/arch/powerpc/util/skip-callchain-idx.c @@ -248,8 +248,7 @@ int arch_skip_callchain_idx(struct thread *thread, struct ip_callchain *chain) ip = chain->ips[2]; - thread__find_addr_location(thread, PERF_RECORD_MISC_USER, - MAP__FUNCTION, ip, &al); + thread__find_symbol(thread, PERF_RECORD_MISC_USER, ip, &al); if (al.map) dso = al.map->dso; diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index 813698a9b8c72d7188683dea53bf838a16c81c9d..38fcbb5ddce895e01a83194e8b2a13110e3f8b48 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c @@ -533,8 +533,7 @@ static const char *cat_backtrace(union perf_event *event, } tal.filtered = 0; - thread__find_addr_location(al.thread, cpumode, - MAP__FUNCTION, ip, &tal); + thread__find_symbol(al.thread, cpumode, ip, &tal); if (tal.sym) fprintf(f, "..... %016" PRIx64 " %s\n", ip, diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 3ad17ee89403b8e1bbf49fc1e6e077de5bb07cdd..afec6f9ffd896b0a3eebfdf838dc5ca88954a0e8 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -2024,8 +2024,7 @@ static int trace__pgfault(struct trace *trace, if (trace->summary_only) goto out; - thread__find_addr_location(thread, sample->cpumode, MAP__FUNCTION, - sample->ip, &al); + thread__find_symbol(thread, sample->cpumode, sample->ip, &al); trace__fprintf_entry_head(trace, thread, 0, true, sample->time, trace->output); @@ -2037,12 +2036,10 @@ static int trace__pgfault(struct trace *trace, fprintf(trace->output, "] => "); - thread__find_addr_location(thread, sample->cpumode, MAP__VARIABLE, - sample->addr, &al); + __thread__find_symbol(thread, sample->cpumode, MAP__VARIABLE, sample->addr, &al); if (!al.map) { - thread__find_addr_location(thread, sample->cpumode, - MAP__FUNCTION, sample->addr, &al); + thread__find_symbol(thread, sample->cpumode, sample->addr, &al); if (al.map) map_type = 'x'; diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index baa97d0b61148600ba4dcc5a24419966004e67d1..2d860fbeb227eb12feeb41854a288036a70670a7 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c @@ -1564,9 +1564,9 @@ void __thread__find_map(struct thread *thread, u8 cpumode, enum map_type type, } } -void thread__find_addr_location(struct thread *thread, - u8 cpumode, enum map_type type, u64 addr, - struct addr_location *al) +void __thread__find_symbol(struct thread *thread, u8 cpumode, + enum map_type type, u64 addr, + struct addr_location *al) { __thread__find_map(thread, cpumode, type, addr, al); if (al->map != NULL) diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 32d50492505d4b5018dc3fe3794e284e519f8346..e354d94a68e85ee33d31644f84ecc755de89de8c 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -1681,14 +1681,14 @@ static void ip__resolve_data(struct thread *thread, memset(&al, 0, sizeof(al)); - thread__find_addr_location(thread, m, MAP__VARIABLE, addr, &al); + __thread__find_symbol(thread, m, MAP__VARIABLE, addr, &al); if (al.map == NULL) { /* * some shared data regions have execute bit set which puts * their mapping in the MAP__FUNCTION type array. * Check there as a fallback option before dropping the sample. */ - thread__find_addr_location(thread, m, MAP__FUNCTION, addr, &al); + thread__find_symbol(thread, m, addr, &al); } ams->addr = addr; @@ -1784,8 +1784,7 @@ static int add_callchain_ip(struct thread *thread, } return 0; } - thread__find_addr_location(thread, *cpumode, MAP__FUNCTION, - ip, &al); + thread__find_symbol(thread, *cpumode, ip, &al); } if (al.sym != NULL) { diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index 68b65b10579bcce74ef5cdb99b8a1b43501ee88b..2a3fb7c6b39dfcfbd746e5e9347c97c03e1ed9d0 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c @@ -384,7 +384,7 @@ void thread__find_cpumode_addr_location(struct thread *thread, }; for (i = 0; i < ARRAY_SIZE(cpumodes); i++) { - thread__find_addr_location(thread, cpumodes[i], type, addr, al); + __thread__find_symbol(thread, cpumodes[i], type, addr, al); if (al->map) break; } diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h index 52c788f955dea15971aff663a64ce98cd13e83b7..b69e65c821f953ff8f36e775836812c2c0ce506a 100644 --- a/tools/perf/util/thread.h +++ b/tools/perf/util/thread.h @@ -101,9 +101,14 @@ static inline void thread__find_map(struct thread *thread, u8 cpumode, __thread__find_map(thread, cpumode, MAP__FUNCTION, addr, al); } -void thread__find_addr_location(struct thread *thread, - u8 cpumode, enum map_type type, u64 addr, - struct addr_location *al); +void __thread__find_symbol(struct thread *thread, u8 cpumode, enum map_type type, + u64 addr, struct addr_location *al); + +static inline void thread__find_symbol(struct thread *thread, u8 cpumode, + u64 addr, struct addr_location *al) +{ + return __thread__find_symbol(thread, cpumode, MAP__FUNCTION, addr, al); +} void thread__find_cpumode_addr_location(struct thread *thread, enum map_type type, u64 addr, diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c index 1ce8744649b5e4368aeaf2c64af1c1027bcf3f7a..bdc22f1864df9255c6b7d28dbe33d949ff319d6d 100644 --- a/tools/perf/util/unwind-libdw.c +++ b/tools/perf/util/unwind-libdw.c @@ -28,10 +28,11 @@ static int __report_module(struct addr_location *al, u64 ip, { Dwfl_Module *mod; struct dso *dso = NULL; - - thread__find_addr_location(ui->thread, - PERF_RECORD_MISC_USER, - MAP__FUNCTION, ip, al); + /* + * Some callers will use al->sym, so we can't just use the + * cheaper thread__find_map() here. + */ + thread__find_symbol(ui->thread, PERF_RECORD_MISC_USER, ip, al); if (al->map) dso = al->map->dso; diff --git a/tools/perf/util/unwind-libunwind-local.c b/tools/perf/util/unwind-libunwind-local.c index 33afca5c04f6dadda4188db5b7fa7b87368c321a..0007c64f322046d310bceb7f81e4294535672855 100644 --- a/tools/perf/util/unwind-libunwind-local.c +++ b/tools/perf/util/unwind-libunwind-local.c @@ -585,8 +585,7 @@ static int entry(u64 ip, struct thread *thread, struct unwind_entry e; struct addr_location al; - thread__find_addr_location(thread, PERF_RECORD_MISC_USER, - MAP__FUNCTION, ip, &al); + thread__find_symbol(thread, PERF_RECORD_MISC_USER, ip, &al); e.ip = al.addr; e.map = al.map;