<div dir="ltr"><div class="gmail_default"><font size="2">Not sure what's up with clang's inclusion chain reporting, but I found a couple of SO threads [1] [2] <font size="2">regarding the need of the copy constructor:</font> apparently, until GCC 6, std::unordered_map could not emplace non-copyable values. Following the advice in [2], I was able to overcome the error by rewriting ThreadPlanStack::AddThread like this:<br></font></div><div class="gmail_default"><font size="2"></font></div><div class="gmail_default"><font size="2"><span style="font-family:monospace"></span></font></div><div class="gmail_default"><div style="color:rgb(0,0,0);background-color:rgb(255,255,255);font-weight:normal;line-height:19px;white-space:pre-wrap"><font size="2"><span style="font-family:monospace"> void AddThread(Thread &thread) {<br> lldb::tid_t tid = thread.GetID();<br> m_plans_list.emplace(std::piecewise_construct,<br> std::forward_as_tuple(tid),<br> std::forward_as_tuple(thread));<br> }</span></font></div></div><div class="gmail_default"><font size="2"><br></font></div><div class="gmail_default"><font size="2">[1]: <a href="https://stackoverflow.com/questions/44699545/why-does-stdmap-emplace-need-a-copy-constructor-on-gcc" target="_blank">https://stackoverflow.com/questions/44699545/why-does-stdmap-emplace-need-a-copy-constructor-on-gcc</a></font></div><div class="gmail_default"><font size="2">[2]: <a href="https://stackoverflow.com/questions/27960325/stdmap-emplace-without-copying-value" target="_blank">https://stackoverflow.com/questions/27960325/stdmap-emplace-without-copying-val<font size="2"><font size="2">use</font></font>ue</a></font></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Aug 4, 2021 at 5:10 PM Jim Ingham <<a href="mailto:jingham@apple.com" target="_blank">jingham@apple.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">That is certainly an odd chain of includes to end up complaining about ThreadPlanStacks...<br>
<br>
ABIMacOSX.cpp does see the definition of ThreadPlanStacks but not along that path... Something got fairly confused.<br>
<br>
There IS an implicitly deleted copy constructor for ThreadPlanStacks, but it doesn't get called anywhere. This is code that is built pretty much everywhere and this is the first time I've seen this error.<br>
<br>
In the ThreadPlanStack header file, there are a couple of routines the iterate over the map of ThreadPlanStacks like (m_plans_list is: std::unordered_map<lldb:tid_t, ThreadPlanStack>):<br>
<br>
void ClearThreadCache() {<br>
for (auto &plan_list : m_plans_list)<br>
plan_list.second.ClearThreadCache();<br>
}<br>
<br>
But those get "auto &" so they should just be pulling references to ThreadPlanStacks out, it shouldn't need to copy them.<br>
<br>
And then we do call find on the ThreadPlanStackMap and do something with the iterator returned:<br>
<br>
bool RemoveTID(lldb::tid_t tid) {<br>
auto result = m_plans_list.find(tid);<br>
if (result == m_plans_list.end())<br>
return false;<br>
result->second.ThreadDestroyed(nullptr);<br>
m_plans_list.erase(result);<br>
return true;<br>
}<br>
<br>
But the iterator of a map shouldn't require a copy of the value, that doesn't make sense.<br>
<br>
Other than that, I can't see anything funny here. <br>
<br>
Is this something triggered by -pedantic?<br>
<br>
Jim<br>
<br>
<br>
> On Aug 4, 2021, at 4:22 PM, Vadim Chugunov via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a>> wrote:<br>
> <br>
> Not sure if this is a supported configuration, but I am hitting this error when compiling on Ubuntu 16.04 with clang 12:<br>
> <br>
> FAILED: /usr/local/bin/clang++ -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/lldb/source/Plugins/ABI/ARM -I/__w/1/s/llvm-project/lldb/source/Plugins/ABI/ARM -Itools/lldb/source -I/__w/1/s/llvm-project/lldb/include -Itools/lldb/include -Iinclude -I/__w/1/s/llvm-project/llvm/include -I/__w/1/python/install/include/python3.9 -I/__w/1/s/llvm-project/llvm/../clang/include -Itools/lldb/../clang/include -I/__w/1/libxml2/install/include/libxml2 -I/__w/1/s/llvm-project/lldb/source/. -target x86_64-linux-gnu -fPIC -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-deprecated-register -Wno-vla-extension -Os -DNDEBUG -fno-exceptions -fno-rtti -std=c++14 -MD -MT tools/lldb/source/Plugins/ABI/ARM/CMakeFiles/lldbPluginABIARM.dir/ABIMacOSX_arm.cpp.o -MF tools/lldb/source/Plugins/ABI/ARM/CMakeFiles/lldbPluginABIARM.dir/ABIMacOSX_arm.cpp.o.d -o tools/lldb/source/Plugins/ABI/ARM/CMakeFiles/lldbPluginABIARM.dir/ABIMacOSX_arm.cpp.o -c /__w/1/s/llvm-project/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp<br>
> In file included from /__w/1/s/llvm-project/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp:9:<br>
> In file included from /__w/1/s/llvm-project/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.h:12:<br>
> In file included from /__w/1/s/llvm-project/lldb/include/lldb/Target/ABI.h:12:<br>
> In file included from /__w/1/s/llvm-project/lldb/include/lldb/Core/PluginInterface.h:12:<br>
> In file included from /__w/1/s/llvm-project/lldb/include/lldb/lldb-private.h:15:<br>
> In file included from /__w/1/s/llvm-project/lldb/include/lldb/lldb-private-enumerations.h:12:<br>
> In file included from /__w/1/s/llvm-project/llvm/include/llvm/ADT/StringRef.h:12:<br>
> In file included from /__w/1/s/llvm-project/llvm/include/llvm/ADT/STLExtras.h:19:<br>
> In file included from /__w/1/s/llvm-project/llvm/include/llvm/ADT/Optional.h:18:<br>
> In file included from /__w/1/s/llvm-project/llvm/include/llvm/ADT/Hashing.h:48:<br>
> In file included from /__w/1/s/llvm-project/llvm/include/llvm/Support/ErrorHandling.h:18:<br>
> In file included from /usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/string:40:<br>
> In file included from /usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/char_traits.h:39:<br>
> In file included from /usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/stl_algobase.h:64:<br>
> /usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/stl_pair.h:134:35: error: call to implicitly-deleted copy constructor of 'lldb_private::ThreadPlanStack'<br>
> : first(std::forward<_U1>(__x)), second(__y) { }<br>
> ^ ~~~<br>
> /usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/ext/new_allocator.h:120:23: note: in instantiation of function template specialization 'std::pair<const unsigned long, lldb_private::ThreadPlanStack>::pair<unsigned long &, void>' requested here<br>
> { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }<br>
> ^<br>
> /usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/alloc_traits.h:530:8: note: in instantiation of function template specialization '__gnu_cxx::new_allocator<std::pair<const unsigned long, lldb_private::ThreadPlanStack>>::construct<std::pair<const unsigned long, lldb_private::ThreadPlanStack>, unsigned long &, lldb_private::Thread &>' requested here<br>
> { __a.construct(__p, std::forward<_Args>(__args)...); }<br>
> ^<br>
> /usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/hashtable_policy.h:1955:28: note: in instantiation of function template specialization 'std::allocator_traits<std::allocator<std::pair<const unsigned long, lldb_private::ThreadPlanStack>>>::construct<std::pair<const unsigned long, lldb_private::ThreadPlanStack>, unsigned long &, lldb_private::Thread &>' requested here<br>
> __value_alloc_traits::construct(__a, __n->_M_valptr(),<br>
> ^<br>
> /usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/hashtable.h:1526:30: note: in instantiation of function template specialization 'std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<const unsigned long, lldb_private::ThreadPlanStack>, false>>>::_M_allocate_node<unsigned long &, lldb_private::Thread &>' requested here<br>
> __node_type* __node = this->_M_allocate_node(std::forward<_Args>(__args)...);<br>
> ^<br>
> /usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/hashtable.h:726:11: note: in instantiation of function template specialization 'std::_Hashtable<unsigned long, std::pair<const unsigned long, lldb_private::ThreadPlanStack>, std::allocator<std::pair<const unsigned long, lldb_private::ThreadPlanStack>>, std::__detail::_Select1st, std::equal_to<unsigned long>, std::hash<unsigned long>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true>>::_M_emplace<unsigned long &, lldb_private::Thread &>' requested here<br>
> { return _M_emplace(__unique_keys(), std::forward<_Args>(__args)...); }<br>
> ^<br>
> /usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/unordered_map.h:380:16: note: in instantiation of function template specialization 'std::_Hashtable<unsigned long, std::pair<const unsigned long, lldb_private::ThreadPlanStack>, std::allocator<std::pair<const unsigned long, lldb_private::ThreadPlanStack>>, std::__detail::_Select1st, std::equal_to<unsigned long>, std::hash<unsigned long>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true>>::emplace<unsigned long &, lldb_private::Thread &>' requested here<br>
> { return _M_h.emplace(std::forward<_Args>(__args)...); }<br>
> ^<br>
> /__w/1/s/llvm-project/lldb/include/lldb/Target/ThreadPlanStack.h:127:18: note: in instantiation of function template specialization 'std::unordered_map<unsigned long, lldb_private::ThreadPlanStack, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<std::pair<const unsigned long, lldb_private::ThreadPlanStack>>>::emplace<unsigned long &, lldb_private::Thread &>' requested here<br>
> m_plans_list.emplace(tid, thread);<br>
> ^<br>
> /__w/1/s/llvm-project/lldb/include/lldb/Target/ThreadPlanStack.h:113:32: note: copy constructor of 'ThreadPlanStack' is implicitly deleted because field 'm_stack_mutex' has a deleted copy constructor<br>
> mutable std::recursive_mutex m_stack_mutex;<br>
> ^<br>
> /usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/mutex:170:5: note: 'recursive_mutex' has been explicitly marked deleted here<br>
> recursive_mutex(const recursive_mutex&) = delete;<br>
> ^<br>
> 1 error generated.<br>
> <br>
> _______________________________________________<br>
> lldb-dev mailing list<br>
> <a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a><br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev</a><br>
<br>
</blockquote></div>