On Mittwoch, 5. Oktober 2016 22:22:34 CEST Mark Wielaard wrote: > Hi Milian, > > On Wed, 2016-10-05 at 17:45 +0200, Milian Wolff wrote: > > I'm trying to improve Linux perf report by adding inliner information to > > the callstacks it reports, to make the output more easily interpretable > > when looking at complicated C++ applications. > > You might want to take a look at eu-stack (src/stack.c) in elfutils > which does this too. If you are using the elfutils libraries (libdw.so).
<snip, and reordered>
> I don't know what gdb exactly displays as address in that backtrace.
> It might display the return address, in which case subtracting 1 is the
> right thing to do on x86_64 (that would be an approximation of the call
> address, which is what you want).
>
> And in fact that is what eu-stack does:
>
> (gdb) gcore test.core
> Saved corefile test.core
>
> $ eu-stack -v --core test.core --exec test
> PID 32623 - core
> TID 32623:
> #0 0x00007ffff77f8cf0 __hypot - libm.so.6
> /usr/src/debug/glibc-2.17-c758a686/math/w_hypot.c:23
> #1 0x0000000000400824 - 1 __complex_abs - test
> /usr/include/c++/4.8.2/complex:587
> #2 0x0000000000400824 - 1 abs<double> - test
> /usr/include/c++/4.8.2/complex:595
> #3 0x0000000000400824 - 1 main - test
> /tmp/test.cpp:14
> #4 0x00007ffff721db35 - 1 __libc_start_main - libc.so.6
> ../csu/libc-start.c:274
> #5 0x000000000040088f - 1 _start - test
Thanks, I have had a look at the sources and found the code for the adjustion:
Dwarf_Addr pc = frames->frame[nr].pc;
bool isactivation = frames->frame[nr].isactivation;
Dwarf_Addr pc_adjusted = pc - (isactivation ? 0 : 1);
The isactivation information comes from dwfl_frame_pc, so that should be all I
need to use this properly in Linux perf - thanks!
> > I have a proof of concept locally using bfd_find_inliner_info
>
> I don't know what bfd_find_inliner_info is.
> It sound like something from binutils?
Oh, indeed - I mixed up the two. Sorry for that, and thanks a lot for still
helping me out. I will check whether using dwfl instead of bfd for this
purpose may be advantageous.
Cheers
--
Milian Wolff
[email protected]
http://milianw.de
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ elfutils-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
