mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-31 00:30:57 +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
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_STRING_H
|
#ifdef HAVE_STRING_H
|
||||||
# include "string.h"
|
# include <string.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_STRINGS_H
|
#ifdef HAVE_STRINGS_H
|
||||||
# include "strings.h"
|
# include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
#include "QF/cmd.h"
|
#include "QF/cmd.h"
|
||||||
#include "QF/cvar.h"
|
#include "QF/cvar.h"
|
||||||
|
@ -61,7 +62,7 @@ func_t SpectatorThink;
|
||||||
func_t UserInfoCallback;
|
func_t UserInfoCallback;
|
||||||
|
|
||||||
static int reserved_edicts = MAX_CLIENTS;
|
static int reserved_edicts = MAX_CLIENTS;
|
||||||
|
static void (*old_seg_handler) (int);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
free_edict (progs_t *pr, edict_t *ent)
|
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;
|
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
|
void
|
||||||
SV_LoadProgs (void)
|
SV_LoadProgs (void)
|
||||||
{
|
{
|
||||||
|
@ -360,6 +369,8 @@ SV_Progs_Init (void)
|
||||||
"Display summary information on the edicts in the game.");
|
"Display summary information on the edicts in the game.");
|
||||||
Cmd_AddCommand ("profile", PR_Profile_f, "FIXME: Report information about "
|
Cmd_AddCommand ("profile", PR_Profile_f, "FIXME: Report information about "
|
||||||
"QuakeC Stuff (\?\?\?) No Description");
|
"QuakeC Stuff (\?\?\?) No Description");
|
||||||
|
|
||||||
|
old_seg_handler = signal (SIGSEGV, seg_fault_handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue