[Lldb-commits] [PATCH] D114288: [NFC] Refactor symbol table parsing.
Dave Lee via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Aug 24 08:58:13 PDT 2022
kastiglione added inline comments.
Herald added subscribers: pmatos, asb.
Herald added a project: All.
================
Comment at: lldb/source/Symbol/ObjectFile.cpp:739
+ // are protected by a mutex in the Symtab object itself.
+ llvm::call_once(*m_symtab_once_up, [&]() {
+ ElapsedTime elapsed(module_sp->GetSymtabParseTime());
----------------
During expression evaluation, I am hitting a deadlock where a reentrant call to `ObjectFile::GetSymtab` is happening with he same `once_flag`, causing it to block. This is macOS/arm64.
Here's a (simplified) stack:
```
frame #4: void llvm::call_once<lldb_private::ObjectFile::GetSymtab()::$_0>(flag=0x..., F=0x...)::$_0&&) at Threading.h:89
frame #5: lldb_private::ObjectFile::GetSymtab(this=0x...) at ObjectFile.cpp:758
frame #6: SymbolFileSymtab::CalculateAbilities(this=0x...) at SymbolFileSymtab.cpp:60
frame #7: lldb_private::SymbolFile::GetAbilities(this=0x...) at SymbolFile.h:105
frame #8: lldb_private::SymbolFile::FindPlugin(objfile_sp=std::shared_ptr<lldb_private::ObjectFile>::element_type @ 0x... strong=7 weak=2) at SymbolFile.cpp:72
frame #9: lldb_private::SymbolVendor::AddSymbolFileRepresentation(this=0x..., objfile_sp=std::shared_ptr<lldb_private::ObjectFile>::element_type @ 0x... strong=7 weak=2) at SymbolVendor.cpp:71
frame #10:`lldb_private::SymbolVendor::FindPlugin(module_sp=std::shared_ptr<lldb_private::Module>::element_type @ 0x... strong=12 weak=12, feedback_strm=0x...) at SymbolVendor.cpp:57
frame #11:`lldb_private::Module::GetSymbolFile(this=0x..., can_create=true, feedback_strm=0x...) at Module.cpp:1070
frame #12:`lldb_private::Module::FindFunctions(this=0x..., name="$s17_StringProcessing14AnyRegexOutputVMa", parent_decl_ctx=0x..., name_type_mask=eFunctionNameTypeFull, options=0x..., sc_list=0x...) at Module.cpp:830
frame #13:`lldb_private::ModuleList::FindFunctions(this=0x..., name="$s17_StringProcessing14AnyRegexOutputVMa", name_type_mask=eFunctionNameTypeFull, options=0x..., sc_list=0x...) const at ModuleList.cpp:512
frame #14:`lldb_private::IRExecutionUnit::FindInSymbols(this=0x..., names=size=2, sc=0x..., symbol_was_missing_weak=0x...) at IRExecutionUnit.cpp:841
frame #15:`lldb_private::IRExecutionUnit::FindSymbol(this=0x..., name="_$s17_StringProcessing14AnyRegexOutputVMa", missing_weak=0x...) at IRExecutionUnit.cpp:913
frame #16:`lldb_private::IRExecutionUnit::MemoryManager::GetSymbolAddressAndPresence(this=0x..., Name="_$s17_StringProcessing14AnyRegexOutputVMa", missing_weak=0x...) at IRExecutionUnit.cpp:1008
frame #17:`lldb_private::IRExecutionUnit::MemoryManager::findSymbol(this=0x..., Name="_$s17_StringProcessing14AnyRegexOutputVMa") at IRExecutionUnit.cpp:986
frame #18:`llvm::LinkingSymbolResolver::findSymbol(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) + 128
frame #19:`llvm::LegacyJITSymbolResolver::lookup(std::set<llvm::StringRef, std::less<llvm::StringRef>, std::allocator<llvm::StringRef> > const&, llvm::unique_function<void (llvm::Expected<std::map<llvm::StringRef, llvm::JITEvaluatedSymbol, std::less<llvm::StringRef>, std::allocator<std::pair<llvm::StringRef const, llvm::JITEvaluatedSymbol> > > >)>) + 308
frame #20:`llvm::RuntimeDyldImpl::resolveExternalSymbols() + 708
frame #21:`llvm::RuntimeDyldImpl::resolveRelocations() + 248
frame #22:`llvm::MCJIT::finalizeLoadedModules() + 56
frame #23:`llvm::MCJIT::getGlobalValueAddress(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) + 68
frame #24:`lldb_private::IRExecutionUnit::PopulateSymtab(this=0x..., obj_file=0x..., symtab=0x...) at IRExecutionUnit.cpp:1244
frame #25:`ObjectFileJIT::ParseSymtab(this=0x..., symtab=0x...) at ObjectFileJIT.cpp:112
frame #26:`lldb_private::ObjectFile::GetSymtab(this=0x...)::$_0::operator()() const at ObjectFile.cpp:764
frame #27:`decltype(__f=0x...)::$_0>(fp)()) std::__invoke<lldb_private::ObjectFile::GetSymtab()::$_0>(lldb_private::ObjectFile::GetSymtab()::$_0&&) at type_traits:3918
frame #28:`void std::__call_once_param<std::tuple<lldb_private::ObjectFile::GetSymtab()::$_0&&> >::__execute<>(this=0x..., (null)=__tuple_indices<> @ 0x...) at mutex:630
frame #29:`std::__call_once_param<std::tuple<lldb_private::ObjectFile::GetSymtab()::$_0&&> >::operator(this=0x...)() at mutex:622
frame #30:`void std::__call_once_proxy<std::tuple<lldb_private::ObjectFile::GetSymtab()::$_0&&> >(__vp=0x...) at mutex:658
frame #31:++.1.dylib`std::__call_once(unsigned long volatile&, void*, void (*)(void*)) + 180
frame #32:`void std::call_once<lldb_private::ObjectFile::GetSymtab()::$_0>(__flag=0x..., __func=0x...)::$_0&&) at mutex:676
frame #33:`void llvm::call_once<lldb_private::ObjectFile::GetSymtab()::$_0>(flag=0x..., F=0x...)::$_0&&) at Threading.h:89
frame #34:`lldb_private::ObjectFile::GetSymtab(this=0x...) at ObjectFile.cpp:758
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114288/new/
https://reviews.llvm.org/D114288
More information about the lldb-commits
mailing list