From d5583ba0401fc10a98bb2bec6b122f6f379ee1b6 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 11 May 2025 15:24:22 +0200 Subject: [PATCH] add "nofork" parameter to disable process forking might be useful for gdb and perf --- src/sdl/i_system.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 549fdf7bd..e23f155e0 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -1923,7 +1923,10 @@ INT32 I_StartupSystem(void) SDL_GetVersion(&SDLlinked); I_StartupConsole(); #ifdef NEWSIGNALHANDLER - I_Fork(); + // This is useful when debugging. It lets GDB attach to + // the correct process easily. + if (!M_CheckParm("-nofork")) + I_Fork(); #endif #ifdef HAVE_THREADS I_start_threads(); @@ -2215,9 +2218,10 @@ void I_ShutdownSystem(void) { INT32 c; -#ifndef NEWSIGNALHANDLER - I_ShutdownConsole(); +#ifdef NEWSIGNALHANDLER + if (M_CheckParm("-nofork")) #endif + I_ShutdownConsole(); for (c = MAX_QUIT_FUNCS-1; c >= 0; c--) if (quit_funcs[c])