Access to symbol table from within a program
Joe Buck
jbuck@synopsys.COM
Thu Jan 24 14:40:00 GMT 2002
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.
More information about the Gcc
mailing list