mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
segmentation fault handler from kkqwsv (thanks, Bill;) but with a couple
minor improvements (you get a core file if the seg wasn't triggered by progs).
This commit is contained in:
parent
7aec6e253a
commit
ea966952be
1 changed files with 15 additions and 4 deletions
|
@ -27,14 +27,15 @@
|
|||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
# include <config.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include "string.h"
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include "strings.h"
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#include <signal.h>
|
||||
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/cvar.h"
|
||||
|
@ -61,7 +62,7 @@ func_t SpectatorThink;
|
|||
func_t UserInfoCallback;
|
||||
|
||||
static int reserved_edicts = MAX_CLIENTS;
|
||||
|
||||
static void (*old_seg_handler) (int);
|
||||
|
||||
static void
|
||||
free_edict (progs_t *pr, edict_t *ent)
|
||||
|
@ -160,6 +161,14 @@ parse_field (progs_t *pr, const char *key, const char *value)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
seg_fault_handler(int whatever)
|
||||
{
|
||||
if (sv_pr_state.pr_xfunction)
|
||||
PR_RunError (&sv_pr_state, "Segmentation Fault\n");
|
||||
signal (SIGSEGV, old_seg_handler);
|
||||
}
|
||||
|
||||
void
|
||||
SV_LoadProgs (void)
|
||||
{
|
||||
|
@ -360,6 +369,8 @@ SV_Progs_Init (void)
|
|||
"Display summary information on the edicts in the game.");
|
||||
Cmd_AddCommand ("profile", PR_Profile_f, "FIXME: Report information about "
|
||||
"QuakeC Stuff (\?\?\?) No Description");
|
||||
|
||||
old_seg_handler = signal (SIGSEGV, seg_fault_handler);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue