1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-10-08 23:22:25 +02:00

Enabled terminate handler and call stack writing on all platforms

Attempt to get a bit more debug info from crashes. VCMI will now:
- use c++ terminate handler on any platform in release builds
- attempt to write call stack to log file using boost::callstack

Since I use std::set_terminate this will only affect c++ exceptions, e.g.
std::runtime_error and will not affect OS signals, e.g. SIGSEGV. Handling
signals is OS-specific and has a lot of limitations that I don't want to
investigate. Besides - most of our crashes are now caused by c++
exceptions.

Haven't tested on other platforms, but should at the very least write
exception information (`e.what()`) for all exceptions and function names
for methods exported from dll's (libvcmi.so & AI's). Possibly more, if
debug information is present.
This commit is contained in:
Ivan Savenko
2024-08-01 21:54:24 +00:00
parent 257fb8c70c
commit 13b2008f79
2 changed files with 43 additions and 25 deletions

View File

@@ -102,6 +102,12 @@ static_assert(sizeof(bool) == 1, "Bool needs to be 1 byte in size.");
# define STRONG_INLINE inline
#endif
// Required for building boost::stacktrace on macOS.
// See https://github.com/boostorg/stacktrace/issues/88
#if defined(VCMI_APPLE)
#define _GNU_SOURCE
#endif
#define _USE_MATH_DEFINES
#include <algorithm>