This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Access to symbol table from within a program
- From: Joe Buck <jbuck at synopsys dot COM>
- To: levon at movementarian dot org (John Levon)
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 24 Jan 2002 14:16:13 -0800 (PST)
- Subject: Re: Access to symbol table from within a program
linguist-gcc@rich-paul.net wrote:
>
> > I'm curious: I have found the -finstrument-functions compiler
> > switch, and have used to it print out the addresses of functions
> > as they are called. How could I use the symbol table from within
> > the program so that I could show the names of the functions as
> > they are called, something like: ...
John Levon wrote:
> You need to open the binary with bfd or whatever. Some very dumb code :
>
> http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/functrace/functrace/src/
It's already been done; binutils has a program named addr2line. If you
have a GNU/Linux system, it may already be installed in /usr/bin.