According to this answer,it should print all function names:
[root@ test]# cat hw.c
#include
int func(void)
{
return 1;
}
int main(void)
Coding __cyg_profile_func_enter and __cyg_profile_func_exit is not complicated. Easiest solution will be to ensure that the above functions write the address details to a file and have a seperate process to read the addresses from the file and resolve them using symbol table of the executable. If you try to do address resolution in the function itself it may take some time.
I came across following article - http://balau82.wordpress.com/2010/10/06/trace-and-profile-function-calls-with-gcc/
Which uses addr2line from binutils for this purpose. Check if this helps you