mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-26 03:30:46 +00:00
Wrap most calls to exit() with a macro that will print the exit status, file name, line number, and function name to the log when using a debug build.
git-svn-id: https://svn.eduke32.com/eduke32@4502 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
94ccdb076d
commit
a03f9bce40
12 changed files with 29 additions and 27 deletions
|
@ -864,11 +864,13 @@ void *xrealloc(void *ptr, bsize_t size);
|
||||||
# define Xmalloc(size) (EDUKE32_PRE_XALLLOC, xmalloc(size))
|
# define Xmalloc(size) (EDUKE32_PRE_XALLLOC, xmalloc(size))
|
||||||
# define Xcalloc(nmemb, size) (EDUKE32_PRE_XALLLOC, xcalloc(nmemb, size))
|
# define Xcalloc(nmemb, size) (EDUKE32_PRE_XALLLOC, xcalloc(nmemb, size))
|
||||||
# define Xrealloc(ptr, size) (EDUKE32_PRE_XALLLOC, xrealloc(ptr, size))
|
# define Xrealloc(ptr, size) (EDUKE32_PRE_XALLLOC, xrealloc(ptr, size))
|
||||||
|
# define Bexit(status) do { initprintf("exit(%d) at %s:%d in %s()\n", status, __FILE__, __LINE__, EDUKE32_FUNCTION); exit(status); } while (0)
|
||||||
#else
|
#else
|
||||||
# define Xstrdup xstrdup
|
# define Xstrdup xstrdup
|
||||||
# define Xmalloc xmalloc
|
# define Xmalloc xmalloc
|
||||||
# define Xcalloc xcalloc
|
# define Xcalloc xcalloc
|
||||||
# define Xrealloc xrealloc
|
# define Xrealloc xrealloc
|
||||||
|
# define Bexit exit
|
||||||
#endif
|
#endif
|
||||||
//////////
|
//////////
|
||||||
|
|
||||||
|
|
|
@ -573,7 +573,7 @@ int32_t app_main(int32_t argc, const char **argv)
|
||||||
if (quitevent || !startwin_run())
|
if (quitevent || !startwin_run())
|
||||||
{
|
{
|
||||||
uninitengine();
|
uninitengine();
|
||||||
exit(0);
|
Bexit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -680,7 +680,7 @@ int32_t app_main(int32_t argc, const char **argv)
|
||||||
ExtUnInit();
|
ExtUnInit();
|
||||||
uninitengine();
|
uninitengine();
|
||||||
Bprintf("%d * %d not supported in this graphics mode\n",xdim2d,ydim2d);
|
Bprintf("%d * %d not supported in this graphics mode\n",xdim2d,ydim2d);
|
||||||
exit(0);
|
Bexit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// executed once per init, but after setgamemode so that OSD has the right width
|
// executed once per init, but after setgamemode so that OSD has the right width
|
||||||
|
@ -706,7 +706,7 @@ int32_t app_main(int32_t argc, const char **argv)
|
||||||
ExtUnInit();
|
ExtUnInit();
|
||||||
uninitengine();
|
uninitengine();
|
||||||
Bprintf("%d * %d not supported in this graphics mode\n",xdim,ydim);
|
Bprintf("%d * %d not supported in this graphics mode\n",xdim,ydim);
|
||||||
exit(0);
|
Bexit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// executed once per init, but after setgamemode so that OSD has the right width
|
// executed once per init, but after setgamemode so that OSD has the right width
|
||||||
|
@ -7554,7 +7554,7 @@ end_insert_points:
|
||||||
if ((j&0xffff) != 0xebf)
|
if ((j&0xffff) != 0xebf)
|
||||||
{
|
{
|
||||||
printf("Don't screw with my name.\n");
|
printf("Don't screw with my name.\n");
|
||||||
exit(0);
|
Bexit(0);
|
||||||
}*/
|
}*/
|
||||||
//printext16(9L,336+9L,4,-1,kensig,0);
|
//printext16(9L,336+9L,4,-1,kensig,0);
|
||||||
//printext16(8L,336+8L,12,-1,kensig,0);
|
//printext16(8L,336+8L,12,-1,kensig,0);
|
||||||
|
@ -7884,7 +7884,7 @@ CANCEL:
|
||||||
// clearfilenames();
|
// clearfilenames();
|
||||||
uninitengine();
|
uninitengine();
|
||||||
|
|
||||||
exit(0);
|
Bexit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// printmessage16("");
|
// printmessage16("");
|
||||||
|
@ -7919,7 +7919,7 @@ CANCEL:
|
||||||
ExtUnInit();
|
ExtUnInit();
|
||||||
// clearfilenames();
|
// clearfilenames();
|
||||||
uninitengine();
|
uninitengine();
|
||||||
exit(1);
|
Bexit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
setbrightness(GAMMA_CALC,0,0);
|
setbrightness(GAMMA_CALC,0,0);
|
||||||
|
|
|
@ -323,7 +323,7 @@ static void reportandexit(const char *errormessage)
|
||||||
Bprintf("Cache length sum = %d\n",j);
|
Bprintf("Cache length sum = %d\n",j);
|
||||||
#endif
|
#endif
|
||||||
initprintf("ERROR: %s\n",errormessage);
|
initprintf("ERROR: %s\n",errormessage);
|
||||||
exit(1);
|
Bexit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -840,7 +840,7 @@ int32_t kopen4load(const char *filename, char searchfirst)
|
||||||
if (newhandle < 0)
|
if (newhandle < 0)
|
||||||
{
|
{
|
||||||
Bprintf("TOO MANY FILES OPEN IN FILE GROUPING SYSTEM!");
|
Bprintf("TOO MANY FILES OPEN IN FILE GROUPING SYSTEM!");
|
||||||
exit(0);
|
Bexit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ static void handle_potential_memerr(void *ptr)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
exit(EXIT_FAILURE);
|
Bexit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8700,7 +8700,7 @@ void *blockptr = NULL;
|
||||||
int32_t preinitengine(void)
|
int32_t preinitengine(void)
|
||||||
{
|
{
|
||||||
char *e;
|
char *e;
|
||||||
if (initsystem()) exit(9);
|
if (initsystem()) Bexit(9);
|
||||||
|
|
||||||
makeasmwriteable();
|
makeasmwriteable();
|
||||||
|
|
||||||
|
@ -9081,7 +9081,7 @@ int32_t drawrooms(int32_t daposx, int32_t daposy, int32_t daposz,
|
||||||
|
|
||||||
//if (smostwallcnt < 0)
|
//if (smostwallcnt < 0)
|
||||||
// if (getkensmessagecrc(FP_OFF(kensmessage)) != 0x56c764d4)
|
// if (getkensmessagecrc(FP_OFF(kensmessage)) != 0x56c764d4)
|
||||||
// { /* setvmode(0x3);*/ OSD_Printf("Nice try.\n"); exit(0); }
|
// { /* setvmode(0x3);*/ OSD_Printf("Nice try.\n"); Bexit(0); }
|
||||||
|
|
||||||
numhits = xdimen; numscans = 0; numbunches = 0;
|
numhits = xdimen; numscans = 0; numbunches = 0;
|
||||||
maskwallcnt = 0; smostwallcnt = 0; smostcnt = 0; spritesortcnt = 0;
|
maskwallcnt = 0; smostwallcnt = 0; smostcnt = 0; spritesortcnt = 0;
|
||||||
|
@ -11237,7 +11237,7 @@ int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t da
|
||||||
Bstrcpy(kensmessage,"!!!! BUILD engine&tools programmed by Ken Silverman of E.G. RI."
|
Bstrcpy(kensmessage,"!!!! BUILD engine&tools programmed by Ken Silverman of E.G. RI."
|
||||||
" (c) Copyright 1995 Ken Silverman. Summary: BUILD = Ken. !!!!");
|
" (c) Copyright 1995 Ken Silverman. Summary: BUILD = Ken. !!!!");
|
||||||
// if (getkensmessagecrc(FP_OFF(kensmessage)) != 0x56c764d4)
|
// if (getkensmessagecrc(FP_OFF(kensmessage)) != 0x56c764d4)
|
||||||
// { OSD_Printf("Nice try.\n"); exit(0); }
|
// { OSD_Printf("Nice try.\n"); Bexit(0); }
|
||||||
|
|
||||||
//if (checkvideomode(&daxdim, &daydim, dabpp, davidoption)<0) return (-1);
|
//if (checkvideomode(&daxdim, &daydim, dabpp, davidoption)<0) return (-1);
|
||||||
|
|
||||||
|
@ -11666,7 +11666,7 @@ void loadtile(int16_t tilenume)
|
||||||
{
|
{
|
||||||
initprintf("Failed opening ART file \"%s\"!\n", fn);
|
initprintf("Failed opening ART file \"%s\"!\n", fn);
|
||||||
uninitengine();
|
uninitengine();
|
||||||
exit(11);
|
Bexit(11);
|
||||||
}
|
}
|
||||||
|
|
||||||
artfilnum = i;
|
artfilnum = i;
|
||||||
|
@ -14816,7 +14816,7 @@ static void maybe_alloc_palookup(int32_t palnum)
|
||||||
{
|
{
|
||||||
alloc_palookup(palnum);
|
alloc_palookup(palnum);
|
||||||
if (palookup[palnum] == NULL)
|
if (palookup[palnum] == NULL)
|
||||||
exit(1);
|
Bexit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ static void L_OnOutOfMem(void)
|
||||||
extern void uninitengine(void);
|
extern void uninitengine(void);
|
||||||
OSD_Printf("Out of memory in Lunatic.\n");
|
OSD_Printf("Out of memory in Lunatic.\n");
|
||||||
uninitengine();
|
uninitengine();
|
||||||
exit(127);
|
Bexit(127);
|
||||||
}
|
}
|
||||||
|
|
||||||
void (*L_ErrorFunc)(const char *) = NULL;
|
void (*L_ErrorFunc)(const char *) = NULL;
|
||||||
|
|
|
@ -29,7 +29,7 @@ static void QuitOnFatalError(const char *msg)
|
||||||
if (msg)
|
if (msg)
|
||||||
initprintf("%s\n", msg);
|
initprintf("%s\n", msg);
|
||||||
uninitengine();
|
uninitengine();
|
||||||
exit(1);
|
Bexit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -384,7 +384,7 @@ static void sighandler(int signum)
|
||||||
attach_debugger_here();
|
attach_debugger_here();
|
||||||
app_crashhandler();
|
app_crashhandler();
|
||||||
uninitsystem();
|
uninitsystem();
|
||||||
exit(8);
|
Bexit(8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8598,7 +8598,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
|
||||||
if (!Bstrcasecmp(c+1,"?") || !Bstrcasecmp(c+1,"help") || !Bstrcasecmp(c+1,"-help"))
|
if (!Bstrcasecmp(c+1,"?") || !Bstrcasecmp(c+1,"help") || !Bstrcasecmp(c+1,"-help"))
|
||||||
{
|
{
|
||||||
G_ShowParameterHelp();
|
G_ShowParameterHelp();
|
||||||
exit(0);
|
Bexit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Bstrcasecmp(c+1, "g") || !Bstrcasecmp(c+1, "grp"))
|
if (!Bstrcasecmp(c+1, "g") || !Bstrcasecmp(c+1, "grp"))
|
||||||
|
@ -8962,7 +8962,7 @@ static int32_t osdcmd_quit(const osdfuncparm_t *parm)
|
||||||
|
|
||||||
Bfflush(NULL);
|
Bfflush(NULL);
|
||||||
|
|
||||||
exit(0);
|
Bexit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t osdcmd_editorgridextent(const osdfuncparm_t *parm)
|
static int32_t osdcmd_editorgridextent(const osdfuncparm_t *parm)
|
||||||
|
|
|
@ -9752,7 +9752,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
|
||||||
if (!Bstrcasecmp(c+1,"?") || !Bstrcasecmp(c+1,"help") || !Bstrcasecmp(c+1,"-help"))
|
if (!Bstrcasecmp(c+1,"?") || !Bstrcasecmp(c+1,"help") || !Bstrcasecmp(c+1,"-help"))
|
||||||
{
|
{
|
||||||
G_ShowParameterHelp();
|
G_ShowParameterHelp();
|
||||||
exit(0);
|
Bexit(0);
|
||||||
}
|
}
|
||||||
if (!Bstrcasecmp(c+1,"addon"))
|
if (!Bstrcasecmp(c+1,"addon"))
|
||||||
{
|
{
|
||||||
|
@ -9772,7 +9772,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
|
||||||
if (!Bstrcasecmp(c+1,"debughelp") || !Bstrcasecmp(c+1,"-debughelp"))
|
if (!Bstrcasecmp(c+1,"debughelp") || !Bstrcasecmp(c+1,"-debughelp"))
|
||||||
{
|
{
|
||||||
G_ShowDebugHelp();
|
G_ShowDebugHelp();
|
||||||
exit(0);
|
Bexit(0);
|
||||||
}
|
}
|
||||||
if (!Bstrcasecmp(c+1,"grp") || !Bstrcasecmp(c+1,"g"))
|
if (!Bstrcasecmp(c+1,"grp") || !Bstrcasecmp(c+1,"g"))
|
||||||
{
|
{
|
||||||
|
@ -10822,7 +10822,7 @@ static void G_Startup(void)
|
||||||
"There was a problem initializing the Build engine: %s", engineerrstr);
|
"There was a problem initializing the Build engine: %s", engineerrstr);
|
||||||
G_Cleanup();
|
G_Cleanup();
|
||||||
ERRprintf("G_Startup: There was a problem initializing the Build engine: %s\n", engineerrstr);
|
ERRprintf("G_Startup: There was a problem initializing the Build engine: %s\n", engineerrstr);
|
||||||
exit(6);
|
Bexit(6);
|
||||||
}
|
}
|
||||||
|
|
||||||
setbasepaltable(basepaltable, BASEPALCOUNT);
|
setbasepaltable(basepaltable, BASEPALCOUNT);
|
||||||
|
@ -11420,7 +11420,7 @@ int32_t app_main(int32_t argc, const char **argv)
|
||||||
wm_msgbox("Build Engine Initialization Error",
|
wm_msgbox("Build Engine Initialization Error",
|
||||||
"There was a problem initializing the Build engine: %s", engineerrstr);
|
"There was a problem initializing the Build engine: %s", engineerrstr);
|
||||||
ERRprintf("app_main: There was a problem initializing the Build engine: %s\n", engineerrstr);
|
ERRprintf("app_main: There was a problem initializing the Build engine: %s\n", engineerrstr);
|
||||||
exit(2);
|
Bexit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Bstrcmp(setupfilename, SETUPFILENAME))
|
if (Bstrcmp(setupfilename, SETUPFILENAME))
|
||||||
|
@ -11470,7 +11470,7 @@ int32_t app_main(int32_t argc, const char **argv)
|
||||||
if (quitevent || !startwin_run())
|
if (quitevent || !startwin_run())
|
||||||
{
|
{
|
||||||
uninitengine();
|
uninitengine();
|
||||||
exit(0);
|
Bexit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -11726,7 +11726,7 @@ int32_t app_main(int32_t argc, const char **argv)
|
||||||
{
|
{
|
||||||
ERRprintf("There was an error initializing the CONTROL system.\n");
|
ERRprintf("There was an error initializing the CONTROL system.\n");
|
||||||
uninitengine();
|
uninitengine();
|
||||||
exit(5);
|
Bexit(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
G_SetupGameButtons();
|
G_SetupGameButtons();
|
||||||
|
|
|
@ -2530,7 +2530,7 @@ static int32_t C_ParseCommand(int32_t loop)
|
||||||
{
|
{
|
||||||
initprintf("Aborted.\n");
|
initprintf("Aborted.\n");
|
||||||
G_Shutdown();
|
G_Shutdown();
|
||||||
exit(0);
|
Bexit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_numCompilerErrors > 63 || (*textptr == '\0') || (*(textptr+1) == '\0') || C_SkipComments())
|
if (g_numCompilerErrors > 63 || (*textptr == '\0') || (*(textptr+1) == '\0') || C_SkipComments())
|
||||||
|
|
|
@ -1496,7 +1496,7 @@ void Gv_InitWeaponPointers(void)
|
||||||
if (!aplWeaponClip[i])
|
if (!aplWeaponClip[i])
|
||||||
{
|
{
|
||||||
initprintf("ERROR: NULL weapon! WTF?!\n");
|
initprintf("ERROR: NULL weapon! WTF?!\n");
|
||||||
// exit(0);
|
// Bexit(0);
|
||||||
G_Shutdown();
|
G_Shutdown();
|
||||||
}
|
}
|
||||||
Bsprintf(aszBuf,"WEAPON%d_RELOAD",i);
|
Bsprintf(aszBuf,"WEAPON%d_RELOAD",i);
|
||||||
|
|
Loading…
Reference in a new issue