For example
void MyFunction()
{
printf( "This function is called by %s in file %s on line $i.\n", func, file, line ); // Where func, file and lines should be replaced
}
int main()
{
MyFunction();
return 0;
}
For example
void MyFunction()
{
printf( "This function is called by %s in file %s on line $i.\n", func, file, line ); // Where func, file and lines should be replaced
}
int main()
{
MyFunction();
return 0;
}
On Linux, you might use backtrace to dump the stack:
backtrace() returns a backtrace for the calling program, in the array pointed to by buffer. A backtrace is the series of currently active function calls for the program. Each item in the array pointed to by buffer is of type void *, and is the return address from the corresponding stack frame. The size argument specifies the maximum number of addresses that can be stored in buffer. If the backtrace is larger than size, then the addresses corresponding to the size most recent function calls are returned; to obtain the complete backtrace, make sure that buffer and size are large enough.