diff --git a/Crashlytics/Crashlytics/Controllers/FIRCLSMetricKitManager.m b/Crashlytics/Crashlytics/Controllers/FIRCLSMetricKitManager.m index 0c081df9d08..40cbcedb907 100644 --- a/Crashlytics/Crashlytics/Controllers/FIRCLSMetricKitManager.m +++ b/Crashlytics/Crashlytics/Controllers/FIRCLSMetricKitManager.m @@ -438,6 +438,8 @@ - (NSString *)getSignalName:(NSNumber *)signalCode { return @"SIGSYS"; case SIGTRAP: return @"SIGTRAP"; + case SIGTERM: + return @"SIGTERM"; default: return @"UNKNOWN"; } diff --git a/Crashlytics/Crashlytics/Handlers/FIRCLSMachException.c b/Crashlytics/Crashlytics/Handlers/FIRCLSMachException.c index 92bc830edae..0b71808e7c6 100644 --- a/Crashlytics/Crashlytics/Handlers/FIRCLSMachException.c +++ b/Crashlytics/Crashlytics/Handlers/FIRCLSMachException.c @@ -150,6 +150,8 @@ exception_mask_t FIRCLSMachExceptionMaskForSignal(int signal) { return EXC_MASK_CRASH; case SIGFPE: return EXC_MASK_ARITHMETIC; + case SIGTERM: + return EXC_MASK_CRASH; } return 0; diff --git a/Crashlytics/Crashlytics/Handlers/FIRCLSSignal.c b/Crashlytics/Crashlytics/Handlers/FIRCLSSignal.c index 1fcdbf22aab..0e745932034 100644 --- a/Crashlytics/Crashlytics/Handlers/FIRCLSSignal.c +++ b/Crashlytics/Crashlytics/Handlers/FIRCLSSignal.c @@ -21,8 +21,17 @@ #include #if CLS_SIGNAL_SUPPORTED -static const int FIRCLSFatalSignals[FIRCLSSignalCount] = {SIGABRT, SIGBUS, SIGFPE, SIGILL, - SIGSEGV, SIGSYS, SIGTRAP}; +static const int FIRCLSFatalSignals[FIRCLSSignalCount] = { + SIGABRT, SIGBUS, SIGFPE, SIGILL, + SIGSEGV, SIGSYS, SIGTRAP, + // SIGTERM can be caught and is usually sent by iOS and variants + // when Apple wants to try and gracefully shutdown the app + // before sending a SIGKILL (which can't be caught). + // Some areas I've seen this happen are: + // - When the OS updates an app. + // - In some circumstances for Watchdog Events. + // - Resource overuse (CPU, Disk, ...). + SIGTERM}; #if CLS_USE_SIGALTSTACK static void FIRCLSSignalInstallAltStack(FIRCLSSignalReadContext *roContext); @@ -237,6 +246,9 @@ void FIRCLSSignalNameLookup(int number, int code, const char **name, const char case SIGTRAP: *name = "SIGTRAP"; break; + case SIGTERM: + *name = "SIGTERM"; + break; default: *name = "UNKNOWN"; break; diff --git a/Crashlytics/Crashlytics/Handlers/FIRCLSSignal.h b/Crashlytics/Crashlytics/Handlers/FIRCLSSignal.h index 17d14810080..e9e0478c259 100644 --- a/Crashlytics/Crashlytics/Handlers/FIRCLSSignal.h +++ b/Crashlytics/Crashlytics/Handlers/FIRCLSSignal.h @@ -30,7 +30,8 @@ #endif #if CLS_SIGNAL_SUPPORTED -#define FIRCLSSignalCount (7) +// keep in sync with the list in _FIRCLSFatalSignals_. +#define FIRCLSSignalCount (8) typedef struct { const char* path;