Inside a function, one can put (for gcc)
printf("%s: I am here!", __FUNCTION__);
to indicate where a particular message comes from. Now, suppose I have serval functions A1, A2, A3,…, which all might call function B(). I am wondering if there is a neat way to indicate which function calls B() at run-time.
You could simply use
backtrace()(which is not completely portable either)See this link:
http://www.kernel.org/doc/man-pages/online/pages/man3/backtrace.3.html