Access to symbol table from within a program
John Levon
levon@movementarian.org
Thu Jan 24 13:59:00 GMT 2002
On Thu, Jan 24, 2002 at 03:22:04PM -0500, 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:
>
> +main
> +myfunc1
> +myfunc2
> -myfunc2
> +myfunc3
> +myfunc2
> -myfunc2
> -myfunc3
> -myfunc1
> -main
>
> This would be really handy.
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/
There are also things that do it for you, you can just plug it in.
regards
john
--
"ALL television is children's television."
- Richard Adler
More information about the Gcc
mailing list