Bug Tracker – Bug 1200

Improve Odamex's crash handling

Last modified: 2016-11-15 18:54:09 CST
Bug 1200 - (ARRAY(0x5acec98)) Improve Odamex's crash handling
(ARRAY(0x5acec98))
Improve Odamex's crash handling
Status: NEW
Product: Odamex
Classification: Unclassified
Component: Client
0.7.x
All All
: P1 enhancement
: ARRAY(0x5d38158) (view as bug list)
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2016-10-17 20:51:44 CDT by Alexander Mayfield
Modified: 2016-11-15 18:54 CST (History)
2 users (show)

See Also:


Attachments
Crash handling patch. (10.22 KB, patch)
2016-10-17 20:51:44 CDT, Alexander Mayfield
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Mayfield 2016-10-17 20:51:44 CDT
Created ﷒0﷓
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.
Comment 1 Alexander Mayfield 2016-10-17 20:53:08 CDT
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.
Comment 2 Russell Rice 2016-10-28 19:01:25 CDT
Added _MSC_VER to patch to filter out gcc on windows since it is unsupported, applied in 5520, cheers!
Comment 3 HeX_Vulture 2016-11-15 18:54:09 CST
*** Bug 16 has been marked as a duplicate of this bug. ***