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
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
index 1332541..23568cd 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
@@ -114,12 +114,21 @@
     CalculcateChecksum (const char *payload,
                         size_t payload_length);
 
+    bool
+    GetSequenceMutex(std::unique_lock<std::recursive_mutex> &lock, const char *failure_message = nullptr);
+
     PacketType
     CheckForPacket (const uint8_t *src, 
                     size_t src_len, 
                     StringExtractorGDBRemote &packet);
 
     bool
+    IsRunning() const
+    {
+        return m_public_is_running.GetValue();
+    }
+
+    bool
     GetSendAcks ()
     {
         return m_send_acks;
@@ -276,6 +285,13 @@
     uint32_t m_packet_timeout;
     uint32_t m_echo_number;
     LazyBool m_supports_qEcho;
+#ifdef ENABLE_MUTEX_ERROR_CHECKING
+#error TrackingMutex is no longer supported
+#else
+    std::recursive_mutex m_sequence_mutex; // Restrict access to sending/receiving packets to a single thread at a time
+#endif
+    Predicate<bool> m_public_is_running;
+    Predicate<bool> m_private_is_running;
     History m_history;
     bool m_send_acks;
     bool m_is_platform; // Set to true if this class represents a platform,
@@ -285,6 +301,10 @@
     CompressionType m_compression_type;
 
     PacketResult
+    SendPacket (const char *payload,
+                size_t payload_length);
+
+    PacketResult
     SendPacketNoLock (const char *payload, 
                       size_t payload_length);
 
@@ -301,6 +321,9 @@
                                                 bool sync_on_timeout);
 
     bool
+    WaitForNotRunningPrivate(const std::chrono::microseconds &timeout);
+
+    bool
     CompressionIsEnabled ()
     {
         return m_compression_type != CompressionType::None;