aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2016-07-29 15:41:52 +0000
committerPavel Labath <labath@google.com>2016-07-29 15:41:52 +0000
commit4cb699260c25d44d84029e2a3a8f37e97b44820f (patch)
tree62bb22e59b1dec16b30902532b234728749f7103 /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
parent0702c4e86eb61dc2db22bb51525fb2edb008af4d (diff)
downloadllvm-4cb699260c25d44d84029e2a3a8f37e97b44820f.zip
llvm-4cb699260c25d44d84029e2a3a8f37e97b44820f.tar.gz
llvm-4cb699260c25d44d84029e2a3a8f37e97b44820f.tar.bz2
Revert "Rewrite gdb-remote's SendContinuePacketAndWaitForResponse"
This reverts commit r277139, because: - broken unittest on windows (likely typo on my part) - seems to break TestCallThatRestart (needs investigation) llvm-svn: 277154
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index ac3a6df..9d6b976f 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -161,6 +161,9 @@ GDBRemoteCommunication::GDBRemoteCommunication(const char *comm_name, const char
#endif
m_echo_number(0),
m_supports_qEcho(eLazyBoolCalculate),
+ m_sequence_mutex(),
+ m_public_is_running(false),
+ m_private_is_running(false),
m_history(512),
m_send_acks(true),
m_compression_type(CompressionType::None),
@@ -223,6 +226,13 @@ GDBRemoteCommunication::SendNack ()
}
GDBRemoteCommunication::PacketResult
+GDBRemoteCommunication::SendPacket (const char *payload, size_t payload_length)
+{
+ std::lock_guard<std::recursive_mutex> guard(m_sequence_mutex);
+ return SendPacketNoLock (payload, payload_length);
+}
+
+GDBRemoteCommunication::PacketResult
GDBRemoteCommunication::SendPacketNoLock (const char *payload, size_t payload_length)
{
if (IsConnected())
@@ -311,6 +321,22 @@ GDBRemoteCommunication::GetAck ()
return result;
}
+bool
+GDBRemoteCommunication::GetSequenceMutex(std::unique_lock<std::recursive_mutex> &lock, const char *failure_message)
+{
+ if (IsRunning())
+ return (lock = std::unique_lock<std::recursive_mutex>(m_sequence_mutex, std::try_to_lock)).owns_lock();
+
+ lock = std::unique_lock<std::recursive_mutex>(m_sequence_mutex);
+ return true;
+}
+
+bool
+GDBRemoteCommunication::WaitForNotRunningPrivate(const std::chrono::microseconds &timeout)
+{
+ return m_private_is_running.WaitForValueEqualTo(false, timeout, NULL);
+}
+
GDBRemoteCommunication::PacketResult
GDBRemoteCommunication::ReadPacket (StringExtractorGDBRemote &response, uint32_t timeout_usec, bool sync_on_timeout)
{