diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-04-24 11:05:48 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-04-26 12:47:09 -0400 |
commit | d9a5f274603bea1c89d59baaf37eef8f57851a09 (patch) | |
tree | 9fb317feda343722a5152bbf4f1e38d67cdd2bf8 /tools/perf | |
parent | 71a84b5aedf5023f4009c3bbf28ecba256201f87 (diff) |
perf thread: Make thread__find_symbol() return the symbol searched
Instead of just returning it in al.sym, allowing for some simplification
in its users, and to make it consistent with thread__find_map().
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-4axi2sigslffdixzxbehvgoj@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/builtin-timechart.c | 7 | ||||
-rw-r--r-- | tools/perf/util/event.c | 10 | ||||
-rw-r--r-- | tools/perf/util/thread.h | 8 | ||||
-rw-r--r-- | tools/perf/util/unwind-libunwind-local.c | 4 |
4 files changed, 12 insertions, 17 deletions
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index 38fcbb5ddce8..a827919c6263 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c | |||
@@ -533,11 +533,8 @@ static const char *cat_backtrace(union perf_event *event, | |||
533 | } | 533 | } |
534 | 534 | ||
535 | tal.filtered = 0; | 535 | tal.filtered = 0; |
536 | thread__find_symbol(al.thread, cpumode, ip, &tal); | 536 | if (thread__find_symbol(al.thread, cpumode, ip, &tal)) |
537 | 537 | fprintf(f, "..... %016" PRIx64 " %s\n", ip, tal.sym->name); | |
538 | if (tal.sym) | ||
539 | fprintf(f, "..... %016" PRIx64 " %s\n", ip, | ||
540 | tal.sym->name); | ||
541 | else | 538 | else |
542 | fprintf(f, "..... %016" PRIx64 "\n", ip); | 539 | fprintf(f, "..... %016" PRIx64 "\n", ip); |
543 | } | 540 | } |
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 48e4b252f6ff..9d94c59046d1 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
@@ -1566,14 +1566,14 @@ try_again: | |||
1566 | return al->map; | 1566 | return al->map; |
1567 | } | 1567 | } |
1568 | 1568 | ||
1569 | void __thread__find_symbol(struct thread *thread, u8 cpumode, | 1569 | struct symbol *__thread__find_symbol(struct thread *thread, u8 cpumode, |
1570 | enum map_type type, u64 addr, | 1570 | enum map_type type, u64 addr, |
1571 | struct addr_location *al) | 1571 | struct addr_location *al) |
1572 | { | 1572 | { |
1573 | al->sym = NULL; | ||
1573 | if (__thread__find_map(thread, cpumode, type, addr, al)) | 1574 | if (__thread__find_map(thread, cpumode, type, addr, al)) |
1574 | al->sym = map__find_symbol(al->map, al->addr); | 1575 | al->sym = map__find_symbol(al->map, al->addr); |
1575 | else | 1576 | return al->sym; |
1576 | al->sym = NULL; | ||
1577 | } | 1577 | } |
1578 | 1578 | ||
1579 | /* | 1579 | /* |
diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h index 1961e4bc1c2c..1b130b0a4a48 100644 --- a/tools/perf/util/thread.h +++ b/tools/perf/util/thread.h | |||
@@ -101,11 +101,11 @@ static inline struct map *thread__find_map(struct thread *thread, u8 cpumode, | |||
101 | return __thread__find_map(thread, cpumode, MAP__FUNCTION, addr, al); | 101 | return __thread__find_map(thread, cpumode, MAP__FUNCTION, addr, al); |
102 | } | 102 | } |
103 | 103 | ||
104 | void __thread__find_symbol(struct thread *thread, u8 cpumode, enum map_type type, | 104 | struct symbol *__thread__find_symbol(struct thread *thread, u8 cpumode, enum map_type type, |
105 | u64 addr, struct addr_location *al); | 105 | u64 addr, struct addr_location *al); |
106 | 106 | ||
107 | static inline void thread__find_symbol(struct thread *thread, u8 cpumode, | 107 | static inline struct symbol *thread__find_symbol(struct thread *thread, u8 cpumode, |
108 | u64 addr, struct addr_location *al) | 108 | u64 addr, struct addr_location *al) |
109 | { | 109 | { |
110 | return __thread__find_symbol(thread, cpumode, MAP__FUNCTION, addr, al); | 110 | return __thread__find_symbol(thread, cpumode, MAP__FUNCTION, addr, al); |
111 | } | 111 | } |
diff --git a/tools/perf/util/unwind-libunwind-local.c b/tools/perf/util/unwind-libunwind-local.c index 4662590ef091..2afb22b0a1a9 100644 --- a/tools/perf/util/unwind-libunwind-local.c +++ b/tools/perf/util/unwind-libunwind-local.c | |||
@@ -584,11 +584,9 @@ static int entry(u64 ip, struct thread *thread, | |||
584 | struct unwind_entry e; | 584 | struct unwind_entry e; |
585 | struct addr_location al; | 585 | struct addr_location al; |
586 | 586 | ||
587 | thread__find_symbol(thread, PERF_RECORD_MISC_USER, ip, &al); | 587 | e.sym = thread__find_symbol(thread, PERF_RECORD_MISC_USER, ip, &al); |
588 | |||
589 | e.ip = al.addr; | 588 | e.ip = al.addr; |
590 | e.map = al.map; | 589 | e.map = al.map; |
591 | e.sym = al.sym; | ||
592 | 590 | ||
593 | pr_debug("unwind: %s:ip = 0x%" PRIx64 " (0x%" PRIx64 ")\n", | 591 | pr_debug("unwind: %s:ip = 0x%" PRIx64 " (0x%" PRIx64 ")\n", |
594 | al.sym ? al.sym->name : "''", | 592 | al.sym ? al.sym->name : "''", |