Move QSyncThreadState packet generation to the gdb-remote client

llvm-svn: 279057
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index 7600c13..fc0cf6e 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -3582,9 +3582,22 @@
 }
 
 bool
-GDBRemoteCommunicationClient::GetModuleInfo (const FileSpec& module_file_spec,
-                                             const lldb_private::ArchSpec& arch_spec,
-                                             ModuleSpec &module_spec)
+GDBRemoteCommunicationClient::SyncThreadState(lldb::tid_t tid)
+{
+    if (!GetSyncThreadStateSupported())
+        return false;
+
+    StreamString packet;
+    StringExtractorGDBRemote response;
+    packet.Printf("QSyncThreadState:%4.4" PRIx64 ";", tid);
+    return SendPacketAndWaitForResponse(packet.GetString(), response, false) ==
+               GDBRemoteCommunication::PacketResult::Success &&
+           response.IsOKResponse();
+}
+
+bool
+GDBRemoteCommunicationClient::GetModuleInfo(const FileSpec &module_file_spec, const lldb_private::ArchSpec &arch_spec,
+                                            ModuleSpec &module_spec)
 {
     if (!m_supports_qModuleInfo)
         return false;
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
index 7b6e5e6..b041ecb 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
@@ -509,6 +509,9 @@
     bool
     RestoreRegisterState (lldb::tid_t tid, uint32_t save_id);
 
+    bool
+    SyncThreadState(lldb::tid_t tid);
+
     const char *
     GetGDBServerProgramName();
     
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
index dbdb3a8..dd8ac9e 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
@@ -334,28 +334,6 @@
                         reg_info->byte_size));
 }
 
-void
-GDBRemoteRegisterContext::SyncThreadState(Process *process)
-{
-    // NB.  We assume our caller has locked the sequence mutex.
-    
-    GDBRemoteCommunicationClient &gdb_comm (((ProcessGDBRemote *) process)->GetGDBRemote());
-    if (!gdb_comm.GetSyncThreadStateSupported())
-        return;
-
-    StreamString packet;
-    StringExtractorGDBRemote response;
-    packet.Printf ("QSyncThreadState:%4.4" PRIx64 ";", m_thread.GetProtocolID());
-    if (gdb_comm.SendPacketAndWaitForResponse(packet.GetString().c_str(),
-                                              packet.GetString().size(),
-                                              response,
-                                              false) == GDBRemoteCommunication::PacketResult::Success)
-    {
-        if (response.IsOKResponse())
-            InvalidateAllRegisters();
-    }
-}
-
 bool
 GDBRemoteRegisterContext::WriteRegisterBytes (const RegisterInfo *reg_info, DataExtractor &data, uint32_t data_offset)
 {
@@ -562,7 +540,8 @@
     GDBRemoteClientBase::Lock lock(gdb_comm, false);
     if (lock)
     {
-        SyncThreadState(process);
+        if (gdb_comm.SyncThreadState(m_thread.GetProtocolID()))
+            InvalidateAllRegisters();
 
         if (use_g_packet && gdb_comm.ReadAllRegisters(m_thread.GetProtocolID(), response))
         {
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h
index 0e26c69..0021b5e 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h
@@ -143,9 +143,6 @@
             m_reg_valid[reg] = valid;
     }
 
-    void
-    SyncThreadState(Process *process);  // Assumes the sequence mutex has already been acquired.
-    
     GDBRemoteDynamicRegisterInfo &m_reg_info;
     std::vector<bool> m_reg_valid;
     DataExtractor m_reg_data;