We use stack traces in proprietary assert like macro to catch developer mistakes - when error is caught, stack trace is printed.
assert
I find gcc\'s pair
You can use DeathHandler - small C++ class which does everything for you, reliable.