[Lldb-commits] [lldb] r115992 - /lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp

Greg Clayton gclayton at apple.com
Thu Oct 7 15:06:19 PDT 2010


Author: gclayton
Date: Thu Oct  7 17:06:19 2010
New Revision: 115992

URL: http://llvm.org/viewvc/llvm-project?rev=115992&view=rev
Log:
Make sure to lock down the sequence mutex and select the thread we want when read or write all registers.

Modified:
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp?rev=115992&r1=115991&r2=115992&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp Thu Oct  7 17:06:19 2010
@@ -373,15 +373,23 @@
 {
     GDBRemoteCommunication &gdb_comm = GetGDBProcess().GetGDBRemote();
     StringExtractorGDBRemote response;
-    if (gdb_comm.SendPacketAndWaitForResponse("g", response, 1, false))
+    
+    Mutex::Locker locker;
+    if (gdb_comm.GetSequenceMutex (locker))
     {
-        if (response.IsErrorPacket())
-            return false;
-            
-        response.GetStringRef().insert(0, 1, 'G');
-        data_sp.reset (new DataBufferHeap(response.GetStringRef().c_str(), 
-                                          response.GetStringRef().size()));
-        return true;
+        if (GetGDBProcess().SetCurrentGDBRemoteThread(m_thread.GetID()))
+        {
+            if (gdb_comm.SendPacketAndWaitForResponse("g", response, 1, false))
+            {
+                if (response.IsErrorPacket())
+                    return false;
+                    
+                response.GetStringRef().insert(0, 1, 'G');
+                data_sp.reset (new DataBufferHeap(response.GetStringRef().c_str(), 
+                                                  response.GetStringRef().size()));
+                return true;
+            }
+        }
     }
     return false;
 }
@@ -391,14 +399,21 @@
 {
     GDBRemoteCommunication &gdb_comm = GetGDBProcess().GetGDBRemote();
     StringExtractorGDBRemote response;
-    if (gdb_comm.SendPacketAndWaitForResponse((const char *)data_sp->GetBytes(), 
-                                              data_sp->GetByteSize(), 
-                                              response, 
-                                              1, 
-                                              false))
+    Mutex::Locker locker;
+    if (gdb_comm.GetSequenceMutex (locker))
     {
-        if (response.IsOKPacket())
-            return true;
+        if (GetGDBProcess().SetCurrentGDBRemoteThread(m_thread.GetID()))
+        {
+            if (gdb_comm.SendPacketAndWaitForResponse((const char *)data_sp->GetBytes(), 
+                                                      data_sp->GetByteSize(), 
+                                                      response, 
+                                                      1, 
+                                                      false))
+            {
+                if (response.IsOKPacket())
+                    return true;
+            }
+        }
     }
     return false;
 }





More information about the lldb-commits mailing list