os: Handle SIGABRT

Without this, assertion failures can make life hard for users and those
trying to help them.

v2:
* Change commit log wording slightly to "can make life hard", since
  apparently e.g. logind can alleviate that somewhat.
* Set default handler for SIGABRT in
  hw/xfree86/common/xf86Init.c:InstallSignalHandlers() and
  hw/xquartz/quartz.c:QuartzInitOutput() (Eric Anholt)

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
This commit is contained in:
Michel Dänzer 2017-04-26 18:31:08 +09:00 committed by Adam Jackson
parent 23f2f1932a
commit 27a6b9f7c8
4 changed files with 9 additions and 0 deletions

View File

@ -309,6 +309,7 @@ InstallSignalHandlers(void)
}
else {
OsSignal(SIGSEGV, SIG_DFL);
OsSignal(SIGABRT, SIG_DFL);
OsSignal(SIGILL, SIG_DFL);
#ifdef SIGEMT
OsSignal(SIGEMT, SIG_DFL);

View File

@ -178,6 +178,7 @@ QuartzInitOutput(int argc,
{
/* For XQuartz, we want to just use the default signal handler to work better with CrashTracer */
signal(SIGSEGV, SIG_DFL);
signal(SIGABRT, SIG_DFL);
signal(SIGILL, SIG_DFL);
#ifdef SIGEMT
signal(SIGEMT, SIG_DFL);

View File

@ -173,6 +173,7 @@ OsInit(void)
int i;
int siglist[] = { SIGSEGV, SIGQUIT, SIGILL, SIGFPE, SIGBUS,
SIGABRT,
SIGSYS,
SIGXCPU,
SIGXFSZ,

View File

@ -1352,6 +1352,12 @@ OsAbort(void)
{
#ifndef __APPLE__
OsBlockSignals();
#endif
#if !defined(WIN32) || defined(__CYGWIN__)
/* abort() raises SIGABRT, so we have to stop handling that to prevent
* recursion
*/
OsSignal(SIGABRT, SIG_DFL);
#endif
abort();
}