LinkedLog icon indicating copy to clipboard operation
LinkedLog copied to clipboard

XCode crash

Open keepyounger opened this issue 9 years ago • 4 comments

When I debug my APP like this image XCode do crash!

Additional: ConsoleTextView is not empty. When I debug my APP with breakpoint by Step over, Xcode do crash!

Application Specific Information: ProductBuildVersion: 6C131e UNCAUGHT EXCEPTION (NSRangeException): *** -[__NSCFString substringFromIndex:]: Index 240 out of bounds; string length 180

keepyounger avatar Mar 17 '15 08:03 keepyounger

During debugging doesn't make any sense... Do you have a log or something happening while stepping? Any output (when LLog isn't running)?

I faced the same issue when pasting to the console, but didn't fix it yet.

Thanks for report, though!

julian-weinert avatar Mar 20 '15 07:03 julian-weinert

@julian-weinert If I modify the code like this. Xcode will not crash.

image

But the console ...

d4d52b8b-84aa-42f6-be5a-572c31d84aa6

Maybe Xcode doesn't know the length of string in the console has changed. Because you changed it directly.

keepyounger avatar Mar 20 '15 09:03 keepyounger

I tracked the issue down, didn't finish my fix yet, but I'm working on it! Please be patient and stay tuned :)

julian-weinert avatar Mar 20 '15 16:03 julian-weinert

I did a bit research on this issue. There is one EXTREMELY strange thing happening. For me this issue happens when I try to write comments in the log.

I put a log right before the line you commented out. After adding many checks to ensure I'm not accessing ranges that exceed the content I'm still getting a crash.

The log right before the replacement does not appear, but I'm getting the following exception:

2015-03-28 00:24:06.755 Xcode[35557:1660377] [MT] DVTAssertions: UNCAUGHT EXCEPTION (NSRangeException): *** -[__NSCFString substringFromIndex:]: Index 108 out of bounds; string length 72
UserInfo: (null)
Hints: None
2015-03-28 00:24:06.764 Xcode[35557:1660377] [MT] DVTAssertions: 
Backtrace:
  0  0x00007fff961a1654 __exceptionPreprocess (in CoreFoundation)
  1  0x00000001001da764 DVTFailureHintExceptionPreprocessor (in DVTFoundation)
  2  0x00007fff8a9d876e objc_exception_throw (in libobjc.A.dylib)
  3  0x00007fff961a151d +[NSException raise:format:] (in CoreFoundation)
  4  0x00007fff917d7b2e -[NSString substringFromIndex:] (in Foundation)
  5  0x000000010144e04a -[IDEConsoleTextView _inputTextRange] (in IDEKit)
  6  0x000000010144f676 -[IDEConsoleTextView insertText:] (in IDEKit)
  7  0x00007fff8c98214b -[NSTextInputContext(NSInputContext_WithCompletion) insertText:replacementRange:completionHandler:] (in AppKit)
  8  0x00007fff8c97a18a __55-[NSTextInputContext handleTSMEvent:completionHandler:]_block_invoke_2242 (in AppKit)
  9  0x00007fff8c976b8d -[NSTextInputContext do_HandleTSMEvent_insertFixLenTextLoop:whileCondition:dispatchWorkEach:afterEachInsertText:continuation:] (in AppKit)
 10  0x00007fff8c976e3e -[NSTextInputContext tryHandleTSMEvent_insertFixLenText_withContext:dispatchCondition:setupForDispatch:nestedWorkaroundCondition:nestedWorkaroundDispatchWork:loopCondition:dispatchWorkEach:afterEachInsertText:continuation:] (in AppKit)
 11  0x00007fff8c979be6 __55-[NSTextInputContext handleTSMEvent:completionHandler:]_block_invoke174 (in AppKit)
 12  0x00007fff8c98265f -[NSTextInputContext(NSInputContext_WithCompletion) hasMarkedTextWithCompletionHandler:] (in AppKit)
 13  0x00007fff8c978c90 __55-[NSTextInputContext handleTSMEvent:completionHandler:]_block_invoke_2 (in AppKit)
 14  0x00007fff8c9769a8 -[NSTextInputContext tryHandleTSMEvent_HasMarkedText_withDispatchCondition:dispatchWork:continuation:] (in AppKit)
 15  0x00007fff8c978905 -[NSTextInputContext handleTSMEvent:completionHandler:] (in AppKit)
 16  0x00007fff8c35beee _NSTSMEventHandler (in AppKit)
 17  0x00007fff8da0598c DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) (in HIToolbox)
 18  0x00007fff8da04dce SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) (in HIToolbox)
 19  0x00007fff8da04c42 SendEventToEventTargetWithOptions (in HIToolbox)
 20  0x00007fff8dc17f4c SendTSMEvent_WithCompletionHandler (in HIToolbox)
 21  0x00007fff8dc1844c __SendUnicodeTextAEToUnicodeDoc_WithCompletionHandler_block_invoke (in HIToolbox)
 22  0x00007fff8dc18706 __SendFilterTextEvent_WithCompletionHandler_block_invoke (in HIToolbox)
 23  0x00007fff8dc17fa0 SendTSMEvent_WithCompletionHandler (in HIToolbox)
 24  0x00007fff8dc1828f SendFilterTextEvent_WithCompletionHandler (in HIToolbox)
 25  0x00007fff8dc15601 SendUnicodeTextAEToUnicodeDoc_WithCompletionHandler (in HIToolbox)
 26  0x00007fff8dc19f09 __utDeliverTSMEvent_WithCompletionHandler_block_invoke_2 (in HIToolbox)
 27  0x00007fff8dc19dd8 __utDeliverTSMEvent_WithCompletionHandler_block_invoke (in HIToolbox)
 28  0x00007fff8dc1507d TSMKeyEvent_WithCompletionHandler (in HIToolbox)
 29  0x00007fff8dc1ebd0 __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke_4 (in HIToolbox)
 30  0x00007fff8dc1eac6 __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke_3 (in HIToolbox)
 31  0x00007fff8dc1e902 __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke_2 (in HIToolbox)
 32  0x00007fff8dc1e785 __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke (in HIToolbox)
 33  0x00007fff8dc1e58f TSMProcessRawKeyEventWithOptionsAndCompletionHandler (in HIToolbox)
 34  0x00007fff8c980726 __61-[NSTextInputContext _handleEvent:options:completionHandler:]_block_invoke949 (in AppKit)
 35  0x00007fff8c97fc12 -[NSTextInputContext tryTSMProcessRawKeyEvent:dispatchCondition:setupForDispatch:furtherCondition:dispatchWork:continuation:] (in AppKit)
 36  0x00007fff8c980245 -[NSTextInputContext _handleEvent:options:completionHandler:] (in AppKit)
 37  0x00007fff8c35b71e -[NSTextInputContext handleEvent:] (in AppKit)
 38  0x00007fff8c33b374 -[NSView interpretKeyEvents:] (in AppKit)
 39  0x00007fff8c35b597 -[NSTextView keyDown:] (in AppKit)
 40  0x000000010144ee1b -[IDEConsoleTextView keyDown:] (in IDEKit)
 41  0x00007fff8c882fdb -[NSWindow _reallySendEvent:] (in AppKit)
 42  0x00007fff8c30b16e -[NSWindow sendEvent:] (in AppKit)
 43  0x0000000101440d5b -[IDEWorkspaceWindow sendEvent:] (in IDEKit)
 44  0x00007fff8c2bd3d1 -[NSApplication sendEvent:] (in AppKit)
 45  0x00000001011e8dd4 -[IDEApplication sendEvent:] (in IDEKit)
 46  0x00007fff8c149608 -[NSApplication run] (in AppKit)
 47  0x00007fff8c134a14 NSApplicationMain (in AppKit)
 48  0x00007fff9673c5c9 start (in libdyld.dylib)

I definitely don't understand what's happening here, because when commenting out the replacement call, I'm not getting the exception, otherwise I'm not getting the log, so I believe my call doesn't even happen, but it still produces a crash.

Can someone please help here?

julian-weinert avatar Mar 27 '15 23:03 julian-weinert