Wrap _exit and exit.  Prints error message, and when running under GDB, raises SIGTRAP which causes debugger to break before exit.