Question about instrumenting gcc

Renata Hodovan hodovan@inf.u-szeged.hu
Tue Jun 5 16:26:00 GMT 2012


Hi All,

I have to instrument gcc for some purposes. The goal is to be able to 
track what GCC functions are called during a particularly compile. 
Unfortunately I'm not really familiar with the architecture of GCC so I 
need a little help. I tried the following steps:

1) Hacking gcc/Makefile.in and adding "-finstrument-functions" flag to 
T_CFLAGS.
2) I have an already implemented and tested version of __start_test__ 
and __end_test__ functions. They are called from gcc/main.c, before and 
after toplev_main() call. The containing file is linked to gcc (the 
object is added to OBJS-common and the dependency is defined later in 
gcc/Makefile.in)
3) Downloading prerequisites with contrib/download_prerequisites.
4) Executing the configuration from a clean build directory (on the same 
level with the source dir): ./../gcc-4.6.2/configure 
--prefix="/opt/gcc-4.6.2/" --enable-languages="c,c++"
5) Starting the build with "make all"

This way I ran out of memory, although I had 28G.
Next I tried to remove the T_CFLAGS settings from the Makefile and gave 
-finstrument-functions to the make command:
make CFLAGS+="-finstrument-functions" all
The build was successful this way but when I tried to compile something 
it resulted empty output files. (Theoretically __end_test__should have 
written its result to a given file.)

What do I make wrong? Thanks in advance!
Cheers,
Reni



More information about the Gcc-help mailing list