From d8ad8eb5d50af9198a3529f42ef0f4bf179c16c4 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 19 Feb 2023 22:02:37 -0800 Subject: [PATCH 1/2] Enable seg fault on I_Error ifdef DEVELOP This produces a backtrace for I_Errors. --- src/sdl/i_system.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 352313071..9362a540b 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -1891,8 +1891,8 @@ void I_Error(const char *error, ...) W_Shutdown(); -#if defined (PARANOIA) && defined (__CYGWIN__) - *(INT32 *)2 = 4; //Alam: Debug! +#if defined (PARANOIA) || defined (DEVELOP) + *(INT32 *)0 = 4; //Alam: Debug! #endif exit(-1); From 2bd5ee98861386f576ab6fff840dfa86c1ed6665 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 19 Feb 2023 22:20:48 -0800 Subject: [PATCH 2/2] Add a command to crash the game in DEVELOP builds --- src/d_main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/d_main.c b/src/d_main.c index c0b2ed383..d6a097607 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1181,6 +1181,13 @@ static void Command_assert(void) #endif } +#ifdef DEVELOP +static void Command_crash(void) +{ + I_Error("The game crashed on PURPOSE, because of the 'crash' command. (This is only enabled in DEVELOP builds.)"); +} +#endif + // // D_SRB2Main // @@ -1373,6 +1380,9 @@ void D_SRB2Main(void) COM_Init(); COM_AddCommand("assert", Command_assert); +#ifdef DEVELOP + COM_AddCommand("crash", Command_crash); +#endif #ifndef TESTERS // add any files specified on the command line with -file wadfile