How to debug Xcode: "An internal error occurred. Source editor functionality is limited"

(Jesse Grosjean) #1

Recently autocomplete, syntax highlighting, and auto-indent have stopped
working (or work for a few minutes then break) in my Swift 3.1 Xcode 8.3.1
project. The project compiles without any warnings.

I guess this is all due to problems that the SourceKitService has with my
code? I notice lots (around 30 all in last few minutes) of SourceKitService
crash logs all with the same crash stack (Included at end of this email).

My question is... what's the best way to find the problem?

Does anyone recognize the below stack and know what might be causing that
particular crash? Is there any way to log what file the SourceKitService is
working on, so I can see what it's doing before the crash?


Crashed Thread: 6

Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000

Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [0]

VM Regions Near 0:
    __TEXT 000000010cbd9000-000000010ecd0000 [ 33.0M]
r-x/rwx SM=COW

Thread 6 Crashed:
0 0x000000010d4c265d
swift::ClassDecl::inheritsSuperclassInitializers(swift::LazyResolver*) + 589
1 0x000000010d437589
lookupObjCMethodInType(swift::Type, swift::ObjCSelector, bool, bool,
swift::SourceManager&, bool) + 217
2 0x000000010d4368e2
+ 1138
3 0x000000010d3d8b20
swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&,
swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int,
unsigned int) + 4416
4 0x000000010cd6b0b6
swift::CompilerInstance::performSema() + 5334
5 0x000000010cc4fca5
SourceKit::IndexingConsumer&, llvm::ArrayRef<char const*>, llvm::StringRef)
+ 6037
6 0x000000010cc6c712 void
std::__1::function<void (void*)>)::$_3>(void*) + 3250
7 libdispatch.dylib 0x00007fff9be788fc
_dispatch_client_callout + 8
8 libdispatch.dylib 0x00007fff9be8cccd
_dispatch_block_invoke_direct + 322
9 0x000000010eabae3f
executeBlock(void*) + 15
10 0x000000010ccdb74d
ExecuteOnThread_Dispatch(void*) + 13
11 libsystem_pthread.dylib 0x00007fff9c0c79af _pthread_body + 180
12 libsystem_pthread.dylib 0x00007fff9c0c78fb _pthread_start + 286
13 libsystem_pthread.dylib 0x00007fff9c0c7101 thread_start + 13