diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-04-24 09:49:50 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-04-26 12:47:06 -0400 |
commit | f07a2d32b521a54635c8efeb0a3180b0afcf780a (patch) | |
tree | 45a1067acbe63042868ffd6ad920b657c2ed7f51 /tools/perf/builtin-script.c | |
parent | e94b861a231501e73d786970ed5a1fb3ea643906 (diff) |
perf thread: Introduce thread__find_map()
Out of thread__find_add_map(..., MAP__FUNCTION, ...), idea here is to
continue removing references to MAP__{FUNCTION,VARIABLE} ahead of
getting both types of symbols in the same rbtree, as various places do
two lookups, looking first at MAP__FUNCTION, then at MAP__VARIABLE.
So thread__find_map() will eventually do just that, and 'struct symbol'
will have the symbol type, for code that cares about that.
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-q27xee34l4izpfau49w103s6@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 | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index e0a9845b6cbc..5ec1c73bbfaf 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c | |||
@@ -717,8 +717,8 @@ static int perf_sample__fprintf_brstack(struct perf_sample *sample, | |||
717 | if (PRINT_FIELD(DSO)) { | 717 | if (PRINT_FIELD(DSO)) { |
718 | memset(&alf, 0, sizeof(alf)); | 718 | memset(&alf, 0, sizeof(alf)); |
719 | memset(&alt, 0, sizeof(alt)); | 719 | memset(&alt, 0, sizeof(alt)); |
720 | thread__find_addr_map(thread, sample->cpumode, MAP__FUNCTION, from, &alf); | 720 | thread__find_map(thread, sample->cpumode, from, &alf); |
721 | thread__find_addr_map(thread, sample->cpumode, MAP__FUNCTION, to, &alt); | 721 | thread__find_map(thread, sample->cpumode, to, &alt); |
722 | } | 722 | } |
723 | 723 | ||
724 | printed += fprintf(fp, " 0x%"PRIx64, from); | 724 | printed += fprintf(fp, " 0x%"PRIx64, from); |
@@ -764,11 +764,11 @@ static int perf_sample__fprintf_brstacksym(struct perf_sample *sample, | |||
764 | from = br->entries[i].from; | 764 | from = br->entries[i].from; |
765 | to = br->entries[i].to; | 765 | to = br->entries[i].to; |
766 | 766 | ||
767 | thread__find_addr_map(thread, sample->cpumode, MAP__FUNCTION, from, &alf); | 767 | thread__find_map(thread, sample->cpumode, from, &alf); |
768 | if (alf.map) | 768 | if (alf.map) |
769 | alf.sym = map__find_symbol(alf.map, alf.addr); | 769 | alf.sym = map__find_symbol(alf.map, alf.addr); |
770 | 770 | ||
771 | thread__find_addr_map(thread, sample->cpumode, MAP__FUNCTION, to, &alt); | 771 | thread__find_map(thread, sample->cpumode, to, &alt); |
772 | if (alt.map) | 772 | if (alt.map) |
773 | alt.sym = map__find_symbol(alt.map, alt.addr); | 773 | alt.sym = map__find_symbol(alt.map, alt.addr); |
774 | 774 | ||
@@ -814,11 +814,11 @@ static int perf_sample__fprintf_brstackoff(struct perf_sample *sample, | |||
814 | from = br->entries[i].from; | 814 | from = br->entries[i].from; |
815 | to = br->entries[i].to; | 815 | to = br->entries[i].to; |
816 | 816 | ||
817 | thread__find_addr_map(thread, sample->cpumode, MAP__FUNCTION, from, &alf); | 817 | thread__find_map(thread, sample->cpumode, from, &alf); |
818 | if (alf.map && !alf.map->dso->adjust_symbols) | 818 | if (alf.map && !alf.map->dso->adjust_symbols) |
819 | from = map__map_ip(alf.map, from); | 819 | from = map__map_ip(alf.map, from); |
820 | 820 | ||
821 | thread__find_addr_map(thread, sample->cpumode, MAP__FUNCTION, to, &alt); | 821 | thread__find_map(thread, sample->cpumode, to, &alt); |
822 | if (alt.map && !alt.map->dso->adjust_symbols) | 822 | if (alt.map && !alt.map->dso->adjust_symbols) |
823 | to = map__map_ip(alt.map, to); | 823 | to = map__map_ip(alt.map, to); |
824 | 824 | ||
@@ -882,7 +882,7 @@ static int grab_bb(u8 *buffer, u64 start, u64 end, | |||
882 | return 0; | 882 | return 0; |
883 | } | 883 | } |
884 | 884 | ||
885 | thread__find_addr_map(thread, *cpumode, MAP__FUNCTION, start, &al); | 885 | thread__find_map(thread, *cpumode, start, &al); |
886 | if (!al.map || !al.map->dso) { | 886 | if (!al.map || !al.map->dso) { |
887 | pr_debug("\tcannot resolve %" PRIx64 "-%" PRIx64 "\n", start, end); | 887 | pr_debug("\tcannot resolve %" PRIx64 "-%" PRIx64 "\n", start, end); |
888 | return 0; | 888 | return 0; |
@@ -933,10 +933,9 @@ static int ip__fprintf_sym(uint64_t addr, struct thread *thread, | |||
933 | 933 | ||
934 | memset(&al, 0, sizeof(al)); | 934 | memset(&al, 0, sizeof(al)); |
935 | 935 | ||
936 | thread__find_addr_map(thread, cpumode, MAP__FUNCTION, addr, &al); | 936 | thread__find_map(thread, cpumode, addr, &al); |
937 | if (!al.map) | 937 | if (!al.map) |
938 | thread__find_addr_map(thread, cpumode, MAP__VARIABLE, | 938 | __thread__find_map(thread, cpumode, MAP__VARIABLE, addr, &al); |
939 | addr, &al); | ||
940 | if ((*lastsym) && al.addr >= (*lastsym)->start && al.addr < (*lastsym)->end) | 939 | if ((*lastsym) && al.addr >= (*lastsym)->start && al.addr < (*lastsym)->end) |
941 | return 0; | 940 | return 0; |
942 | 941 | ||