Author: jdevlieghere
Date: Thu Mar 14 10:19:34 2019
New Revision: 356168

URL: http://llvm.org/viewvc/llvm-project?rev=356168&view=rev
Log:
[Reproducers] Fix data race found by tsan

This fixes a data race uncovered by tsan during destruction of the
GDBRemoteReplay server. The solution is to lock the thread state mutex
when receiving packets.

Modified:
    
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp?rev=356168&r1=356167&r2=356168&view=diff
==============================================================================
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp
 Thu Mar 14 10:19:34 2019
@@ -55,6 +55,8 @@ GDBRemoteCommunicationReplayServer::~GDB
 GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationReplayServer::GetPacketAndSendResponse(
     Timeout<std::micro> timeout, Status &error, bool &interrupt, bool &quit) {
+  std::lock_guard<std::recursive_mutex> guard(m_async_thread_state_mutex);
+
   StringExtractorGDBRemote packet;
   PacketResult packet_result = WaitForPacketNoLock(packet, timeout, false);
 


_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to