teemperor created this revision. teemperor added a reviewer: LLDB. teemperor added a project: LLDB. Herald added a subscriber: JDevlieghere. teemperor requested review of this revision.
TestMultipleTargets is randomly failing on the bots. The reason for that is that the test is calling `SBDebugger::CreateTarget` from multiple threads. `TargetList::CreateTarget` is curiously missing the guard that all of its other member functions have, so all the threads in the test end up changing the internal TargetList state at the same time and end up corrupting it. https://reviews.llvm.org/D103020 Files: lldb/source/Target/TargetList.cpp Index: lldb/source/Target/TargetList.cpp =================================================================== --- lldb/source/Target/TargetList.cpp +++ lldb/source/Target/TargetList.cpp @@ -48,6 +48,7 @@ LoadDependentFiles load_dependent_files, const OptionGroupPlatform *platform_options, TargetSP &target_sp) { + std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex); auto result = TargetList::CreateTargetInternal( debugger, user_exe_path, triple_str, load_dependent_files, platform_options, target_sp); @@ -62,6 +63,7 @@ const ArchSpec &specified_arch, LoadDependentFiles load_dependent_files, PlatformSP &platform_sp, TargetSP &target_sp) { + std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex); auto result = TargetList::CreateTargetInternal( debugger, user_exe_path, specified_arch, load_dependent_files, platform_sp, target_sp);
Index: lldb/source/Target/TargetList.cpp =================================================================== --- lldb/source/Target/TargetList.cpp +++ lldb/source/Target/TargetList.cpp @@ -48,6 +48,7 @@ LoadDependentFiles load_dependent_files, const OptionGroupPlatform *platform_options, TargetSP &target_sp) { + std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex); auto result = TargetList::CreateTargetInternal( debugger, user_exe_path, triple_str, load_dependent_files, platform_options, target_sp); @@ -62,6 +63,7 @@ const ArchSpec &specified_arch, LoadDependentFiles load_dependent_files, PlatformSP &platform_sp, TargetSP &target_sp) { + std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex); auto result = TargetList::CreateTargetInternal( debugger, user_exe_path, specified_arch, load_dependent_files, platform_sp, target_sp);
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits