每当添加断点时 LLDB 就会崩溃

Posted

技术标签:

【中文标题】每当添加断点时 LLDB 就会崩溃【英文标题】:LLDB crashes whenever Breakpoints are added 【发布时间】:2019-06-01 23:49:24 【问题描述】:

我在 Xcode 10.1 中有一个项目,其中包含 Objective C 和 Swift 代码。每当我在我的 swift 代码中应用断点时,LLDB 就会崩溃,这最终会结束调试会话。我完全陷入这种情况,因为我无法调试我的代码。我尝试将断点移动到其他行(由其他一些帖子建议),但它不起作用。 有什么解决方法吗?

来自调试器的消息:LLDB RPC 服务器已崩溃。崩溃日志位于 ~/Library/Logs/DiagnosticReports 并具有前缀“lldb-rpc-server”。

崩溃摘要:

Thread 11 Crashed:: RPC packet thread for client tid 0028defc (2678524)
0   libsystem_kernel.dylib          0x00007fff6d6a223e __pthread_kill + 10
1   libsystem_pthread.dylib         0x00007fff6d758c1c pthread_kill + 285
2   libsystem_c.dylib               0x00007fff6d60b1c9 abort + 127
3   com.apple.LLDB.framework        0x0000000106bd2443 swift::ModuleFile::fatal(llvm::Error) + 835
4   com.apple.LLDB.framework        0x0000000106be3753 swift::ModuleFile::getDeclCheckedImpl(llvm::PointerEmbeddedInt<unsigned int, 31>, llvm::Optional<swift::DeclContext*>) + 30515
5   com.apple.LLDB.framework        0x0000000106bd321e swift::ModuleFile::getDeclChecked(llvm::PointerEmbeddedInt<unsigned int, 31>, llvm::Optional<swift::DeclContext*>) + 78
6   com.apple.LLDB.framework        0x0000000106c0a707 swift::ModuleFile::loadExtensions(swift::NominalTypeDecl*) + 1911
7   com.apple.LLDB.framework        0x0000000106c13011 swift::SerializedModuleLoader::loadExtensions(swift::NominalTypeDecl*, unsigned int) + 49
8   com.apple.LLDB.framework        0x00000001062246bf swift::ASTContext::loadExtensions(swift::NominalTypeDecl*, unsigned int) + 63
9   com.apple.LLDB.framework        0x00000001062a6272 swift::NominalTypeDecl::getExtensions() + 82
10  com.apple.LLDB.framework        0x000000010631681e populateLookupTableEntryFromExtensions(swift::ASTContext&, swift::MemberLookupTable&, swift::NominalTypeDecl*, swift::DeclName, bool) + 46
11  com.apple.LLDB.framework        0x0000000106316e98 swift::NominalTypeDecl::lookupDirect(swift::DeclName, bool) + 616
12  com.apple.LLDB.framework        0x0000000106301a66 swift::ModuleDecl::lookupMember(llvm::SmallVectorImpl<swift::ValueDecl*>&, swift::DeclContext*, swift::DeclName, swift::Identifier) const + 86
13  com.apple.LLDB.framework        0x000000010643e5a1 FindNamedDecls(swift::ASTContext*, swift::DeclBaseName const&, VisitNodeResult&, llvm::Optional<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >) + 1313
14  com.apple.LLDB.framework        0x0000000106437cdf VisitNode(swift::ASTContext*, swift::Demangle::Node*, VisitNodeResult&) + 2703
15  com.apple.LLDB.framework        0x0000000106439e25 VisitNode(swift::ASTContext*, swift::Demangle::Node*, VisitNodeResult&) + 11221
16  com.apple.LLDB.framework        0x000000010643d94c swift::ide::getTypeFromMangledSymbolname(swift::ASTContext&, llvm::StringRef, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) + 204
17  com.apple.LLDB.framework        0x000000010705e2e7 lldb_private::SwiftASTContext::GetTypeFromMangledTypename(char const*, lldb_private::Status&) + 535
18  com.apple.LLDB.framework        0x0000000106db6241 DWARFASTParserSwift::ParseTypeFromDWARF(lldb_private::SymbolContext const&, DWARFDIE const&, lldb_private::Log*, bool*) + 933
19  com.apple.LLDB.framework        0x0000000106ee6a15 SymbolFileDWARF::ParseType(lldb_private::SymbolContext const&, DWARFDIE const&, bool*) + 209
20  com.apple.LLDB.framework        0x0000000106ee01fa SymbolFileDWARF::GetTypeForDIE(DWARFDIE const&, bool) + 486
21  com.apple.LLDB.framework        0x0000000106edf9ce SymbolFileDWARF::ResolveType(DWARFDIE const&, bool, bool) + 68
22  com.apple.LLDB.framework        0x0000000106edf94d SymbolFileDWARF::ResolveTypeUID(unsigned long long) + 45
23  com.apple.LLDB.framework        0x0000000106f2e87d lldb_private::Function::GetType() + 105
24  com.apple.LLDB.framework        0x0000000106f2e73c lldb_private::Function::GetStartLineSourceInfo(lldb_private::FileSpec&, unsigned int&) + 60
25  com.apple.LLDB.framework        0x0000000106c6c488 lldb_private::BreakpointResolverFileLine::FilterContexts(lldb_private::SymbolContextList&) + 262
26  com.apple.LLDB.framework        0x0000000106c6c88d lldb_private::BreakpointResolverFileLine::SearchCallback(lldb_private::SearchFilter&, lldb_private::SymbolContext&, lldb_private::Address*, bool) + 263
27  com.apple.LLDB.framework        0x0000000106d51f80 lldb_private::SearchFilter::DoModuleIteration(lldb_private::SymbolContext const&, lldb_private::Searcher&) + 346
28  com.apple.LLDB.framework        0x0000000106d51dd9 lldb_private::SearchFilter::Search(lldb_private::Searcher&) + 153
29  com.apple.LLDB.framework        0x0000000106f96b9f lldb_private::Target::AddBreakpoint(std::__1::shared_ptr<lldb_private::Breakpoint>, bool) + 203
30  com.apple.LLDB.framework        0x0000000106f97f29 lldb_private::Target::CreateBreakpoint(std::__1::shared_ptr<lldb_private::SearchFilter>&, std::__1::shared_ptr<lldb_private::BreakpointResolver>&, bool, bool, bool) + 249
31  com.apple.LLDB.framework        0x0000000106f98352 lldb_private::Target::CreateBreakpoint(lldb_private::FileSpecList const*, lldb_private::FileSpec const&, unsigned int, unsigned long long, lldb_private::LazyBool, lldb_private::LazyBool, bool, bool, lldb_private::LazyBool) + 920
32  com.apple.LLDB.framework        0x0000000103dda3d8 lldb::SBTarget::BreakpointCreateByLocation(lldb::SBFileSpec const&, unsigned int, unsigned long long, lldb::SBFileSpecList&) + 246
33  com.apple.LLDB.framework        0x0000000103dda2b0 lldb::SBTarget::BreakpointCreateByLocation(lldb::SBFileSpec const&, unsigned int, unsigned long long) + 62
34  com.apple.LLDB.framework        0x0000000103dda226 lldb::SBTarget::BreakpointCreateByLocation(char const*, unsigned int) + 64
35  lldb-rpc-server                 0x0000000103af6f5d rpc_server::_ZN4lldb8SBTarget26BreakpointCreateByLocationEPKcj::HandleRPCCall(rpc_common::Connection&, rpc_common::RPCStream&, rpc_common::RPCStream&) + 179
36  lldb-rpc-server                 0x0000000103b0073f rpc_common::Connection::PrivateHandleRPCPacket(rpc_common::RPCPacket&, rpc_common::RPCPacket&, bool&) + 469
37  lldb-rpc-server                 0x0000000103b014e0 rpc_common::Connection::HandleRPCPacket(rpc_common::RPCPacket&) + 62
38  lldb-rpc-server                 0x0000000103b04f12 Packets::ProcessPackets() + 256
39  lldb-rpc-server                 0x0000000103b04d95 Packets::ReadThread() + 289
40  lldb-rpc-server                 0x0000000103b04c6f Packets::RunReadThread(void*) + 9
41  libsystem_pthread.dylib         0x00007fff6d756305 _pthread_body + 126
42  libsystem_pthread.dylib         0x00007fff6d75926f _pthread_start + 70
43  libsystem_pthread.dylib         0x00007fff6d755415 thread_start + 13

Thread 11 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000  rbx: 0x0000700010856000  rcx: 0x00007000108534f8  rdx: 0x0000000000000000
rdi: 0x0000000000003e0b  rsi: 0x0000000000000006  rbp: 0x0000700010853530  rsp: 0x00007000108534f8
r8: 0x000000000000000b   r9: 0x0000000000000000  r10: 0x0000000000000000  r11: 0x0000000000000206
r12: 0x0000000000003e0b  r13: 0x0000000107fd4d70  r14: 0x0000000000000006  r15: 0x000000000000002d
rip: 0x00007fff6d6a223e  rfl: 0x0000000000000206  cr2: 0x00007fffa0349188

Complete crash log

崩溃发生在 swift 代码中,Objective C 代码工作正常。此外,这不是偶然的,它每次都会发生。 我也尝试过清除所有 Xcode 缓存和派生数据。

【问题讨论】:

我也遇到了这个问题,不知道如何解决。控制台中也没有其他错误有帮助。 :( 我认为这个问题在最新的 XCode 版本中得到了一定程度的解决。现在这种崩溃非常不频繁。但遗憾的是,它发生了,我仍然没有任何解决方案。 【参考方案1】:

我遇到了同样的情况,希望我的解决方案能帮到你。 添加断点时我的 Xcode LLDB 崩溃的原因是我的项目名称 (Security) 与 Apple 的框架相同。 将项目名称切换为另一个随机名称后,问题解决了。

【讨论】:

这并不能真正回答问题。如果您有其他问题,可以点击 提问。一旦你有足够的reputation,你也可以add a bounty 来引起对这个问题的更多关注。 - From Review @lgor F 可能是我太委婉了。我恰好遇到了问题的情况,并且找到了解决方案。提问者是唯一可以通过尝试来判断答案是否正确的人。

以上是关于每当添加断点时 LLDB 就会崩溃的主要内容,如果未能解决你的问题,请参考以下文章

iOS 11 - 在 VKSideMenu 中添加子视图时崩溃

LLDB:添加符号文件?

每当我将文件添加到项目时,XCode 都会崩溃

添加断点时 Javascript 文件被锁定

应用程序仅与(lldb)崩溃?

添加 ImageView 时应用程序崩溃?