Skip to content

BlackOverride/GCrash

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This module dumps the lua stack if the server segfaults. It also allows you to define a crash handler in lua able to inspect the stack and write to the dump file. Read lua/gcrash.lua for information on function behavior.

The dump format is a simple text file containing a stack trace and any extra data generated by the crash handler. Dump files are saved under garrysmod/gcrash/ with a name containing the date and time of the crash.

UPDATE ~ x64 - 2025

Update on x64 Builds for GCrash Testing the x64 builds on Linux proved to be unstable and resulted in random crashes. As a result, I've decided to simplify the x64 version of GCrash to focus solely on the Watchdog feature (freeze/hang detection and auto-restart).

As of 2025, Garry's Mod now supports dumping its state to text files. While this feature isn't as comprehensive as GCrash's stack dumps, it helps retain useful information. Additionally, Garry's Mod offers a console buffer for error logs, which can provide further insights in case of crashes.

With this in mind, I've removed the full GCrash functionality from the x64 build and kept only the infinite loop and server freeze detection, with automatic restart. This change is aimed at improving stability for x64 servers.


Please note that if you're re-compiling, you’ll need to adjust the source files accordingly. The x86 version will remain unchanged and retain all previous features.

Installing

Get the released (or build from source) gmsv_gcrash_linux.dll and put it in SERVER_ROOT/garrysmod/lua/bin/, You may have to create the bin folder. If you want to use the default lua handler, you can put gcrash.lua in lua/autorun/server/.

Building

If you wish to build the module yourself, the build files are included in this repo.

Linux

  1. Get premake5 and place it next to BuildProjects.bat
  2. Acquire an up-to-date version of lua_shared.so and copy it to libs/garrysmod/bin (32 bit) or libs/bin/linux64 (64 bit)
  3. Run premake5 --os=linux gmake2
  4. CD into projects/linux/
  5. make optionally with config=(debug|release|debug64|release64)
  6. Output is build/gmsv_gcrash_linux.dll or build/gmsv_gcrash_linux64.dll (the makefile renames the created .so to the GMod module format)

Windows

Windows is not yet supported.

TODO

  • Improve the default lua handler