diff --git a/Sentry.xcodeproj/project.pbxproj b/Sentry.xcodeproj/project.pbxproj index 89528c08b44..8bae595a59f 100644 --- a/Sentry.xcodeproj/project.pbxproj +++ b/Sentry.xcodeproj/project.pbxproj @@ -166,7 +166,6 @@ 63FE70AD20DA4C1000CDBAE8 /* SentryCrashCString.m in Sources */ = {isa = PBXBuildFile; fileRef = 63FE6FD920DA4C1000CDBAE8 /* SentryCrashCString.m */; }; 63FE70CB20DA4C1000CDBAE8 /* SentryCrashReportFixer.c in Sources */ = {isa = PBXBuildFile; fileRef = 63FE6FEA20DA4C1000CDBAE8 /* SentryCrashReportFixer.c */; }; 63FE70CD20DA4C1000CDBAE8 /* SentryCrashDoctor.h in Headers */ = {isa = PBXBuildFile; fileRef = 63FE6FEB20DA4C1000CDBAE8 /* SentryCrashDoctor.h */; }; - 63FE70CF20DA4C1000CDBAE8 /* SentryCrashMonitor_User.h in Headers */ = {isa = PBXBuildFile; fileRef = 63FE6FED20DA4C1000CDBAE8 /* SentryCrashMonitor_User.h */; }; 63FE70D120DA4C1000CDBAE8 /* SentryCrashMonitorContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 63FE6FEE20DA4C1000CDBAE8 /* SentryCrashMonitorContext.h */; }; 63FE70D320DA4C1000CDBAE8 /* SentryCrashMonitor_AppState.c in Sources */ = {isa = PBXBuildFile; fileRef = 63FE6FEF20DA4C1000CDBAE8 /* SentryCrashMonitor_AppState.c */; }; 63FE70D520DA4C1000CDBAE8 /* SentryCrashMonitor_NSException.m in Sources */ = {isa = PBXBuildFile; fileRef = 63FE6FF020DA4C1000CDBAE8 /* SentryCrashMonitor_NSException.m */; }; @@ -178,7 +177,6 @@ 63FE70E320DA4C1000CDBAE8 /* SentryCrashMonitor_Zombie.c in Sources */ = {isa = PBXBuildFile; fileRef = 63FE6FF720DA4C1000CDBAE8 /* SentryCrashMonitor_Zombie.c */; }; 63FE70E520DA4C1000CDBAE8 /* SentryCrashMonitor_CPPException.h in Headers */ = {isa = PBXBuildFile; fileRef = 63FE6FF820DA4C1000CDBAE8 /* SentryCrashMonitor_CPPException.h */; }; 63FE70E720DA4C1000CDBAE8 /* SentryCrashMonitor.c in Sources */ = {isa = PBXBuildFile; fileRef = 63FE6FF920DA4C1000CDBAE8 /* SentryCrashMonitor.c */; }; - 63FE70E920DA4C1000CDBAE8 /* SentryCrashMonitor_User.c in Sources */ = {isa = PBXBuildFile; fileRef = 63FE6FFA20DA4C1000CDBAE8 /* SentryCrashMonitor_User.c */; }; 63FE70EB20DA4C1000CDBAE8 /* SentryCrashMonitor_MachException.h in Headers */ = {isa = PBXBuildFile; fileRef = 63FE6FFB20DA4C1000CDBAE8 /* SentryCrashMonitor_MachException.h */; }; 63FE70ED20DA4C1000CDBAE8 /* SentryCrashMonitor_NSException.h in Headers */ = {isa = PBXBuildFile; fileRef = 63FE6FFC20DA4C1000CDBAE8 /* SentryCrashMonitor_NSException.h */; }; 63FE70EF20DA4C1000CDBAE8 /* SentryCrashMonitor_AppState.h in Headers */ = {isa = PBXBuildFile; fileRef = 63FE6FFD20DA4C1000CDBAE8 /* SentryCrashMonitor_AppState.h */; }; @@ -924,7 +922,6 @@ 63FE6FD920DA4C1000CDBAE8 /* SentryCrashCString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SentryCrashCString.m; sourceTree = ""; }; 63FE6FEA20DA4C1000CDBAE8 /* SentryCrashReportFixer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SentryCrashReportFixer.c; sourceTree = ""; }; 63FE6FEB20DA4C1000CDBAE8 /* SentryCrashDoctor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SentryCrashDoctor.h; sourceTree = ""; }; - 63FE6FED20DA4C1000CDBAE8 /* SentryCrashMonitor_User.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SentryCrashMonitor_User.h; sourceTree = ""; }; 63FE6FEE20DA4C1000CDBAE8 /* SentryCrashMonitorContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SentryCrashMonitorContext.h; sourceTree = ""; }; 63FE6FEF20DA4C1000CDBAE8 /* SentryCrashMonitor_AppState.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SentryCrashMonitor_AppState.c; sourceTree = ""; }; 63FE6FF020DA4C1000CDBAE8 /* SentryCrashMonitor_NSException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SentryCrashMonitor_NSException.m; sourceTree = ""; }; @@ -936,7 +933,6 @@ 63FE6FF720DA4C1000CDBAE8 /* SentryCrashMonitor_Zombie.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SentryCrashMonitor_Zombie.c; sourceTree = ""; }; 63FE6FF820DA4C1000CDBAE8 /* SentryCrashMonitor_CPPException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SentryCrashMonitor_CPPException.h; sourceTree = ""; }; 63FE6FF920DA4C1000CDBAE8 /* SentryCrashMonitor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SentryCrashMonitor.c; sourceTree = ""; }; - 63FE6FFA20DA4C1000CDBAE8 /* SentryCrashMonitor_User.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SentryCrashMonitor_User.c; sourceTree = ""; }; 63FE6FFB20DA4C1000CDBAE8 /* SentryCrashMonitor_MachException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SentryCrashMonitor_MachException.h; sourceTree = ""; }; 63FE6FFC20DA4C1000CDBAE8 /* SentryCrashMonitor_NSException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SentryCrashMonitor_NSException.h; sourceTree = ""; }; 63FE6FFD20DA4C1000CDBAE8 /* SentryCrashMonitor_AppState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SentryCrashMonitor_AppState.h; sourceTree = ""; }; @@ -2144,8 +2140,6 @@ 63FE6FF420DA4C1000CDBAE8 /* SentryCrashMonitor_Signal.h */, 63FE700020DA4C1000CDBAE8 /* SentryCrashMonitor_System.h */, 63FE6FF320DA4C1000CDBAE8 /* SentryCrashMonitor_System.m */, - 63FE6FFA20DA4C1000CDBAE8 /* SentryCrashMonitor_User.c */, - 63FE6FED20DA4C1000CDBAE8 /* SentryCrashMonitor_User.h */, 63FE6FF720DA4C1000CDBAE8 /* SentryCrashMonitor_Zombie.c */, 63FE700320DA4C1000CDBAE8 /* SentryCrashMonitor_Zombie.h */, 63FE6FF920DA4C1000CDBAE8 /* SentryCrashMonitor.c */, @@ -3075,7 +3069,6 @@ 63AA76991EB9C1C200D153DE /* SentryDefines.h in Headers */, 0A4EDEA928D3461B00FA67CB /* SentryPerformanceTracker+Private.h in Headers */, 0A8F0A392886CC70000B15F6 /* SentryPermissionsObserver.h in Headers */, - 63FE70CF20DA4C1000CDBAE8 /* SentryCrashMonitor_User.h in Headers */, 7B2A70DB27D607CF008B0D15 /* SentryThreadWrapper.h in Headers */, 8EAE980B261E9F530073B6B3 /* SentryPerformanceTracker.h in Headers */, 63FE718520DA4C1100CDBAE8 /* SentryCrashC.h in Headers */, @@ -3616,7 +3609,6 @@ 63FE714520DA4C1100CDBAE8 /* SentryCrashObjC.c in Sources */, 63FE710520DA4C1000CDBAE8 /* SentryCrashLogger.c in Sources */, 0A2D8D5B289815C0008720F6 /* SentryBaseIntegration.m in Sources */, - 63FE70E920DA4C1000CDBAE8 /* SentryCrashMonitor_User.c in Sources */, 0ACBA10128A6406400D711F7 /* UIView+Sentry.m in Sources */, 639FCF991EBC7B9700778193 /* SentryEvent.m in Sources */, 632F43521F581D5400A18A36 /* SentryCrashExceptionApplication.m in Sources */, diff --git a/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor.c b/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor.c index 0981258bc00..4022f696284 100644 --- a/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor.c +++ b/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor.c @@ -35,7 +35,6 @@ #include "SentryCrashMonitor_NSException.h" #include "SentryCrashMonitor_Signal.h" #include "SentryCrashMonitor_System.h" -#include "SentryCrashMonitor_User.h" #include "SentryCrashMonitor_Zombie.h" #include "SentryCrashSystemCapabilities.h" #include "SentryCrashThread.h" @@ -81,10 +80,6 @@ static Monitor g_monitors[] = { .monitorType = SentryCrashMonitorTypeCPPException, .getAPI = sentrycrashcm_cppexception_getAPI, }, - { - .monitorType = SentryCrashMonitorTypeUserReported, - .getAPI = sentrycrashcm_user_getAPI, - }, { .monitorType = SentryCrashMonitorTypeSystem, .getAPI = sentrycrashcm_system_getAPI, @@ -235,12 +230,8 @@ sentrycrashcm_handleException(struct SentryCrash_MonitorContext *context) g_onExceptionEvent(context); - if (context->currentSnapshotUserReported) { - g_handlingFatalException = false; - } else { - if (g_handlingFatalException && !g_crashedDuringExceptionHandling) { - SentryCrashLOG_DEBUG("Exception is fatal. Restoring original handlers."); - sentrycrashcm_setActiveMonitors(SentryCrashMonitorTypeNone); - } + if (g_handlingFatalException && !g_crashedDuringExceptionHandling) { + SentryCrashLOG_DEBUG("Exception is fatal. Restoring original handlers."); + sentrycrashcm_setActiveMonitors(SentryCrashMonitorTypeNone); } } diff --git a/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitorContext.h b/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitorContext.h index 1ada1e2f6bd..7de0b426370 100644 --- a/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitorContext.h +++ b/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitorContext.h @@ -40,10 +40,6 @@ extern "C" { typedef struct SentryCrash_MonitorContext { /** Unique identifier for this event. */ const char *eventID; - /** - If true, so reported user exception will have the current snapshot. - */ - bool currentSnapshotUserReported; /** If true, the environment has crashed hard, and only async-safe * functions should be used. diff --git a/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitorType.c b/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitorType.c index 5f497af7949..c8a9d8196b3 100644 --- a/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitorType.c +++ b/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitorType.c @@ -38,7 +38,6 @@ static const struct { MONITORTYPE(SentryCrashMonitorTypeSignal), MONITORTYPE(SentryCrashMonitorTypeCPPException), MONITORTYPE(SentryCrashMonitorTypeNSException), - MONITORTYPE(SentryCrashMonitorTypeUserReported), MONITORTYPE(SentryCrashMonitorTypeSystem), MONITORTYPE(SentryCrashMonitorTypeApplicationState), MONITORTYPE(SentryCrashMonitorTypeZombie), diff --git a/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitorType.h b/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitorType.h index e6eb370b17b..3370d24de35 100644 --- a/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitorType.h +++ b/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitorType.h @@ -34,7 +34,6 @@ extern "C" { * - Fatal signal * - Uncaught C++ exception * - Uncaught Objective-C NSException - * - User reported custom exception */ typedef enum { /* Captures and reports Mach exceptions. */ @@ -51,9 +50,6 @@ typedef enum { /* Captures and reports NSExceptions. */ SentryCrashMonitorTypeNSException = 0x08, - /* Accepts and reports user-generated exceptions. */ - SentryCrashMonitorTypeUserReported = 0x20, - /* Keeps track of and injects system information. */ SentryCrashMonitorTypeSystem = 0x40, @@ -67,8 +63,8 @@ typedef enum { #define SentryCrashMonitorTypeAll \ (SentryCrashMonitorTypeMachException | SentryCrashMonitorTypeSignal \ | SentryCrashMonitorTypeCPPException | SentryCrashMonitorTypeNSException \ - | SentryCrashMonitorTypeUserReported | SentryCrashMonitorTypeSystem \ - | SentryCrashMonitorTypeApplicationState | SentryCrashMonitorTypeZombie) + | SentryCrashMonitorTypeSystem | SentryCrashMonitorTypeApplicationState \ + | SentryCrashMonitorTypeZombie) #define SentryCrashMonitorTypeDebuggerUnsafe \ (SentryCrashMonitorTypeMachException | SentryCrashMonitorTypeSignal \ @@ -101,12 +97,6 @@ typedef enum { #define SentryCrashMonitorTypeRequired \ (SentryCrashMonitorTypeSystem | SentryCrashMonitorTypeApplicationState) -/** Effectively disables automatica reporting. The only way to generate a report - * in this mode is by manually calling sentrycrash_reportUserException(). - */ -#define SentryCrashMonitorTypeManual \ - (SentryCrashMonitorTypeRequired | SentryCrashMonitorTypeUserReported) - #define SentryCrashMonitorTypeNone 0 const char *sentrycrashmonitortype_name(SentryCrashMonitorType monitorType); diff --git a/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_NSException.m b/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_NSException.m index 9fb2f68cf76..aaf6b182628 100644 --- a/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_NSException.m +++ b/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_NSException.m @@ -56,7 +56,7 @@ */ static void -handleException(NSException *exception, BOOL currentSnapshotUserReported) +handleException(NSException *exception) { SentryCrashLOG_DEBUG(@"Trapped exception %@", exception); if (g_isEnabled) { @@ -94,15 +94,11 @@ crashContext->exceptionName = crashContext->NSException.name; crashContext->crashReason = [[exception reason] UTF8String]; crashContext->stackCursor = &cursor; - crashContext->currentSnapshotUserReported = currentSnapshotUserReported; SentryCrashLOG_DEBUG(@"Calling main crash handler."); sentrycrashcm_handleException(crashContext); free(callstack); - if (currentSnapshotUserReported) { - sentrycrashmc_resumeEnvironment(threads, numThreads); - } if (g_previousUncaughtExceptionHandler != NULL) { SentryCrashLOG_DEBUG(@"Calling original exception handler."); g_previousUncaughtExceptionHandler(exception); @@ -111,16 +107,10 @@ } } -static void -handleCurrentSnapshotUserReportedException(NSException *exception) -{ - handleException(exception, true); -} - static void handleUncaughtException(NSException *exception) { - handleException(exception, false); + handleException(exception); } // ============================================================================ @@ -139,8 +129,6 @@ SentryCrashLOG_DEBUG(@"Setting new handler."); NSSetUncaughtExceptionHandler(&handleUncaughtException); SentryCrash.sharedInstance.uncaughtExceptionHandler = &handleUncaughtException; - SentryCrash.sharedInstance.currentSnapshotUserReportedExceptionHandler - = &handleCurrentSnapshotUserReportedException; } else { SentryCrashLOG_DEBUG(@"Restoring original handler."); NSSetUncaughtExceptionHandler(g_previousUncaughtExceptionHandler); diff --git a/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_User.c b/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_User.c deleted file mode 100644 index f4bcebf7b77..00000000000 --- a/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_User.c +++ /dev/null @@ -1,108 +0,0 @@ -// -// SentryCrashMonitor_User.c -// -// Copyright (c) 2012 Karl Stenerud. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall remain in place -// in this source code. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -#include "SentryCrashMonitor_User.h" -#include "SentryCrashID.h" -#include "SentryCrashMonitorContext.h" -#include "SentryCrashStackCursor_SelfThread.h" -#include "SentryCrashThread.h" - -// #define SentryCrashLogger_LocalLevel TRACE -#include "SentryCrashLogger.h" - -#include -#include - -/** Context to fill with crash information. */ - -static volatile bool g_isEnabled = false; - -void -sentrycrashcm_reportUserException(const char *name, const char *reason, const char *language, - const char *lineOfCode, const char *stackTrace, bool logAllThreads, bool terminateProgram) -{ - if (!g_isEnabled) { - SentryCrashLOG_WARN("User-reported exception monitor is not installed. " - "Exception has not been recorded."); - } else { - thread_act_array_t threads = NULL; - mach_msg_type_number_t numThreads = 0; - if (logAllThreads) { - sentrycrashmc_suspendEnvironment(&threads, &numThreads); - } - if (terminateProgram) { - sentrycrashcm_notifyFatalExceptionCaptured(false); - } - - char eventID[37]; - sentrycrashid_generate(eventID); - SentryCrashMC_NEW_CONTEXT(machineContext); - sentrycrashmc_getContextForThread(sentrycrashthread_self(), machineContext, true); - SentryCrashStackCursor stackCursor; - sentrycrashsc_initSelfThread(&stackCursor, 0); - - SentryCrashLOG_DEBUG("Filling out context."); - SentryCrash_MonitorContext context; - memset(&context, 0, sizeof(context)); - context.crashType = SentryCrashMonitorTypeUserReported; - context.eventID = eventID; - context.offendingMachineContext = machineContext; - context.registersAreValid = false; - context.crashReason = reason; - context.userException.name = name; - context.userException.language = language; - context.userException.lineOfCode = lineOfCode; - context.userException.customStackTrace = stackTrace; - context.stackCursor = &stackCursor; - - sentrycrashcm_handleException(&context); - sentrycrash_async_backtrace_decref(stackCursor.async_caller); - - if (logAllThreads) { - sentrycrashmc_resumeEnvironment(threads, numThreads); - } - if (terminateProgram) { - abort(); - } - } -} - -static void -setEnabled(bool isEnabled) -{ - g_isEnabled = isEnabled; -} - -static bool -isEnabled() -{ - return g_isEnabled; -} - -SentryCrashMonitorAPI * -sentrycrashcm_user_getAPI() -{ - static SentryCrashMonitorAPI api = { .setEnabled = setEnabled, .isEnabled = isEnabled }; - return &api; -} diff --git a/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_User.h b/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_User.h deleted file mode 100644 index f707d187a49..00000000000 --- a/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_User.h +++ /dev/null @@ -1,70 +0,0 @@ -// -// SentryCrashMonitor_User.h -// -// Copyright (c) 2012 Karl Stenerud. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall remain in place -// in this source code. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -#ifndef HDR_SentryCrashMonitor_User_h -#define HDR_SentryCrashMonitor_User_h - -#ifdef __cplusplus -extern "C" { -#endif - -#include "SentryCrashMonitor.h" - -#include - -/** Report a custom, user defined exception. - * If terminateProgram is true, all sentries will be uninstalled and the - * application will terminate with an abort(). - * - * @param name The exception name (for namespacing exception types). - * - * @param reason A description of why the exception occurred. - * - * @param language A unique language identifier. - * - * @param lineOfCode A copy of the offending line of code (NULL = ignore). - * - * @param stackTrace JSON encoded array containing stack trace information (one - * frame per array entry). The frame structure can be anything you want, - * including bare strings. - * - * @param logAllThreads If true, suspend all threads and log their state. Note - * that this incurs a performance penalty, so it's best to use only on fatal - * errors. - * - * @param terminateProgram If true, do not return from this function call. - * Terminate the program instead. - */ -void sentrycrashcm_reportUserException(const char *name, const char *reason, const char *language, - const char *lineOfCode, const char *stackTrace, bool logAllThreads, bool terminateProgram); - -/** Access the Monitor API. - */ -SentryCrashMonitorAPI *sentrycrashcm_user_getAPI(void); - -#ifdef __cplusplus -} -#endif - -#endif // HDR_SentryCrashMonitor_User_h diff --git a/Sources/SentryCrash/Recording/SentryCrash.h b/Sources/SentryCrash/Recording/SentryCrash.h index 55b022c3441..e0e60a3ce0c 100644 --- a/Sources/SentryCrash/Recording/SentryCrash.h +++ b/Sources/SentryCrash/Recording/SentryCrash.h @@ -156,11 +156,6 @@ static NSString *const SENTRYCRASH_REPORT_ATTACHMENTS_ITEM = @"attachments"; * debugger is running. **/ @property (nonatomic, assign) NSUncaughtExceptionHandler *uncaughtExceptionHandler; -/** Exposes the currentSnapshotUserReportedExceptionHandler if set from - * SentryCrash. Is nil if debugger is running. **/ -@property (nonatomic, assign) - NSUncaughtExceptionHandler *currentSnapshotUserReportedExceptionHandler; - #pragma mark - Information - /** Total active time elapsed since the last crash. */ diff --git a/Sources/SentryCrash/Recording/SentryCrash.m b/Sources/SentryCrash/Recording/SentryCrash.m index 7fb39b38a80..fc113201027 100644 --- a/Sources/SentryCrash/Recording/SentryCrash.m +++ b/Sources/SentryCrash/Recording/SentryCrash.m @@ -107,8 +107,6 @@ @implementation SentryCrash @synthesize printPreviousLog = _printPreviousLog; @synthesize maxReportCount = _maxReportCount; @synthesize uncaughtExceptionHandler = _uncaughtExceptionHandler; -@synthesize currentSnapshotUserReportedExceptionHandler - = _currentSnapshotUserReportedExceptionHandler; // ============================================================================ #pragma mark - Lifecycle - @@ -184,7 +182,6 @@ - (void)setMonitoring:(SentryCrashMonitorType)monitoring - (void)setOnCrash:(SentryCrashReportWriteCallback)onCrash { _onCrash = onCrash; - sentrycrash_setCrashNotifyCallback(onCrash); } - (void)setIntrospectMemory:(BOOL)introspectMemory diff --git a/Sources/SentryCrash/Recording/SentryCrashC.c b/Sources/SentryCrash/Recording/SentryCrashC.c index a2a0adc7bed..15d3a05fd02 100644 --- a/Sources/SentryCrash/Recording/SentryCrashC.c +++ b/Sources/SentryCrash/Recording/SentryCrashC.c @@ -31,7 +31,6 @@ #include "SentryCrashMonitorContext.h" #include "SentryCrashMonitor_AppState.h" #include "SentryCrashMonitor_System.h" -#include "SentryCrashMonitor_User.h" #include "SentryCrashMonitor_Zombie.h" #include "SentryCrashObjC.h" #include "SentryCrashReport.h" @@ -93,10 +92,9 @@ printPreviousLog(const char *filePath) static void onCrash(struct SentryCrash_MonitorContext *monitorContext) { - if (monitorContext->currentSnapshotUserReported == false) { - SentryCrashLOG_DEBUG("Updating application state to note crash."); - sentrycrashstate_notifyAppCrash(); - } + SentryCrashLOG_DEBUG("Updating application state to note crash."); + sentrycrashstate_notifyAppCrash(); + monitorContext->consoleLogPath = g_shouldAddConsoleLogToReport ? g_consoleLogPath : NULL; if (monitorContext->crashedDuringCrashHandling) { @@ -202,12 +200,6 @@ sentrycrash_setDoNotIntrospectClasses(const char **doNotIntrospectClasses, int l sentrycrashreport_setDoNotIntrospectClasses(doNotIntrospectClasses, length); } -void -sentrycrash_setCrashNotifyCallback(const SentryCrashReportWriteCallback onCrashNotify) -{ - sentrycrashreport_setUserSectionWriteCallback(onCrashNotify); -} - void sentrycrash_setAddConsoleLogToReport(bool shouldAddConsoleLogToReport) { @@ -238,17 +230,6 @@ sentrycrash_setSaveViewHierarchy(void (*callback)(const char *)) g_saveViewHierarchy = callback; } -void -sentrycrash_reportUserException(const char *name, const char *reason, const char *language, - const char *lineOfCode, const char *stackTrace, bool logAllThreads, bool terminateProgram) -{ - sentrycrashcm_reportUserException( - name, reason, language, lineOfCode, stackTrace, logAllThreads, terminateProgram); - if (g_shouldAddConsoleLogToReport) { - sentrycrashlog_clearLogFile(); - } -} - void sentrycrash_notifyAppActive(bool isActive) { diff --git a/Sources/SentryCrash/Recording/SentryCrashReport.c b/Sources/SentryCrash/Recording/SentryCrashReport.c index 9c705d3ae65..8cedc8edc39 100644 --- a/Sources/SentryCrash/Recording/SentryCrashReport.c +++ b/Sources/SentryCrash/Recording/SentryCrashReport.c @@ -106,7 +106,6 @@ typedef struct { static const char *g_userInfoJSON; static SentryCrash_IntrospectionRules g_introspectionRules; -static SentryCrashReportWriteCallback g_userSectionWriteCallback; #pragma mark Callbacks @@ -1351,27 +1350,6 @@ writeError(const SentryCrashReportWriter *const writer, const char *const key, writer->addStringElement(writer, SentryCrashField_Type, SentryCrashExcType_Signal); break; - case SentryCrashMonitorTypeUserReported: { - writer->addStringElement(writer, SentryCrashField_Type, SentryCrashExcType_User); - writer->beginObject(writer, SentryCrashField_UserReported); - { - writer->addStringElement(writer, SentryCrashField_Name, crash->userException.name); - if (crash->userException.language != NULL) { - writer->addStringElement( - writer, SentryCrashField_Language, crash->userException.language); - } - if (crash->userException.lineOfCode != NULL) { - writer->addStringElement( - writer, SentryCrashField_LineOfCode, crash->userException.lineOfCode); - } - if (crash->userException.customStackTrace != NULL) { - writer->addJSONElement(writer, SentryCrashField_Backtrace, - crash->userException.customStackTrace, true); - } - } - writer->endContainer(writer); - break; - } case SentryCrashMonitorTypeSystem: case SentryCrashMonitorTypeApplicationState: case SentryCrashMonitorTypeZombie: @@ -1774,13 +1752,6 @@ sentrycrashreport_writeStandardReport( } else { writer->beginObject(writer, SentryCrashField_User); } - - if (g_userSectionWriteCallback != NULL) { - sentrycrashfu_flushBufferedWriter(&bufferedWriter); - if (monitorContext->currentSnapshotUserReported == false) { - g_userSectionWriteCallback(writer); - } - } writer->endContainer(writer); sentrycrashfu_flushBufferedWriter(&bufferedWriter); @@ -1850,11 +1821,3 @@ sentrycrashreport_setDoNotIntrospectClasses(const char **doNotIntrospectClasses, free(oldClasses); } } - -void -sentrycrashreport_setUserSectionWriteCallback( - const SentryCrashReportWriteCallback userSectionWriteCallback) -{ - SentryCrashLOG_TRACE("Set userSectionWriteCallback to %p", userSectionWriteCallback); - g_userSectionWriteCallback = userSectionWriteCallback; -} diff --git a/Sources/SentryCrash/Recording/SentryCrashReport.h b/Sources/SentryCrash/Recording/SentryCrashReport.h index 0a620bd6bd1..fa06ae182aa 100644 --- a/Sources/SentryCrash/Recording/SentryCrashReport.h +++ b/Sources/SentryCrash/Recording/SentryCrashReport.h @@ -63,15 +63,6 @@ void sentrycrashreport_setIntrospectMemory(bool shouldIntrospectMemory); */ void sentrycrashreport_setDoNotIntrospectClasses(const char **doNotIntrospectClasses, int length); -/** Set the function to call when writing the user section of the report. - * This allows the user to add more fields to the user section at the time of - * the crash. Note: Only async-safe functions are allowed in the callback. - * - * @param userSectionWriteCallback The user section write callback. - */ -void sentrycrashreport_setUserSectionWriteCallback( - const SentryCrashReportWriteCallback userSectionWriteCallback); - // ============================================================================ #pragma mark - Main API - // ============================================================================ diff --git a/Sources/SentryCrash/Recording/SentryCrashReportFields.h b/Sources/SentryCrash/Recording/SentryCrashReportFields.h index 55372157c58..cef8cb36d00 100644 --- a/Sources/SentryCrash/Recording/SentryCrashReportFields.h +++ b/Sources/SentryCrash/Recording/SentryCrashReportFields.h @@ -48,7 +48,6 @@ #define SentryCrashExcType_Mach "mach" #define SentryCrashExcType_NSException "nsexception" #define SentryCrashExcType_Signal "signal" -#define SentryCrashExcType_User "user" #pragma mark - Common - @@ -133,7 +132,6 @@ #define SentryCrashField_Reason "reason" #define SentryCrashField_Signal "signal" #define SentryCrashField_Subcode "subcode" -#define SentryCrashField_UserReported "user_reported" #pragma mark - Process State -