jpsim / SourceKitten

An adorable little framework and command line tool for interacting with SourceKit.
MIT License
2.31k stars 226 forks source link

Getting crashing trying to jazzy doc project #72

Closed johnno1962 closed 8 years ago

johnno1962 commented 9 years ago

Hi, I’m getting a crash trying to document this project:

https://github.com/RubyNative/RubyKit

$ brew install sourcekitten Warning: sourcekitten-0.5.0 already installed

Running xcodebuild Parsing main.swift (1/26) Parsing Object.swift (2/26) Parsing Kernel.swift (3/26) Parsing Array.swift (4/26) Parsing String.swift (5/26) /Library/Ruby/Gems/2.0.0/gems/jazzy-0.3.1/lib/jazzy/executable.rb:35:in `execute_command': /Library/Ruby/Gems/2.0.0/gems/jazzy-0.3.1/lib/jazzy/SourceKitten/bin/sourcekitten "doc"

The crashdump is:

Exception Type:        EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes:       0x0000000000000001, 0x0000000000000000

Application Specific Information:
fatal error: unexpectedly found nil while unwrapping an Optional value

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libswiftCore.dylib              0x000000010674093c _TTSf4s_s_d_d___TFSs18_fatalErrorMessageFTVSs12StaticStringS_S_Su_T_ + 44
1   com.sourcekitten.SourceKittenFramework  0x000000010657ced5 _TFV21SourceKittenFramework4FileP33_C13880BB1D10F84AB560DC044F1EF1219insertDocfS0_FTGVSs10DictionarySSP8SwiftXPC16XPCRepresentable__6parentGS1_SSPS3___6offsetVSs5Int64_GSqGS1_SSPS3____ + 629
2   com.sourcekitten.SourceKittenFramework  0x000000010657dd39 _TFV21SourceKittenFramework4FileP33_C13880BB1D10F84AB560DC044F1EF1219insertDocfS0_FTGVSs10DictionarySSP8SwiftXPC16XPCRepresentable__6parentGS1_SSPS3___6offsetVSs5Int64_GSqGS1_SSPS3____ + 4313
3   com.sourcekitten.SourceKittenFramework  0x000000010657dd39 _TFV21SourceKittenFramework4FileP33_C13880BB1D10F84AB560DC044F1EF1219insertDocfS0_FTGVSs10DictionarySSP8SwiftXPC16XPCRepresentable__6parentGS1_SSPS3___6offsetVSs5Int64_GSqGS1_SSPS3____ + 4313
4   com.sourcekitten.SourceKittenFramework  0x000000010657c923 _TFV21SourceKittenFramework4File24furtherProcessDictionaryfS0_FTGVSs10DictionarySSP8SwiftXPC16XPCRepresentable__22documentedTokenOffsetsGSaSi_17cursorInfoRequestCSo8NSObject9syntaxMapVS_9SyntaxMap_GS1_SSPS3___ + 2339
5   com.sourcekitten.SourceKittenFramework  0x00000001065539fd _TFV21SourceKittenFramework9SwiftDocsCfMS0_FT4fileVS_4File10dictionaryGVSs10DictionarySSP8SwiftXPC16XPCRepresentable__17cursorInfoRequestGSqCSo8NSObject__S0_ + 1821
6   com.sourcekitten.SourceKittenFramework  0x0000000106553197 _TFV21SourceKittenFramework9SwiftDocsCfMS0_FT4fileVS_4File9argumentsGSaSS__S0_ + 567
7   com.sourcekitten.SourceKittenFramework  0x0000000106592482 _TFFV21SourceKittenFramework6Moduleg4docsGSaVS_9SwiftDocs_U_FSSGSqS1__ + 3410
8   com.sourcekitten.SourceKittenFramework  0x000000010658cf56 _TPA__TFFV21SourceKittenFramework6Moduleg4docsGSaVS_9SwiftDocs_U_FSSGSqS1__ + 294
9   com.sourcekitten.SourceKittenFramework  0x000000010659320a _TTRXFo_oSS_oGSqV21SourceKittenFramework9SwiftDocs__XFo_iSS_iGSqS0___ + 74
10  com.sourcekitten.SourceKittenFramework  0x000000010658d041 _TPA__TTRXFo_oSS_oGSqV21SourceKittenFramework9SwiftDocs__XFo_iSS_iGSqS0___ + 81
11  libswiftCore.dylib              0x00000001066ff4cc _TFVSs17MapCollectionViewg9subscriptFQQ_5IndexQ0_ + 172

Could you take a look?

Tried to myself but got a variation on the the Xcode 7 blues :(

carthage update
*** Fetching xcconfigs
*** Fetching Commandant
*** Fetching SWXMLHash
*** Fetching SwiftXPC
Failed to check out repository into /Users/johnholdsworth/Library/Caches/org.carthage.CarthageKit/dependencies/SWXMLHash: No object named "xcode-7.0” exists
jpsim commented 9 years ago

What happens when you just run xcodebuild from the root directory?

johnno1962 commented 9 years ago

\ BUILD SUCCEEDED **

$ xcode-select -p /Applications/Xcode.app/Contents/Developer

(Xcode 7.0.1)

jpsim commented 9 years ago

Alright, I'll take a look. Sorry you've hit this, @johnno1962.

johnno1962 commented 9 years ago

Thanks JP. There is some slightly eccentric code in there perhaps.

couchdeveloper commented 9 years ago

I do have a similar issue in File.insertDoc:

(there's no application specific information)

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

Exception Type:        EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes:       0x0000000000000001, 0x0000000000000000

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.sourcekitten.SourceKittenFramework  0x0000000100489d1e _TTSf4g_n_n_n___TFV21SourceKittenFramework4FileP33_C13880BB1D10F84AB560DC044F1EF1219insertDocfS0_FTGVSs10DictionarySSP8SwiftXPC16XPCRepresentable__6parentGS1_SSPS3___6offsetVSs5Int64_GSqGS1_SSPS3____ + 10014
1   com.sourcekitten.SourceKittenFramework  0x0000000100488c65 _TTSf4g_n_n_n___TFV21SourceKittenFramework4FileP33_C13880BB1D10F84AB560DC044F1EF1219insertDocfS0_FTGVSs10DictionarySSP8SwiftXPC16XPCRepresentable__6parentGS1_SSPS3___6offsetVSs5Int64_GSqGS1_SSPS3____ + 5733
2   com.sourcekitten.SourceKittenFramework  0x0000000100488c65 _TTSf4g_n_n_n___TFV21SourceKittenFramework4FileP33_C13880BB1D10F84AB560DC044F1EF1219insertDocfS0_FTGVSs10DictionarySSP8SwiftXPC16XPCRepresentable__6parentGS1_SSPS3___6offsetVSs5Int64_GSqGS1_SSPS3____ + 5733
3   com.sourcekitten.SourceKittenFramework  0x0000000100482fda _TFV21SourceKittenFramework4File24furtherProcessDictionaryfS0_FTGVSs10DictionarySSP8SwiftXPC16XPCRepresentable__22documentedTokenOffsetsGSaSi_17cursorInfoRequestPSo13OS_xpc_object_9syntaxMapVS_9SyntaxMap_GS1_SSPS3___ + 4362
4   com.sourcekitten.SourceKittenFramework  0x0000000100497011 _TTSf4gs_n_n_s___TFFV21SourceKittenFramework6Moduleg4docsGSaVS_9SwiftDocs_U_FSSGSqS1__ + 3953
5   com.sourcekitten.SourceKittenFramework  0x0000000100493eff _TFV21SourceKittenFramework6Moduleg4docsGSaVS_9SwiftDocs_ + 383
6   sourcekitten                    0x000000010043acd0 0x100432000 + 36048
7   sourcekitten                    0x000000010043b544 0x100432000 + 38212
8   sourcekitten                    0x0000000100434985 0x100432000 + 10629
9   sourcekitten                    0x0000000100434a2b 0x100432000 + 10795
10  com.antitypical.Result          0x0000000100519faa _TFO6Result6Result8analysisu0__Rq0_Ss9ErrorType_fGS0_q_q0__FT9ifSuccessFq_qd__9ifFailureFq0_qd___qd__ + 378
11  com.antitypical.Result          0x000000010051a13f _TFO6Result6Result7flatMapu0__Rq0_Ss9ErrorType_fGS0_q_q0__FFq_GS0_qd__q0__GS0_qd__q0__ + 111
12  sourcekitten                    0x0000000100434647 0x100432000 + 9799
13  org.carthage.Commandant         0x00000001004e48fe _TPA__TFFV10Commandant9CommandOfcu__Rqd__S_11CommandTypezq_qqd__S1_11ClientError_FMGS0_q__Fqd__GS0_q__U_FOS_11CommandModeGO6Result6ResultT_GOS_15CommandantErrorQd____ + 94
14  org.carthage.Commandant         0x00000001004e46a1 _TFC10Commandant15CommandRegistry10runCommandurfGS0_q__FTSS9argumentsGSaSS__GSqGO6Result6ResultT_GOS_15CommandantErrorq____ + 273
15  org.carthage.Commandant         0x00000001004e4bf9 _TFC10Commandant15CommandRegistry4mainurfGS0_q__FT11defaultVerbSS12errorHandlerFq_T__T_ + 569
16  sourcekitten                    0x0000000100433e5c 0x100432000 + 7772
17  libdyld.dylib                   0x00007fff8ed475c9 start + 1

Thread 1:: Dispatch queue: com.apple.libdispatch-manager
0   libsystem_kernel.dylib          0x00007fff8d681232 kevent64 + 10
1   libdispatch.dylib               0x00007fff89b52a6a _dispatch_mgr_thread + 52

Thread 2:
0   libsystem_kernel.dylib          0x00007fff8d68094a __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff8eab93dd start_wqthread + 13

Thread 3:
0   libsystem_kernel.dylib          0x00007fff8d68094a __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff8eab93dd start_wqthread + 13

Thread 4:
0   libsystem_kernel.dylib          0x00007fff8d68094a __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff8eab93dd start_wqthread + 13

Thread 5:
0   libsystem_kernel.dylib          0x00007fff8d68094a __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff8eab93dd start_wqthread + 13

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x000000000000000c  rbx: 0x00007fbe18d46cf0  rcx: 0x0000000000000000  rdx: 0x0000000000000018
  rdi: 0x00007fbe18d46cf0  rsi: 0x0000000000000018  rbp: 0x00007fff5f7ca9a0  rsp: 0x00007fff5f7c9d70
   r8: 0x0000000000000000   r9: 0x0000000000000003  r10: 0x00007fbe1b300000  r11: 0x0000000001180a89
  r12: 0x0000000000000000  r13: 0x00007fbe18d46cf0  r14: 0x00007fbe19035200  r15: 0x00007fbe18e06a01
  rip: 0x0000000100489d1e  rfl: 0x0000000000010246  cr2: 0x0000000100488000

Logical CPU:     7
Error Code:      0x00000000
Trap Number:     6
tom-sparo commented 9 years ago

@jpsim This error is likely because the xcode-7.0 branch of SWXMLHash has been merged into master. I think the bugfix is to update your Cartfile to point to master.

jpsim commented 8 years ago

@johnno1962 this seems to work now. Running sourcekitten doc from the root of the SwiftRuby repo generates the following doc info: https://gist.github.com/jpsim/96ab29f94d8d65afe7ec

Sorry it took so long for me to take a look at this.

johnno1962 commented 8 years ago

Thanks @jpsim. Now, if I could just un-bork by ruby gems after upgrading to El Cap...