diff -r 82a37ccf6b8c -r 1af6415650bf ExceptionUtils.m --- a/ExceptionUtils.m Tue May 20 17:40:28 2008 -0700 +++ b/ExceptionUtils.m Tue Jun 17 14:57:48 2008 -0700 @@ -8,7 +8,12 @@ // #import "ExceptionUtils.h" -#import + +#import "Logging.h" +#import "Test.h" + +#include +#include #ifndef Warn @@ -111,6 +116,8 @@ +#ifdef NSAppKitVersionNumber10_4 // only enable this in a project that uses AppKit + @implementation MYExceptionReportingApplication @@ -138,11 +145,11 @@ - (void) _showExceptionAlert: (NSException*)x { NSString *stack = [x my_callStack] ?:@""; - int r = NSRunCriticalAlertPanel( @"Cloudy Internal Error!", + int r = NSRunCriticalAlertPanel( @"Internal Error!", [NSString stringWithFormat: @"Uncaught exception: %@\n%@\n\n%@\n\n" - "Please report this bug to jens@mooseyard.com (you can copy & paste the text).", + "Please report this bug (you can copy & paste the text).", [x name], [x reason], stack], - @"Sorry",@"Quit",nil); + @"Continue",@"Quit",nil); if( r == NSAlertAlternateReturn ) exit(1); MYSetExceptionReporter(&report); @@ -150,9 +157,35 @@ @end +#endif + + + +BOOL IsGDBAttached( void ) +{ + // From: + int mib[4]; + size_t bufSize = 0; + int local_error = 0; + struct kinfo_proc kp; + + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_PID; + mib[3] = getpid(); + + bufSize = sizeof (kp); + if ((local_error = sysctl(mib, 4, &kp, &bufSize, NULL, 0)) < 0) { + Warn(@"Failure calling sysctl"); + return NO; + } + return (kp.kp_proc.p_flag & P_TRACED) != 0; +} + + /* - Copyright (c) 2008, Jens Alfke. All rights reserved. + Copyright (c) 2008, Jens Alfke . All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: