diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-04-24 11:58:56 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-04-26 13:47:08 -0300 |
commit | 71a84b5aedf5023f4009c3bbf28ecba256201f87 (patch) | |
tree | 966cfe5ebed091694f0e8981fa0f4a9d9769d839 /tools/perf/builtin-script.c | |
parent | cc5f02f2be8d3354986bad5703ee8a983872f140 (diff) | |
download | op-kernel-dev-71a84b5aedf5023f4009c3bbf28ecba256201f87.zip op-kernel-dev-71a84b5aedf5023f4009c3bbf28ecba256201f87.tar.gz |
perf thread: Make thread__find_map() return the map
It was returning the searched map just on the addr_location passed, with
the function itself returning void.
Make it return the map so that we can make the code more compact.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-tzlrrzdeoof4i6ktyqv1t6ks@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-script.c')
-rw-r--r-- | tools/perf/builtin-script.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index ffd02fa..07cb083 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -809,12 +809,12 @@ static int perf_sample__fprintf_brstackoff(struct perf_sample *sample, from = br->entries[i].from; to = br->entries[i].to; - thread__find_map(thread, sample->cpumode, from, &alf); - if (alf.map && !alf.map->dso->adjust_symbols) + if (thread__find_map(thread, sample->cpumode, from, &alf) && + !alf.map->dso->adjust_symbols) from = map__map_ip(alf.map, from); - thread__find_map(thread, sample->cpumode, to, &alt); - if (alt.map && !alt.map->dso->adjust_symbols) + if (thread__find_map(thread, sample->cpumode, to, &alt) && + !alt.map->dso->adjust_symbols) to = map__map_ip(alt.map, to); printed += fprintf(fp, " 0x%"PRIx64, from); @@ -877,8 +877,7 @@ static int grab_bb(u8 *buffer, u64 start, u64 end, return 0; } - thread__find_map(thread, *cpumode, start, &al); - if (!al.map || !al.map->dso) { + if (!thread__find_map(thread, *cpumode, start, &al) || !al.map->dso) { pr_debug("\tcannot resolve %" PRIx64 "-%" PRIx64 "\n", start, end); return 0; } @@ -928,8 +927,7 @@ static int ip__fprintf_sym(uint64_t addr, struct thread *thread, memset(&al, 0, sizeof(al)); - thread__find_map(thread, cpumode, addr, &al); - if (!al.map) + if (!thread__find_map(thread, cpumode, addr, &al)) __thread__find_map(thread, cpumode, MAP__VARIABLE, addr, &al); if ((*lastsym) && al.addr >= (*lastsym)->start && al.addr < (*lastsym)->end) return 0; |