Skip to content

Garry's Mod SIGSEGV handler to dump the Lua state

Notifications You must be signed in to change notification settings

Thomasims/GCrash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 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.

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