You need to declare two functions (perhaps in a separate source file compiled WITHOUT -ee and -ep flags) as follows.
Code:
static int callLevel = 0;
void __EPI ( const char *funcname ) {
callLevel++;
// somehow log the fact that funcname was called
}
void __PRO ( const char *funcname ) {
callLevel--;
}
NOTE!!!!!
I've guessed that each function receives a single char* parameter. This is a GUESS, you need to find out what parameter(s) it actually receives.
Add the resulting object file to the link when compiling with -ee/-ep flags.
It's like doing this in your code, except with some support from the compiler
Code:
void foo ( ) {
__EPI("foo"); // compiler adds this with the -ee flag
// do stuff
__PRO("foo"); // compiler adds this with the -ep flag
}
without having to go through and manually edit all the code.