Improve Odamex's crash handling
Created attachment 545 [details]
Crash handling patch.
The big improvement with this patch is adding crash handling to the Odamex client when compiled on Windows with Visual Studio and on Linux with GCC.
On Windows, compiled with Visual Studio, Odamex will now create a minidump file with the current date if it crashes. This dump file can be loaded with WinDBG or Visual Studio to examine the call stack and some variables related to the crash.
On Linux, compiled with GCC, Odamex will create a dump textfile on crash that contains as much of a backtrace as it can manage, along with information on the signal that caused the crash.
Some notes on the patch:
- Minidumps are a little sparse on information, but turning on settings that gave more meaningful variable information made the dumps take up hundreds of megabytes.
- The preferred method of debugging crashes on Linux is a core dump. However, similarly to Minidumps with "good" settings, they're also huge.
- I have not tested the crash handling on OSX. According to Stack Overflow, OSX since 10.5 has the proper functions to generate the backtrace similarly to Linux. The FreeBSD manpage reveals similar functions.
- There is currently no crash handling for the server. Most server hosts use Linux anyway, and I think it's reasonable to expect them to generate core dumps with a ulimit tweak.
- Most importantly, there is currently no crash handling for MinGW. In my preliminary reading, in theory it should be possible to write a minidump file from MinGW-w64, but the stack trace will be completely illegible due to GCC mangling names in a different fashion than MSVC. In addition, the backtrace functions that are available to us on Linux are not available on Windows, period. I think there IS some archaic way to get a stack trace with MinGW, but it will have to wait for a future patch.
Almost forgot to mention, there is a new console command `crashout`. It crashes Odamex with a std::terminate(). It's named after a similar command in ZDoom, and I used it for testing crash handlers.
Added _MSC_VER to patch to filter out gcc on windows since it is unsupported, applied in 5520, cheers!
*** Bug 16 has been marked as a duplicate of this bug. ***
After consulting with Alex, marking fixed. Thank you Alex!