Xcode 7在调试时崩溃

9

当我尝试在Xcode 7中使用iPhone模拟器(5s,iOS 8.4)调试我的应用程序时,经常会出现崩溃的情况:

Process:               Xcode [6913]
Path:                  /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier:            com.apple.dt.Xcode
Version:               7.1 (9079)
Build Info:            IDEFrameworks-9079000000000000~8
App Item ID:           497799835
App External ID:       813804225
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           Xcode [6913]
User ID:               501

Date/Time:             2015-11-02 13:37:44.248 +0300
OS Version:            Mac OS X 10.10.5 (14F1021)
Report Version:        11
Anonymous UUID:        CB3D1F12-E033-1160-2F9F-69DC0A89468E

Sleep/Wake UUID:       DA9F3D65-3E86-4A1C-9E41-2E921CDFD798

Time Awake Since Boot: 290000 seconds
Time Since Wake:       1500 seconds

Crashed Thread:        26  <DBGLLDBSessionThread (pid=42149)>  Dispatch queue: DVTInvalidationPreventionQueue

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000000

VM Regions Near 0:
--> 
    __TEXT                 000000010798f000-0000000107993000 [   16K] r-x/rwx SM=COW  /Applications/Xcode.app/Contents/MacOS/Xcode

Application Specific Information:
ProductBuildVersion: 7B91b


Thread 26 Crashed:: <DBGLLDBSessionThread (pid=42149)>  Dispatch queue: DVTInvalidationPreventionQueue
0   com.apple.LLDB.framework        0x0000000113efd3cb swift::ModuleFile::getModule(llvm::ArrayRef<swift::Identifier>) + 443
1   com.apple.LLDB.framework        0x0000000113f1116b swift::ModuleFile::associateWithFileContext(swift::FileUnit*, swift::SourceLoc) + 1739
2   com.apple.LLDB.framework        0x0000000113f175bd swift::SerializedModuleLoader::loadAST(swift::ModuleDecl&, llvm::Optional<swift::SourceLoc>, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer> >, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer> >, bool) + 589
3   com.apple.LLDB.framework        0x0000000113f199cf swift::SerializedModuleLoader::loadModule(swift::SourceLoc, llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >) + 5423
4   com.apple.LLDB.framework        0x0000000113b58004 swift::ASTContext::getModule(llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >) + 276
5   com.apple.LLDB.framework        0x0000000113efd385 swift::ModuleFile::getModule(llvm::ArrayRef<swift::Identifier>) + 373
6   com.apple.LLDB.framework        0x0000000113f1116b swift::ModuleFile::associateWithFileContext(swift::FileUnit*, swift::SourceLoc) + 1739
7   com.apple.LLDB.framework        0x0000000113f175bd swift::SerializedModuleLoader::loadAST(swift::ModuleDecl&, llvm::Optional<swift::SourceLoc>, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer> >, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer> >, bool) + 589
8   com.apple.LLDB.framework        0x0000000113f199cf swift::SerializedModuleLoader::loadModule(swift::SourceLoc, llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >) + 5423
9   com.apple.LLDB.framework        0x0000000113b58004 swift::ASTContext::getModule(llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >) + 276
10  com.apple.LLDB.framework        0x0000000113efd385 swift::ModuleFile::getModule(llvm::ArrayRef<swift::Identifier>) + 373
11  com.apple.LLDB.framework        0x0000000113f1116b swift::ModuleFile::associateWithFileContext(swift::FileUnit*, swift::SourceLoc) + 1739
12  com.apple.LLDB.framework        0x0000000113f175bd swift::SerializedModuleLoader::loadAST(swift::ModuleDecl&, llvm::Optional<swift::SourceLoc>, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer> >, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer> >, bool) + 589
13  com.apple.LLDB.framework        0x0000000113f199cf swift::SerializedModuleLoader::loadModule(swift::SourceLoc, llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >) + 5423
14  com.apple.LLDB.framework        0x0000000113b58004 swift::ASTContext::getModule(llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >) + 276
15  com.apple.LLDB.framework        0x00000001143a09bd lldb_private::SwiftASTContext::GetModule(lldb_private::ConstString const&, lldb_private::Error&) + 365
16  com.apple.LLDB.framework        0x00000001143a21d6 lldb_private::SwiftASTContext::ValidateSectionModules(lldb_private::Module&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) + 114
17  com.apple.LLDB.framework        0x000000011412d5ef lldb_private::Module::GetSwiftASTContext(lldb_private::Error*) + 2579
18  com.apple.LLDB.framework        0x000000011425922f SymbolFileDWARF::GetSwiftASTContext(lldb_private::Error*) + 83
19  com.apple.LLDB.framework        0x00000001143218dc std::__1::__function::__func<lldb_private::Target::GetSwiftASTContext(lldb_private::Error&, bool, char const*)::$_0, std::__1::allocator<lldb_private::Target::GetSwiftASTContext(lldb_private::Error&, bool, char const*)::$_0>, void (std::__1::shared_ptr<lldb_private::Module>&&)>::operator()(std::__1::shared_ptr<lldb_private::Module>&&) + 646
20  com.apple.LLDB.framework        0x000000011431c66d lldb_private::Target::GetSwiftASTContext(lldb_private::Error&, bool, char const*) + 1945
21  com.apple.LLDB.framework        0x000000011418a7ba lldb_private::formatters::swift::SwiftMetatype_SummaryProvider(lldb_private::ValueObject&, lldb_private::Stream&, lldb_private::TypeSummaryOptions const&) + 318
22  com.apple.LLDB.framework        0x000000011446b9c9 lldb_private::CXXFunctionSummaryFormat::FormatObject(lldb_private::ValueObject*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, lldb_private::TypeSummaryOptions const&) + 85
23  com.apple.LLDB.framework        0x0000000114165512 lldb_private::ValueObject::GetSummaryAsCString(lldb_private::TypeSummaryImpl*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, lldb_private::TypeSummaryOptions const&) + 202
24  com.apple.LLDB.framework        0x00000001141655ab lldb_private::ValueObject::GetSummaryAsCString(lldb::LanguageType) + 105
25  com.apple.LLDB.framework        0x0000000112427788 lldb::SBValue::GetSummary() + 78
26  com.apple.dt.dbg.DebuggerLLDB   0x000000011237985f -[DBGLLDBDataValue _calculateSummary] + 117
27  com.apple.dt.dbg.DebuggerLLDB   0x0000000112379500 __67-[DBGLLDBDataValue _fetchSummaryFromLLDBOnSessionThreadIfNecessary]_block_invoke + 104
28  com.apple.dt.DVTFoundation      0x0000000107a915ec ___DVTPreventInvalidationForObjectAllowingRecursiveCallsDuringBlock_block_invoke_2 + 49
29  libdispatch.dylib               0x00007fff8ddffe73 _dispatch_client_callout + 8
30  libdispatch.dylib               0x00007fff8de0eee9 _dispatch_sync_f_invoke + 39
31  com.apple.dt.DVTFoundation      0x0000000107a91596 ___DVTPreventInvalidationForObjectAllowingRecursiveCallsDuringBlock_block_invoke + 133
32  libdispatch.dylib               0x00007fff8ddffe73 _dispatch_client_callout + 8
33  libdispatch.dylib               0x00007fff8de0eee9 _dispatch_sync_f_invoke + 39
34  com.apple.dt.DVTFoundation      0x0000000107a913f2 _DVTPreventInvalidationForObjectAllowingRecursiveCallsDuringBlock + 372
35  com.apple.dt.DVTFoundation      0x0000000107a91745 _DVTPreventInvalidationAllowingRecursiveCallsDuringBlock + 35
36  com.apple.dt.dbg.DebuggerLLDB   0x0000000112378ba8 __44-[DBGLLDBDataValue _addSessionThreadAction:]_block_invoke + 122
37  com.apple.dt.dbg.DebuggerLLDB   0x000000011238c168 -[DBGLLDBSession handleNextActionWithState:withRunPending:] + 435
38  com.apple.dt.dbg.DebuggerLLDB   0x00000001123872f8 DBGLLDBSessionThread(void*) + 997
39  libsystem_pthread.dylib         0x00007fff873ec05a _pthread_body + 131
40  libsystem_pthread.dylib         0x00007fff873ebfd7 _pthread_start + 176
41  libsystem_pthread.dylib         0x00007fff873e93ed thread_start + 13

我在我的应用程序中使用Swift语言和几个框架,这是Cartfile文件:

github "robb/Cartography"
github "ReactiveCocoa/ReactiveCocoa" "v4.0.0-alpha.3"
github "realm/realm-cocoa"

也许有人已经见过这种崩溃,或者对此有想法。

同样的问题,也出现在ReactiveCocoa“v4.0.0-alpha.3”中(但是没有你的其他依赖项)。有趣。我们应该为RAC打开一个问题吗? - Ian Dundas
1
清除DerivedData和清理都没有帮助。 - Ian Dundas
6个回答

5

对我来说,解决了这个问题的方法是重新运行carthage bootstrap,Xcode 7.1.1(之前在我的断点上百分百复现)崩溃不再出现。


2

尝试删除DerivedData文件夹,这对我很有效。我认为Xcode 6的中间构建产品会导致Xcode 7崩溃。


1
你可以尝试删除派生数据,执行干净的构建,退出 Xcode 并重新启动你的机器。如果这还没有解决问题,可以尝试从Xcode --> 打开开发者工具 --> 模拟器中删除模拟器并重新添加,然后在 Simulator --> 硬件 --> 设备 --> 管理设备...中进行设置。 - Abhinav

1
一个解决办法可能是禁用模块调试。
在您的项目中搜索CLANG_ENABLE_MODULE_DEBUGGING,并将其设置为no。

1
我遇到了相同的Swift问题,重新安装Xcode解决了这个问题。 重新安装指的是删除xcode.app包,并从以下位置删除文件 - /Library/Developer - /Library/Developer/Application Support/Xcode - ~/Library/Developer - ~/Library/Developer/Application Support/Xcode + 我也对Simulator应用程序进行了相同的操作
此外,我删除了所有Xcode和模拟器首选项,这可能并不是必要的 - 删除DerivedData文件夹就足够了。
可能不需要删除并重新下载XCode。
别忘了备份。

1
当我尝试在真实设备上运行应用程序时,我在Xcode 9.1中遇到了同样的问题。我只需从设备中删除该应用程序,然后重新运行项目,Xcode就不会再崩溃了。

0

尽管将CLANG_ENABLE_MODULE_DEBUGGING标志降低,但在我的项目中经历了这种情况。这可能是边缘情况,但值得共享。

这是由我最新的提交引起的,其中我意外地将一个属性声明为protocol而不是id

@property (nonatomic, strong) MyObjectProtocol *selectedItem;

当我将其更改为以下内容后,问题得到了修复:

@property (nonatomic, strong) id<MyObjectProtocol> selectedItem;

我犯了一个大错误,但这并不是 Xcode 的错!!

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接