summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-03-14 17:19:34 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2019-03-14 17:19:34 +0000
commitfa3f6401daec574a647a5a119912fb7ec86a43d5 (patch)
tree13bae43bd1477fa8a7daf33d2e1b881af4d9fe4d /lldb/source/Plugins/Process/gdb-remote
parent702411fc298032a2e700907cc3d6136d5b46afe7 (diff)
downloadbcm5719-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.cpp2
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);
OpenPOWER on IntegriCloud