Use backtrace() or StackWalker for Unix or Windows.
See this previous SO question:
Frage
Is there any methods to implement a 'printstacktrace' method in C++ like the Java do?
Lösung
Use backtrace() or StackWalker for Unix or Windows.
See this previous SO question: