diff options
author | Milian Wolff <milian.wolff@kdab.com> | 2017-05-24 02:21:28 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-05-24 02:41:48 -0400 |
commit | 4d53b9d546f9f4505e6e3d58c8eed894d6f684e7 (patch) | |
tree | e37dac8e143d8d0aa4f1d286f3628b49235f6876 | |
parent | 28071f51839e393f697d0d1df0b223a4bc373606 (diff) |
perf report: Do not drop last inlined frame
The very last inlined frame, i.e. the one furthest away from the
non-inlined frame, was silently dropped. This is apparent when
comparing the output of `perf script` and `addr2line`:
~~~~~~
$ perf script --inline
...
a.out 26722 80836.309329: 72425 cycles:
21561 __hypot_finite (/usr/lib/libm-2.25.so)
ace3 hypot (/usr/lib/libm-2.25.so)
a4a main (a.out)
std::abs<double>
std::_Norm_helper<true>::_S_do_it<double>
std::norm<double>
main
20510 __libc_start_main (/usr/lib/libc-2.25.so)
bd9 _start (a.out)
$ addr2line -a -f -i -e /tmp/a.out a4a | c++filt
0x0000000000000a4a
std::__complex_abs(doublecomplex )
/usr/include/c++/6.3.1/complex:589
double std::abs<double>(std::complex<double> const&)
/usr/include/c++/6.3.1/complex:597
double std::_Norm_helper<true>::_S_do_it<double>(std::complex<double> const&)
/usr/include/c++/6.3.1/complex:654
double std::norm<double>(std::complex<double> const&)
/usr/include/c++/6.3.1/complex:664
main
/tmp/inlining.cpp:14
~~~~~
Note how `std::__complex_abs` is missing from the `perf script`
output. This is similarly showing up in `perf report`. The patch
here fixes this issue, and the output becomes:
~~~~~
a.out 26722 80836.309329: 72425 cycles:
21561 __hypot_finite (/usr/lib/libm-2.25.so)
ace3 hypot (/usr/lib/libm-2.25.so)
a4a main (a.out)
std::__complex_abs
std::abs<double>
std::_Norm_helper<true>::_S_do_it<double>
std::norm<double>
main
20510 __libc_start_main (/usr/lib/libc-2.25.so)
bd9 _start (a.out)
~~~~~
Signed-off-by: Milian Wolff <milian.wolff@kdab.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Yao Jin <yao.jin@linux.intel.com>
Cc: kernel-team@lge.com
Link: http://lkml.kernel.org/r/20170524062129.32529-7-namhyung@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | tools/perf/util/srcline.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c index 6af0364cad06..ebc88a74e67b 100644 --- a/tools/perf/util/srcline.c +++ b/tools/perf/util/srcline.c | |||
@@ -203,6 +203,16 @@ static void addr2line_cleanup(struct a2l_data *a2l) | |||
203 | 203 | ||
204 | #define MAX_INLINE_NEST 1024 | 204 | #define MAX_INLINE_NEST 1024 |
205 | 205 | ||
206 | static int inline_list__append_dso_a2l(struct dso *dso, | ||
207 | struct inline_node *node) | ||
208 | { | ||
209 | struct a2l_data *a2l = dso->a2l; | ||
210 | char *funcname = a2l->funcname ? strdup(a2l->funcname) : NULL; | ||
211 | char *filename = a2l->filename ? strdup(a2l->filename) : NULL; | ||
212 | |||
213 | return inline_list__append(filename, funcname, a2l->line, node, dso); | ||
214 | } | ||
215 | |||
206 | static int addr2line(const char *dso_name, u64 addr, | 216 | static int addr2line(const char *dso_name, u64 addr, |
207 | char **file, unsigned int *line, struct dso *dso, | 217 | char **file, unsigned int *line, struct dso *dso, |
208 | bool unwind_inlines, struct inline_node *node) | 218 | bool unwind_inlines, struct inline_node *node) |
@@ -231,15 +241,15 @@ static int addr2line(const char *dso_name, u64 addr, | |||
231 | if (unwind_inlines) { | 241 | if (unwind_inlines) { |
232 | int cnt = 0; | 242 | int cnt = 0; |
233 | 243 | ||
244 | if (node && inline_list__append_dso_a2l(dso, node)) | ||
245 | return 0; | ||
246 | |||
234 | while (bfd_find_inliner_info(a2l->abfd, &a2l->filename, | 247 | while (bfd_find_inliner_info(a2l->abfd, &a2l->filename, |
235 | &a2l->funcname, &a2l->line) && | 248 | &a2l->funcname, &a2l->line) && |
236 | cnt++ < MAX_INLINE_NEST) { | 249 | cnt++ < MAX_INLINE_NEST) { |
237 | 250 | ||
238 | if (node != NULL) { | 251 | if (node != NULL) { |
239 | if (inline_list__append(strdup(a2l->filename), | 252 | if (inline_list__append_dso_a2l(dso, node)) |
240 | strdup(a2l->funcname), | ||
241 | a2l->line, node, | ||
242 | dso) != 0) | ||
243 | return 0; | 253 | return 0; |
244 | // found at least one inline frame | 254 | // found at least one inline frame |
245 | ret = 1; | 255 | ret = 1; |