yuhua-chen / MCLog

Xcode plugin for filtering the console area.
MIT License
586 stars 55 forks source link

Xcode 7.0.1 crashes when opening source file #32

Closed username0x0a closed 8 years ago

username0x0a commented 8 years ago

Xcode crashes when trying to open Source Editor with any source file (.m/.h).

MCLog installed as the only plugin. Compiled from today's master branch.

Process:               Xcode [13710]
Path:                  /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier:            com.apple.dt.Xcode
Version:               7.0.1 (8228)
Build Info:            IDEFrameworks-8228000000000000~5
App Item ID:           497799835
App External ID:       813434267
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           Xcode [13710]
User ID:               502

Date/Time:             2015-10-05 11:49:49.657 +0200
OS Version:            Mac OS X 10.11 (15A284)
Report Version:        11
Anonymous UUID:        F89549D6-8159-6BAC-3E72-7DACC4A6D211

Time Awake Since Boot: 230000 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       EXC_I386_GPFLT
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
objc_msgSend() selector name: retain
ProductBuildVersion: 7A1001

Global Trace Buffer (reverse chronological seconds):
18446744041.544384 CFNetwork                    0x00007fff843a407b TCP Conn 0x7fc41d7f8710 SSL Handshake DONE
18446744042.618431 CFNetwork                    0x00007fff843a3f57 TCP Conn 0x7fc41d7f8710 starting SSL negotiation
18446744042.618622 CFNetwork                    0x00007fff843a2927 TCP Conn 0x7fc41d7f8710 complete. fd: 43, err: 0
18446744042.618988 CFNetwork                    0x00007fff84431121 TCP Conn 0x7fc41d7f8710 event 1. err: 0
18446744042.857777 CFNetwork                    0x00007fff843a1bf7 TCP Conn 0x7fc41d7f8710 started
18446744042.947887 CFNetwork                    0x00007fff8436575e Creating default cookie storage with process/bundle identifier
18446744042.947887 CFNetwork                    0x00007fff843656f6 Faulting in CFHTTPCookieStorage singleton
18446744042.947887 CFNetwork                    0x00007fff84365585 Faulting in NSHTTPCookieStorage singleton
18446744042.963017 CFNetwork                    0x00007fff844633b4 NSURLConnection finished with error - code -1100

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib                 0x00007fff8a7a5e69 objc_msgSend + 41
1   com.apple.dt.DVTKit             0x000000010cd9fcd8 -[DVTTextStorage invalidateAttributesInRange:] + 211
2   com.apple.UIFoundation          0x00007fff92e158be -[NSTextStorage processEditing] + 190
3   com.apple.dt.DVTKit             0x000000010cc614db -[DVTTextStorage processEditing] + 82
4   com.apple.UIFoundation          0x00007fff92e157c9 -[NSTextStorage edited:range:changeInLength:] + 311
5   com.apple.dt.DVTKit             0x000000010cc566c7 -[DVTTextStorage addLayoutManager:] + 151
6   com.apple.dt.IDE.IDESourceEditor    0x000000011a6ff79d -[IDESourceCodeEditor _doInitialSetup] + 944
7   com.apple.dt.IDE.IDESourceEditor    0x000000011a69027f -[IDESourceCodeEditor contentViewDidCompleteLayout] + 665
8   com.apple.dt.IDE.IDESourceEditor    0x000000011a68ffdf -[IDESourceCodeEditorContainerView didCompleteLayout] + 67
9   com.apple.dt.DVTKit             0x000000010cc53630 +[DVTLayoutView_ML _recursivelyLayoutSubviewsOfView:populatingSetWithLaidOutViews:] + 332
10  com.apple.dt.IDEKit             0x000000010db8633d __91-[IDEEditorContext _openNavigableItem:documentExtension:document:shouldInstallEditorBlock:]_block_invoke + 1667
11  com.apple.dt.IDEKit             0x000000010d9ecc8f -[IDEEditorContext _performBlockInsideReentrantGuard:] + 83
12  com.apple.dt.IDEKit             0x000000010d9ec75f -[IDEEditorContext _openNavigableItem:documentExtension:document:shouldInstallEditorBlock:] + 1138
13  com.apple.dt.IDEKit             0x000000010da1efe3 -[IDEEditorContext _openNavigableItem:withContentsOfURL:documentExtension:shouldInstallEditorBlock:] + 2030
14  com.apple.dt.IDEKit             0x000000010db87aaa -[IDEEditorContext _notifyDelegateAndOpenNavigableItem:withContentsURL:documentExtensionIdentifier:locationToSelect:annotationRepresentedObject:stateDictionary:annotationWantsIndicatorAnimation:exploreAnnotationRepresentedObject:highlightSelection:alwaysReplaceExistingNavigableItem:skipSubDocumentNavigationUnlessEditorIsReplaced:] + 3114
15  com.apple.dt.IDEKit             0x000000010db89807 -[IDEEditorContext _notifyDelegateAndOpenEditorHistoryItem:previousHistoryItemOrNil:alwaysReplaceExistingNavigableItem:skipSubDocumentNavigationUnlessEditorIsReplaced:] + 975
16  com.apple.dt.IDEKit             0x000000010db85422 -[IDEEditorContext _openEditorHistoryItem:previousHistoryItemOrNil:alwaysReplaceExistingNavigableItem:skipSubDocumentNavigationUnlessEditorIsReplaced:] + 342
17  com.apple.dt.IDEKit             0x000000010da1ce23 -[IDEEditorContext _openEditorHistoryItem:updateHistory:] + 352
18  com.apple.dt.IDEKit             0x000000010da1bf95 -[IDEEditorContext _openEditorHistoryItemFromStateSaving:] + 452
19  com.apple.dt.IDEKit             0x000000010da4ca06 -[IDEEditorBasicMode _setPersistentRepresentation:forIdentifier:] + 525
20  com.apple.dt.IDEKit             0x000000010de91e2b __60-[IDEEditorModeViewController _setPersistentRepresentation:]_block_invoke + 84
21  com.apple.CoreFoundation        0x00007fff9134418d __53-[__NSArrayI enumerateObjectsWithOptions:usingBlock:]_block_invoke + 77
22  com.apple.CoreFoundation        0x00007fff91344059 -[__NSArrayI enumerateObjectsWithOptions:usingBlock:] + 201
23  com.apple.dt.IDEKit             0x000000010da17d32 -[IDEEditorModeViewController _setPersistentRepresentation:] + 201
24  com.apple.dt.IDEKit             0x000000010da17b42 -[IDEEditorModeViewController revertStateWithDictionary:] + 170
25  com.apple.dt.DVTFoundation      0x000000010c5c2d1b -[DVTStateToken _pullStateFromDictionary:] + 325
26  com.apple.dt.DVTFoundation      0x000000010c5c2b44 -[DVTStateToken pullStateFromRepository] + 165
27  com.apple.dt.IDEKit             0x000000010d9f8fed -[IDEViewController revertState] + 132
28  com.apple.dt.IDEKit             0x000000010d9d782d -[IDEEditorArea _updateStateSavingRegistrations] + 442
29  com.apple.dt.IDEKit             0x000000010d9fb5b7 -[IDEEditorArea _refreshEditorContextsAndPreserveCurrentEditorHistoryStack:] + 703
30  com.apple.dt.IDEKit             0x000000010dbccac8 __31-[IDEEditorArea viewDidInstall]_block_invoke + 421
31  com.apple.dt.DVTFoundation      0x000000010c7b5ab4 __95-[NSObject(DVTObservingConvenience) _dvt_newObserverForKeyPath:options:owner:withHandlerBlock:]_block_invoke + 91
32  com.apple.dt.DVTFoundation      0x000000010c7b4d76 __73-[DVTObservingBlockToken observeValueForKeyPath:ofObject:change:context:]_block_invoke183 + 83
33  com.apple.dt.DVTFoundation      0x000000010c720c5f DVTInvokeWithStrongOwnership + 75
34  com.apple.dt.DVTFoundation      0x000000010c58519f -[DVTObservingBlockToken observeValueForKeyPath:ofObject:change:context:] + 320
35  com.apple.Foundation            0x00007fff889391f7 NSKeyValueNotifyObserver + 379
36  com.apple.Foundation            0x00007fff88938a67 NSKeyValueDidChange + 457
37  com.apple.Foundation            0x00007fff888f9ab8 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKey:key:key:usingBlock:] + 1148
38  com.apple.Foundation            0x00007fff88965027 _NSSetCharValueAndNotify + 268
39  com.apple.dt.IDEFoundation      0x000000010d2c4e32 __81-[IDEWorkspace _finishLoadingAsynchronously:shouldUpgradeFromSimpleFilesFocused:]_block_invoke + 349
40  com.apple.dt.IDEFoundation      0x000000010d2c5085 __81-[IDEWorkspace _finishLoadingAsynchronously:shouldUpgradeFromSimpleFilesFocused:]_block_invoke320 + 59
41  com.apple.Foundation            0x00007fff88939d5f __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 7
42  com.apple.Foundation            0x00007fff88939a20 -[NSBlockOperation main] + 100
43  com.apple.Foundation            0x00007fff889381c6 -[__NSOperationInternal _start:] + 654
44  com.apple.Foundation            0x00007fff889341b0 __NSOQSchedule_f + 194
45  libdispatch.dylib               0x00007fff832bf453 _dispatch_client_callout + 8
46  libdispatch.dylib               0x00007fff832d2c1c _dispatch_main_queue_callback_4CF + 1685
47  com.apple.CoreFoundation        0x00007fff9137d789 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
48  com.apple.CoreFoundation        0x00007fff9133c73d __CFRunLoopRun + 1949
49  com.apple.CoreFoundation        0x00007fff9133bd38 CFRunLoopRunSpecific + 296
50  com.apple.HIToolbox             0x00007fff9534cd55 RunCurrentEventLoopInMode + 235
51  com.apple.HIToolbox             0x00007fff9534cb8f ReceiveNextEventCommon + 432
52  com.apple.HIToolbox             0x00007fff9534c9cf _BlockUntilNextEventMatchingListInModeWithFilter + 71
53  com.apple.AppKit                0x00007fff8ac57f3a _DPSNextEvent + 1067
54  com.apple.AppKit                0x00007fff8ac57369 -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454
55  com.apple.dt.DVTKit             0x000000010cd7049b -[DVTApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 247
56  com.apple.AppKit                0x00007fff8ac4becc -[NSApplication run] + 682
57  com.apple.AppKit                0x00007fff8ac15162 NSApplicationMain + 1176
58  libdyld.dylib                   0x00007fff8cf295ad start + 1

Thread 1:
0   libsystem_kernel.dylib          0x00007fff84e0178a __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff841bc58c _pthread_wqthread + 1283
2   libsystem_pthread.dylib         0x00007fff841ba375 start_wqthread + 13

Thread 2:: Dispatch queue: com.apple.libdispatch-manager
0   libsystem_kernel.dylib          0x00007fff84e020a2 kevent_qos + 10
1   libdispatch.dylib               0x00007fff832c51ad _dispatch_mgr_invoke + 216
2   libdispatch.dylib               0x00007fff832c4e15 _dispatch_mgr_thread + 52

Thread 3:
0   libsystem_kernel.dylib          0x00007fff84e0178a __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff841bc58c _pthread_wqthread + 1283
2   libsystem_pthread.dylib         0x00007fff841ba375 start_wqthread + 13

Thread 4:
0   libsystem_kernel.dylib          0x00007fff84e0178a __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff841bc58c _pthread_wqthread + 1283
2   libsystem_pthread.dylib         0x00007fff841ba375 start_wqthread + 13

Thread 5:
0   libsystem_kernel.dylib          0x00007fff84e0178a __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff841bc58c _pthread_wqthread + 1283
2   libsystem_pthread.dylib         0x00007fff841ba375 start_wqthread + 13

Thread 6:
0   libsystem_kernel.dylib          0x00007fff84e0178a __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff841bc58c _pthread_wqthread + 1283
2   libsystem_pthread.dylib         0x00007fff841ba375 start_wqthread + 13

Thread 7:
0   libsystem_kernel.dylib          0x00007fff84dfbc96 mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff84dfb0d7 mach_msg + 55
2   com.apple.CoreFoundation        0x00007fff9133d024 __CFRunLoopServiceMachPort + 212
3   com.apple.CoreFoundation        0x00007fff9133c4ec __CFRunLoopRun + 1356
4   com.apple.CoreFoundation        0x00007fff9133bd38 CFRunLoopRunSpecific + 296
5   com.apple.Foundation            0x00007fff889170f9 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 270
6   com.apple.DTDeviceKitBase       0x0000000114ee432a -[DTDKRemoteDeviceDataListener listenerThreadImplementation] + 1103
7   com.apple.Foundation            0x00007fff88928084 __NSThread__start__ + 1351
8   libsystem_pthread.dylib         0x00007fff841bc9b1 _pthread_body + 131
9   libsystem_pthread.dylib         0x00007fff841bc92e _pthread_start + 168
10  libsystem_pthread.dylib         0x00007fff841ba385 thread_start + 13

Thread 8:: com.apple.CFSocket.private
0   libsystem_kernel.dylib          0x00007fff84e01222 __select + 10
1   com.apple.CoreFoundation        0x00007fff9137a29a __CFSocketManager + 762
2   libsystem_pthread.dylib         0x00007fff841bc9b1 _pthread_body + 131
3   libsystem_pthread.dylib         0x00007fff841bc92e _pthread_start + 168
4   libsystem_pthread.dylib         0x00007fff841ba385 thread_start + 13

Thread 9:
0   libsystem_kernel.dylib          0x00007fff84e0178a __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff841bc58c _pthread_wqthread + 1283
2   libsystem_pthread.dylib         0x00007fff841ba375 start_wqthread + 13

Thread 10:
0   libsystem_kernel.dylib          0x00007fff84e0178a __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff841bc58c _pthread_wqthread + 1283
2   libsystem_pthread.dylib         0x00007fff841ba375 start_wqthread + 13

Thread 11:: com.apple.NSURLConnectionLoader
0   libsystem_kernel.dylib          0x00007fff84dfbc96 mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff84dfb0d7 mach_msg + 55
2   com.apple.CoreFoundation        0x00007fff9133d024 __CFRunLoopServiceMachPort + 212
3   com.apple.CoreFoundation        0x00007fff9133c4ec __CFRunLoopRun + 1356
4   com.apple.CoreFoundation        0x00007fff9133bd38 CFRunLoopRunSpecific + 296
5   com.apple.CFNetwork             0x00007fff84368c2d +[NSURLConnection(Loader) _resourceLoadLoop:] + 412
6   com.apple.Foundation            0x00007fff88928084 __NSThread__start__ + 1351
7   libsystem_pthread.dylib         0x00007fff841bc9b1 _pthread_body + 131
8   libsystem_pthread.dylib         0x00007fff841bc92e _pthread_start + 168
9   libsystem_pthread.dylib         0x00007fff841ba385 thread_start + 13

Thread 12:
0   libsystem_kernel.dylib          0x00007fff84e0178a __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff841bc58c _pthread_wqthread + 1283
2   libsystem_pthread.dylib         0x00007fff841ba375 start_wqthread + 13

Thread 13:: com.apple.NSEventThread
0   libsystem_kernel.dylib          0x00007fff84dfbc96 mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff84dfb0d7 mach_msg + 55
2   com.apple.CoreFoundation        0x00007fff9133d024 __CFRunLoopServiceMachPort + 212
3   com.apple.CoreFoundation        0x00007fff9133c4ec __CFRunLoopRun + 1356
4   com.apple.CoreFoundation        0x00007fff9133bd38 CFRunLoopRunSpecific + 296
5   com.apple.AppKit                0x00007fff8adadeed _NSEventThread + 149
6   libsystem_pthread.dylib         0x00007fff841bc9b1 _pthread_body + 131
7   libsystem_pthread.dylib         0x00007fff841bc92e _pthread_start + 168
8   libsystem_pthread.dylib         0x00007fff841ba385 thread_start + 13

Thread 14:: DYMobileDeviceManager
0   libsystem_kernel.dylib          0x00007fff84dfbc96 mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff84dfb0d7 mach_msg + 55
2   com.apple.CoreFoundation        0x00007fff9133d024 __CFRunLoopServiceMachPort + 212
3   com.apple.CoreFoundation        0x00007fff9133c4ec __CFRunLoopRun + 1356
4   com.apple.CoreFoundation        0x00007fff9133bd38 CFRunLoopRunSpecific + 296
5   com.apple.Foundation            0x00007fff889170f9 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 270
6   com.apple.Foundation            0x00007fff88916fd8 -[NSRunLoop(NSRunLoop) run] + 74
7   com.apple.GPUToolsMobileFoundation  0x000000011feef061 -[DYMobileDeviceManager _deviceNotificationThread:] + 134
8   com.apple.Foundation            0x00007fff88928084 __NSThread__start__ + 1351
9   libsystem_pthread.dylib         0x00007fff841bc9b1 _pthread_body + 131
10  libsystem_pthread.dylib         0x00007fff841bc92e _pthread_start + 168
11  libsystem_pthread.dylib         0x00007fff841ba385 thread_start + 13

Thread 15:
0   libsystem_kernel.dylib          0x00007fff84e0178a __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff841bc58c _pthread_wqthread + 1283
2   libsystem_pthread.dylib         0x00007fff841ba375 start_wqthread + 13

Thread 16:: com.apple.appkit-heartbeat
0   libsystem_kernel.dylib          0x00007fff84e012b2 __semwait_signal + 10
1   libsystem_c.dylib               0x00007fff8992da75 nanosleep + 199
2   libsystem_c.dylib               0x00007fff8992d968 usleep + 54
3   com.apple.AppKit                0x00007fff8af410d0 -[NSUIHeartBeat _heartBeatThread:] + 2181
4   com.apple.Foundation            0x00007fff88928084 __NSThread__start__ + 1351
5   libsystem_pthread.dylib         0x00007fff841bc9b1 _pthread_body + 131
6   libsystem_pthread.dylib         0x00007fff841bc92e _pthread_start + 168
7   libsystem_pthread.dylib         0x00007fff841ba385 thread_start + 13

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x00007fff72ce2f10  rbx: 0x0000000000000000  rcx: 0x00007fff878ff018  rdx: 0x0000000000062e60
  rdi: 0x00007fff7262d420  rsi: 0x00007fff917129c0  rbp: 0x00007fff5368bfc0  rsp: 0x00007fff5368bf08
   r8: 0x0000000000000002   r9: 0x0000000000000000  r10: 0x00676e696a7b7065  r11: 0x00007fff878ff018
  r12: 0x00007fc41e268140  r13: 0x00007fc41e268140  r14: 0x00007fc41da81dc0  r15: 0x000000000000834b
  rip: 0x00007fff8a7a5e69  rfl: 0x0000000000010206  cr2: 0x000000010c692000

Logical CPU:     0
Error Code:      0x00000000
Trap Number:     13
yuhua-chen commented 8 years ago

try this sudo xcodebuild -license

objectmethod commented 8 years ago

Same issue for me. Accepting the Xcode license did not resolve my issue.

evilDave commented 8 years ago

Having the same issue too. Accepting the licence has no effect. I am on El Capitan, tried with xcode 7.0.1 and 7.1beta also.

guidedways commented 8 years ago

Same here, accepting the license is not the issue, it's something else causing it. El Capitan, 7.0.1.

guidedways commented 8 years ago

I commented out all code and it seems the culprit is this "hookDVTTextStorage()". If you comment this out, xcode won't crash. So this is clearly a bug that needs to be fixed in MCLog.

guidedways commented 8 years ago

Okay in order to fix the crash, simply comment out this line and build in release mode (thus installing the plugin automatically). Relaunch xcode and you're done:

OriginalFixAttributesInRangeIMP(self, _cmd, range);

andriichernenko commented 8 years ago

@guidedways fixed the issue for me too, thank you.

chadmoone commented 8 years ago

For anyone else stopping by, @guidedways suggestion worked for me as well.

andriichernenko commented 8 years ago

fixed the issue for me too

There is another problem, though - I cannot view any files (neither ObjC nor Swift) outside my Swift project. When I try to, all I see is empty editor (for ObjC) or "could not regenerate..." for Swift. Does anyone have any thoughts on that?

username0x0a commented 8 years ago

This also breaks some text fields, f.e. source editor in Run Script Build Phase etc.

See references below.

lucianoks commented 8 years ago

@guidedways solution works in El Capitain 10.11.1 (15B42) and Xcode 7.1 (7B91b)! Thanks! =) BTW for new versions of Xcode I use xcplugin_update.sh tks to @alexlee002

fiattt commented 8 years ago

it works. you save my day. tks @guidedways @alexlee002

xn4545945 commented 8 years ago

Xcode7.0.1/OSX 10.11.1 no longer crash. The latest version.

yuhua-chen commented 8 years ago

Btw, how you guys refer issues together like below? except for metioned in comment.

issue-ref
datnmstore commented 8 years ago

@yuhua-chen : I was tried to all way :(

yuhua-chen commented 8 years ago

@datnm Try the latest version. :)