profile mode output analysis (call stacks to source code mapping)

Silvius Rus rus@google.com
Mon May 10 18:11:00 GMT 2010


On Fri, May 7, 2010 at 7:09 AM, Karel Gardas <gardask@gmail.com> wrote:
> with recent fixes into profile mode I've succeed even using it for
> MICO[1] on OpenSolaris platform.  Is there any tool which
> translates call stacks to humans or is there any documentation/hint
> how to use generated call stack information to find out appropriate
> place in the source code?

Mapping code addresses to function names and line numbers is system
dependent.  That's one reason why line numbers are not produced by the
profile mode directly.

If you are using binutils, this should give you precise line number
information for debug binaries.
addr2line -e <path_to_binary> addr1 addr2 ...

If you don't have debug information or the debug information is
imprecise, you should still be able to map addresses to function
names:
addr2line -f -e <path_to_binary> addr1 addr2 ...

Other useful addr2line options are -i (print inlined stacks) and -C
(demangle C++ names).

Silvius



More information about the Gcc mailing list