medfall

A super great game engine
Log | Files | Refs

commit b106bb82d1660f5fa7f805abf70fad0cd0520a3e
parent 40aa75756231db90e95a1d0981a1e41ccd498f3e
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Wed, 29 May 2019 13:02:31 +0300

autogdb don't gdb on sigint

Diffstat:
Maudio.cc | 2+-
Mautogdb.h | 16+++++++---------
Mmain.cc | 2+-
Mpp.cc | 2+-
4 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/audio.cc b/audio.cc @@ -29,7 +29,7 @@ static SoundData make_sin_wave( u32 sample_rate, u32 frequency ) { static u8 memory[ megabytes( 64 ) ]; int main( int argc, char ** argv ) { - install_debug_signal_handlers( true ); + install_debug_signal_handlers(); MemoryArena arena; memarena_init( &arena, memory, sizeof( memory ) ); diff --git a/autogdb.h b/autogdb.h @@ -18,7 +18,7 @@ static void pause_forever( int signal ) { } static void uninstall_debug_signal_handlers() { - signal( SIGINT, SIG_IGN ); + signal( SIGQUIT, SIG_IGN ); signal( SIGILL, pause_forever ); signal( SIGTRAP, SIG_IGN ); signal( SIGABRT, pause_forever ); @@ -26,7 +26,7 @@ static void uninstall_debug_signal_handlers() { } static void reset_debug_signal_handlers() { - signal( SIGINT, SIG_DFL ); + signal( SIGQUIT, SIG_DFL ); signal( SIGILL, SIG_DFL ); signal( SIGTRAP, SIG_DFL ); signal( SIGABRT, SIG_DFL ); @@ -37,7 +37,7 @@ static void prompt_to_run_gdb( int signal ) { uninstall_debug_signal_handlers(); const char * signal_names[ NSIG ]; - signal_names[ SIGINT ] = "SIGINT"; + signal_names[ SIGQUIT ] = "SIGQUIT"; signal_names[ SIGILL ] = "SIGILL"; signal_names[ SIGTRAP ] = "SIGTRAP"; signal_names[ SIGABRT ] = "SIGABRT"; @@ -61,12 +61,12 @@ static void prompt_to_run_gdb( int signal ) { reset_debug_signal_handlers(); if( child_pid == 0 ) { - execlp( "cgdb", "cgdb", "--", "-q", "-p", crashed_pid, ( char * ) 0 ); + // execlp( "cgdb", "cgdb", "--", "-q", "-p", crashed_pid, ( char * ) 0 ); execlp( "gdb", "gdb", "-q", "-p", crashed_pid, ( char * ) 0 ); err( 1, "execlp" ); } - if( signal != SIGINT && signal != SIGTRAP ) { + if( signal != SIGQUIT && signal != SIGTRAP ) { waitpid( child_pid, NULL, 0 ); exit( 1 ); } @@ -108,12 +108,10 @@ static bool being_debugged() { return WEXITSTATUS( status ) == 1; } -static void install_debug_signal_handlers( bool debug_on_sigint ) { +static void install_debug_signal_handlers() { if( being_debugged() ) return; - if( debug_on_sigint ) { - signal( SIGINT, prompt_to_run_gdb ); - } + signal( SIGQUIT, prompt_to_run_gdb ); signal( SIGILL, prompt_to_run_gdb ); signal( SIGTRAP, prompt_to_run_gdb ); signal( SIGABRT, prompt_to_run_gdb ); diff --git a/main.cc b/main.cc @@ -22,7 +22,7 @@ GameInit game_init; GameFrame game_frame; int main( int argc, char ** argv ) { - install_debug_signal_handlers( true ); + install_debug_signal_handlers(); size_t persistent_size = megabytes( 256 ); u8 * persistent_memory = ( u8 * ) malloc( persistent_size ); diff --git a/pp.cc b/pp.cc @@ -257,7 +257,7 @@ static size_t place_trees( MemoryArena * arena, const array2d< u16 > heightmap, } int main( int argc, char ** argv ) { - install_debug_signal_handlers( true ); + install_debug_signal_handlers(); static u8 arena_memory[ megabytes( 512 ) ]; MemoryArena arena;