Debugging and Stack Dump updates
This merge request updates SRB2's stack dump handler systems. Previously, SRB2 only (technically by way of actual functioningness) had two stack dumpers: one for Windows, Dr.Mingw, and one for UNIX based systems, the standard backtrace library. However, Windows's stack dumper only appeared to work on 32-bit based systems.
This merge request changes that, adding a new multiplatform stack dumper, libbacktrace, allowing for multiplatform stack dump compatibility. Dr.Mingw has been kept for 32-bit Windows compatibility, since libbacktrace doesn't appear to work on that platform at the moment, but has been updated so that the DLLs for the library, exchndl.dll and mgwhelp.dll, no longer have to be packaged with the base game. An older stack dump library for Windows, BugTrap, has been readded, alongside its DLLs, but is not recommended for use. All stack dump handlers mentioned have also had their code improved as well.
By default, the game is intended to compile with libbacktrace
on a 64-bit Windows compilation, Dr.Mingw
on a 32-bit Windows compilation, and the standard UNIX backtrack library on any systems with the normal backtrace library present.
However, in order for stack dumping to work as intended, both GNU Makefiles and CMake have received some updates. By default, the game now compiles only one executable, containing everything, including debug symbols. This allows the stack dumpers to work as intended, and even improves how the older Dr.Mingw library worked, but a side effect of this is that the game's executable size has increased by around 20MB as a result.
The old functionality to compile a separate executable with the debug symbols still exists, behind the compiler flags DEBUGSYMBOLS_SEPARATE=1
for GNU Makefiles, and SRB2_CONFIG_DEBUGSYMBOLS_SEPARATE
for CMake.
A few more compiler flags have been added as well.
For GNU Makefiles:
-
HAVE_DRMINGW
: Compiles with Dr.Mingw support. -
NO_DRMINGW
: Opposite of the above. -
HAVE_LIBBACKTRACE
: Compiles with libbacktrace support. -
NO_LIBBACKTRACE
: Opposite of the above. -
HAVE_BUGTRAP
: Compiles with BugTrap support.
For CMake:
-
SRB2_CONFIG_EXECTYPE
The type of stack dump handler to compile with. Options are Default, libbacktrace, Dr.Mingw, and BugTrap.
Other Minor Additions
The libs
and thirdparty
folders have been updated to add support for these libraries.
This merge request also updates functions like the signal handlers, I_ReportSignal, I_Quit, and I_Error to function similarly to how they do in Ring Racers. Signal handlers and a stack dump handler for dedicated builds has also been added as well.
The crash log had it's file name changed to 'srb2-crash-log.txt' (or srb2-crash-log.RPT for Dr.Mingw) and its text have also been updated, providing a little more info to developers as to how a user's crash may have happened. The crash dialog message has also been updated as well, adding slight humor and a Gitlab
button that sends you to the issues tab on this repository to report any issues.
Attached here is an example of what the stack dump handlers can produce. srb2-crash-log.txt