little debugging helper for linux

git-svn-id: https://svn.eduke32.com/eduke32@1485 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2009-08-03 22:15:53 +00:00
parent a43f31e46c
commit 53418727e9

View file

@ -6,6 +6,7 @@
#include <stdlib.h>
#include <math.h>
#include <signal.h>
#include "sdl_inc.h"
#include "compat.h"
#include "sdlayer.h"
@ -224,6 +225,20 @@ void setvsync(int32_t sync)
}
#endif
static void attach_debugger_here(void){}
static void sighandler(int signum)
{
if (signum==SIGSEGV)
{
SDL_WM_GrabInput(SDL_GRAB_OFF);
SDL_ShowCursor(SDL_ENABLE);
attach_debugger_here();
uninitsystem();
exit(1);
}
}
//
// initsystem() -- init SDL systems
//
@ -262,6 +277,8 @@ int32_t initsystem(void)
return -1;
}
signal(SIGSEGV, sighandler);
atexit(uninitsystem);
frameplace = 0;