Game Development Community

Core dump under Linux

by Gregory "Centove" McLean · in Torque Game Engine · 04/28/2005 (3:16 pm) · 4 replies

Not really sure if this is considered a bug per say, but there are times when torque crashes it would be mighty handy to get a core dump out of it for some port mortem debugging.. To facilitate that is quite easy...

in engine/platformX86UNIX/x86UNIXWindow.cc around line 154 (InitSDL function)
#ifdef TORQUE_DEBUG
   // On DEBUG builds we _want_ a core file to examine..
   if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) != 0)
      return false;
#else
   if (SDL_Init(SDL_INIT_VIDEO) != 0)
      return false;
#endif

That will disable the SDL Parachute code and allow core files to be generated, I keyed it to the DEBUG builds only but it should be fairly simple to change if desired.

#1
04/29/2005 (10:26 am)
Ah, nice patch. Thanks, Greg, this is on the list.
#2
05/07/2005 (11:49 am)
Thanks, that'll be useful!

Note also that "ulimit -c" needs to be non-zero (and at least as big as the expected dump). Some distros default this to zero because the average user wouldn't know what to do with the core dump.
#3
01/22/2008 (12:27 pm)
I implemented the code above and it did indeed produce a core dump --- the problem is it ALWAYS produces a core dump! I thought if I am exiting normally (i.e. exit(0);) it shouldn't create a core dump, right?

CORRECTION: It doesn't produce a core dump if I send the process a 'kill -9'. Still, not sure why it does it when exiting with a normal status from within the program?
#4
01/22/2008 (12:34 pm)
Well I found that using Platform::postQuitMessage(0); instead of exit(0); did not produce the core dump, so that works for my purposes.