diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-03-14 17:19:34 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-03-14 17:19:34 +0000 |
commit | fa3f6401daec574a647a5a119912fb7ec86a43d5 (patch) | |
tree | 13bae43bd1477fa8a7daf33d2e1b881af4d9fe4d /lldb/source/Plugins/Process/gdb-remote | |
parent | 702411fc298032a2e700907cc3d6136d5b46afe7 (diff) | |
download | bcm5719-llvm-fa3f6401daec574a647a5a119912fb7ec86a43d5.tar.gz bcm5719-llvm-fa3f6401daec574a647a5a119912fb7ec86a43d5.zip |
[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.
llvm-svn: 356168
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp index 50a53b43ed8..26784ec035c 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp @@ -55,6 +55,8 @@ GDBRemoteCommunicationReplayServer::~GDBRemoteCommunicationReplayServer() { 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); |