diff --git a/Crashlytics/CHANGELOG.md b/Crashlytics/CHANGELOG.md index a75b5675d85..ef5145db022 100644 --- a/Crashlytics/CHANGELOG.md +++ b/Crashlytics/CHANGELOG.md @@ -2,6 +2,7 @@ - [added] Added stackFrameWithAddress API for recording custom errors that are symbolicated on the backend (#5975). - [fixed] Fixed comment typos (#6363). - [fixed] Remove device information from binary image data crash info entries (#6382). +- [fixed] Fixed Apple Watch crash related to sigaction (#6434). # v4.5.0 - [fixed] Fixed a compiler warning and removed unused networking code (#6210). diff --git a/Crashlytics/Crashlytics/Components/FIRCLSContext.h b/Crashlytics/Crashlytics/Components/FIRCLSContext.h index f94e633343d..c5a098f8254 100644 --- a/Crashlytics/Crashlytics/Components/FIRCLSContext.h +++ b/Crashlytics/Crashlytics/Components/FIRCLSContext.h @@ -57,7 +57,9 @@ typedef struct { FIRCLSBinaryImageReadOnlyContext binaryimage; FIRCLSExceptionReadOnlyContext exception; FIRCLSHostReadOnlyContext host; +#if CLS_SIGNAL_SUPPORTED FIRCLSSignalReadContext signal; +#endif #if CLS_MACH_EXCEPTION_SUPPORTED FIRCLSMachExceptionReadContext machException; #endif diff --git a/Crashlytics/Crashlytics/Components/FIRCLSContext.m b/Crashlytics/Crashlytics/Components/FIRCLSContext.m index d860e1fd34b..a7a20e75d23 100644 --- a/Crashlytics/Crashlytics/Components/FIRCLSContext.m +++ b/Crashlytics/Crashlytics/Components/FIRCLSContext.m @@ -196,12 +196,14 @@ bool FIRCLSContextInitialize(FIRCLSInternalReport* report, }); if (!_firclsContext.readonly->debuggerAttached) { +#if CLS_SIGNAL_SUPPORTED dispatch_group_async(group, queue, ^{ _firclsContext.readonly->signal.path = FIRCLSContextAppendToRoot(rootPath, FIRCLSReportSignalFile); FIRCLSSignalInitialize(&_firclsContext.readonly->signal); }); +#endif #if CLS_MACH_EXCEPTION_SUPPORTED dispatch_group_async(group, queue, ^{ diff --git a/Crashlytics/Crashlytics/Controllers/FIRCLSReportManager.m b/Crashlytics/Crashlytics/Controllers/FIRCLSReportManager.m index a5df5a655b9..cec76508221 100644 --- a/Crashlytics/Crashlytics/Controllers/FIRCLSReportManager.m +++ b/Crashlytics/Crashlytics/Controllers/FIRCLSReportManager.m @@ -507,7 +507,9 @@ - (void)crashReportingSetupCompleted:(FIRCLSProfileMark)mark { // check our handlers FIRCLSDispatchAfter(2.0, dispatch_get_main_queue(), ^{ FIRCLSExceptionCheckHandlers((__bridge void *)(self)); +#if CLS_SIGNAL_SUPPORTED FIRCLSSignalCheckHandlers(); +#endif #if CLS_MACH_EXCEPTION_SUPPORTED FIRCLSMachExceptionCheckHandlers(); #endif diff --git a/Crashlytics/Crashlytics/Handlers/FIRCLSSignal.c b/Crashlytics/Crashlytics/Handlers/FIRCLSSignal.c index e96ecfab13d..c82c47c2149 100644 --- a/Crashlytics/Crashlytics/Handlers/FIRCLSSignal.c +++ b/Crashlytics/Crashlytics/Handlers/FIRCLSSignal.c @@ -20,6 +20,7 @@ #include #include +#if CLS_SIGNAL_SUPPORTED static const int FIRCLSFatalSignals[FIRCLSSignalCount] = {SIGABRT, SIGBUS, SIGFPE, SIGILL, SIGSEGV, SIGSYS, SIGTRAP}; @@ -316,3 +317,4 @@ static void FIRCLSSignalHandler(int signal, siginfo_t *info, void *uapVoid) { // restore errno errno = savedErrno; } +#endif diff --git a/Crashlytics/Crashlytics/Handlers/FIRCLSSignal.h b/Crashlytics/Crashlytics/Handlers/FIRCLSSignal.h index a4533a5cd73..46313de4a85 100644 --- a/Crashlytics/Crashlytics/Handlers/FIRCLSSignal.h +++ b/Crashlytics/Crashlytics/Handlers/FIRCLSSignal.h @@ -20,8 +20,6 @@ #include #include -#define FIRCLSSignalCount (7) - // per man sigaltstack, MINSIGSTKSZ is the minimum *overhead* needed to support // a signal stack. The actual stack size must be larger. Let's pick the recommended // size. @@ -31,6 +29,9 @@ #define CLS_SIGNAL_HANDLER_STACK_SIZE 0 #endif +#if CLS_SIGNAL_SUPPORTED +#define FIRCLSSignalCount (7) + typedef struct { const char* path; struct sigaction originalActions[FIRCLSSignalCount]; @@ -49,3 +50,4 @@ bool FIRCLSSignalSafeInstallPreexistingHandlers(FIRCLSSignalReadContext* roConte void FIRCLSSignalNameLookup(int number, int code, const char** name, const char** codeName); void FIRCLSSignalEnumerateHandledSignals(void (^block)(int idx, int signal)); +#endif diff --git a/Crashlytics/Crashlytics/Helpers/FIRCLSFeatures.h b/Crashlytics/Crashlytics/Helpers/FIRCLSFeatures.h index ba61233b5c5..fc90eea5c7a 100644 --- a/Crashlytics/Crashlytics/Helpers/FIRCLSFeatures.h +++ b/Crashlytics/Crashlytics/Helpers/FIRCLSFeatures.h @@ -23,6 +23,7 @@ #define CLS_USE_SIGALTSTACK (!TARGET_OS_WATCH && !TARGET_OS_TV) #define CLS_CAN_SUSPEND_THREADS !TARGET_OS_WATCH #define CLS_MACH_EXCEPTION_SUPPORTED (!TARGET_OS_WATCH && !TARGET_OS_TV) +#define CLS_SIGNAL_SUPPORTED !TARGET_OS_WATCH // As of WatchOS 3, Signal crashes are not supported #define CLS_COMPACT_UNWINDING_SUPPORTED \ ((CLS_CPU_I386 || CLS_CPU_X86_64 || CLS_CPU_ARM64) && CLS_COMPACT_UNWINDED_ENABLED)