Skip to content

Commit

Permalink
Make sure to not use KSCrash when debugger is active
Browse files Browse the repository at this point in the history
  • Loading branch information
tmolitor-stud-tu committed Sep 4, 2024
1 parent e87cf5f commit 78b23de
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Monal/Classes/HelperTools.m
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ -(void) swizzled_setObject:(id) value forKey:(NSString*) defaultName;
// running under the debugger or has a debugger attached post facto).
bool isDebugerActive(void)
{
#ifdef IS_ALPHA
int junk;
int mib[4];
struct kinfo_proc info;
Expand All @@ -148,9 +147,6 @@ bool isDebugerActive(void)

// We're being debugged if the P_TRACED flag is set.
return ( (info.kp_proc.p_flag & P_TRACED) != 0 );
#else
return 0;
#endif
}

//see https://stackoverflow.com/a/2180788
Expand Down Expand Up @@ -259,7 +255,10 @@ void uncaughtExceptionHandler(NSException* exception)

//don't report that crash through KSCrash if the debugger is active
if(isDebugerActive())
{
DDLogError(@"Not reporting crash through KSCrash: debugger is active!");
return;
}

//make sure this crash will be recorded by kscrash using the NSException rather than the c++ exception thrown by the objc runtime
//this will make sure that the stacktrace matches the objc exception rather than being a top level c++ stacktrace
Expand Down Expand Up @@ -508,6 +507,8 @@ +(void) initSystem
//don't install KSCrash if the debugger is active
if(!isDebugerActive())
[self installCrashHandler];
else
DDLogWarn(@"Not installing crash handler: debugger is active!");
[self installExceptionHandler];
}
else
Expand Down

0 comments on commit 78b23de

Please sign in to comment.