Skip to content

Instantly share code, notes, and snippets.

@ccgus
Created February 23, 2013 19:02
Show Gist options
  • Star 26 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ccgus/5020894 to your computer and use it in GitHub Desktop.
Save ccgus/5020894 to your computer and use it in GitHub Desktop.
Xcode crash report whoa
Application Specific Information:
ProductBuildVersion: 4H127
ASSERTION FAILURE in /SourceCache/IDEInterfaceBuilder/IDEInterfaceBuilder-3084/Framework/Connections/Interface/IBConnectionPopUpMenu.m:388
Details: Need a menu.
Function: NSMenuItem *IBPopUpConnectionMenuWithMenuItems(NSArray *, NSMenuItem *, NSEvent *, NSRect, BOOL, NSSet *, CGFloat, NSWindow *, NSColor *, NSColor *, NSColor *, NSColor *, id<IBConnectionPopUpMenuDelegate>)
Thread: <NSThread: 0x40030a1e0>{name = (null), num = 1}
Hints: None
Backtrace:
0 0x000000010c77b249 -[IDEAssertionHandler handleFailureInFunction:fileName:lineNumber:messageFormat:arguments:] (in IDEKit)
1 0x000000010ba2ec65 _DVTAssertionHandler (in DVTFoundation)
2 0x000000010ba2ecf4 _DVTAssertionFailureHandler (in DVTFoundation)
3 0x000000010f1cdf9c IBPopUpConnectionMenuWithMenuItems (in IDEInterfaceBuilderKit)
4 0x000000010f205caa -[IBConnectionEndPointHandler connectionForConnectingFromObject:] (in IDEInterfaceBuilderKit)
5 0x000000010f1d8691 -[IBConnectionManager beginOldSchoolConnectingFromObject:withEvent:inWindow:usingSourceLocator:] (in IDEInterfaceBuilderKit)
6 0x000000010f1d889d -[IBConnectionManager beginOldSchoolConnectingFromEditorCanvasFrameController:initialEndPoint:withEvent:] (in IDEInterfaceBuilderKit)
7 0x000000010f1586d9 -[IBEditorCanvasFrameController sendEvent:] (in IDEInterfaceBuilderKit)
8 0x00007fff8f7ffbb1 -[NSWindow sendEvent:] (in AppKit)
9 0x00007fff8f7fb674 -[NSApplication sendEvent:] (in AppKit)
10 0x000000010c5f3dae -[IDEApplication sendEvent:] (in IDEKit)
11 0x00007fff8f71124a -[NSApplication run] (in AppKit)
12 0x00007fff8f6b5c06 NSApplicationMain (in AppKit)
13 0x000000010b9a4b6f (in Xcode)
14 0x000000010b9a4b00 (in Xcode)
objc[7505]: garbage collection is ON
abort() called
@wilshipley
Copy link

  • (id)init;
    {
    self = [super init];

    [NSExceptionHandler defaultExceptionHandler].exceptionHandlingMask = (NSLogUncaughtExceptionMask | NSHandleUncaughtExceptionMask // uncaught exceptions on all non-main threads
    | NSLogUncaughtSystemExceptionMask | NSHandleUncaughtSystemExceptionMask // such as invalid memory accesses
    | NSLogUncaughtRuntimeErrorMask | NSHandleUncaughtRuntimeErrorMask // Obj-C runtime, like messages to freed objects
    | NSLogTopLevelExceptionMask | NSHandleTopLevelExceptionMask); // catch uncaught exception on the main thread, which are normally handled by NSApp;
    [NSExceptionHandler defaultExceptionHandler].delegate = self;

    [self performSelector:@selector(_checkForOldCrashReports) withObject:nil afterDelay:1.0];
    return self;
    }

char *crashreporter_info = NULL;
asm(".desc _crashreporter_info, 0x10");

  • (BOOL)exceptionHandler:(NSExceptionHandler *)sender shouldHandleException:(NSException *)exception mask:(NSUInteger)aMask; // mask is NSLogMask, exception's userInfo has stack trace for key NSStackTraceKey
    {
    if (![exception isKindOfClass:[NSException class]]) {
    exception = [NSException exceptionWithName:@"thrown" reason:[exception description] userInfo:nil];
    } else if ([exception.name isEqualToString:NSAccessibilityException])
    return YES;

    [NSExceptionHandler defaultExceptionHandler].exceptionHandlingMask = 0;
    [NSExceptionHandler defaultExceptionHandler].delegate = nil;

    // example:
    // Application Specific Information:
    // objc[1017]: objc_exception_throw failed
    // * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[NSURL initWithString:relativeToURL:]: nil string parameter'
    NSString exceptionReason = [NSString stringWithFormat:@"** Terminating app due to uncaught exception '%@', reason '*** %@'", exception.name, exception.reason];
    const char *crashReporterInfo = exceptionReason.UTF8String;
    crashreporter_info = malloc(strlen(crashReporterInfo) + 1);
    strcpy(crashreporter_info, crashReporterInfo);
    __builtin_trap();

    return NO; // NOTREACHED
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment