The author faced a difficult issue with an application not shutting down correctly due to segfaults or termination without exceptions. This article addresses this issue by adding runtime instrumentation from gcc to log destructors. With example code and setup instructions, it helped identify leftover code from a closed-source framework causing the shutdown problem. The author used C-style code for logging functions to prevent recursive crashes and noted that this approach might impact performance. This method was tested only on Linux with GCC and provides insights into handling shutdown issues in large, multi-threaded codebases. The article showcases example output with filtering and surprising results from adding a C++ json library.
https://raymii.org/s/software/Logging_all_Cpp_destructors_poor_mans_run-time_tracing.html