In the C language, __FUNCTION__ can be used to get the current function\'s name. But if I define a function named a() and it is called
__FUNCTION__
You can do it with a gcc builtin.
void * __builtin_return_address(int level)
The following way should print the immediate caller of a function a().
Example:
a() { printf ("Caller name: %pS\n", __builtin_return_address(0)); }