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 in b(), like below:
b()
{
a();
}
Now, in the source code, there are lots of functions like b() that call a(), e.g. c(), d(), e()...
Is it possible, within a(), to add some code to detect the name of the function that called a()?
Further:
- Sorry for the misleading typo. I have corrected it.
- I am trying to find out which function calls a() for debugging purposes. I
don't know how you do when in the same situation?
- And my code is under vxWorks, but I am not sure whether it is related to C99 or
something else.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…