Print backtrace after segfault or uncaught exception in C++