Find all functions generated by macros

164 Views Asked by At

I am trying to generate various functions using macros in C. Is there any way for me to see all the functions generated during compilation?

3

There are 3 best solutions below

2
On

You can use -E option of the gcc compiler to view the preprocessed file.

gcc -E main.c > main.i
0
On

If you are using gcc, the option -save-temps saves the intermediate steps of compilation (preprocessed files and assembly code) while generating binary.

You can see a brief description here.

0
On

You could use nm on the object file to get the name of public (non static) functions.

You could pass the -v option to the cc1 to get the the name of compiled functions.

You could also extend your recent GCC compiler using MELT

And of course, you could get the preprocessed form, as other answers suggested.