[Lldb-commits] [lldb] r132499 - in /lldb/trunk/source/Plugins/Process/gdb-remote: ProcessGDBRemote.cpp ProcessGDBRemote.h

Greg Clayton gclayton at apple.com
Thu Jun 2 15:22:38 PDT 2011


Author: gclayton
Date: Thu Jun  2 17:22:38 2011
New Revision: 132499

URL: http://llvm.org/viewvc/llvm-project?rev=132499&view=rev
Log:
Make sure we don't lose our stop reply packet in the case where the other
GDB server doesn't support the LLDB specific qThreadStopInfo packet.


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

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=132499&r1=132498&r2=132499&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Thu Jun  2 17:22:38 2011
@@ -391,10 +391,9 @@
         // We have a valid process
         SetID (pid);
         UpdateThreadListIfNeeded ();
-        StringExtractorGDBRemote response;
-        if (m_gdb_comm.SendPacketAndWaitForResponse("?", 1, response, false))
+        if (m_gdb_comm.SendPacketAndWaitForResponse("?", 1, m_last_stop_packet, false))
         {
-            const StateType state = SetThreadStopInfo (response);
+            const StateType state = SetThreadStopInfo (m_last_stop_packet);
             if (state == eStateStopped)
             {
                 SetPrivateState (state);
@@ -550,10 +549,9 @@
                 return error;
             }
 
-            StringExtractorGDBRemote response;
-            if (m_gdb_comm.SendPacketAndWaitForResponse("?", 1, response, false))
+            if (m_gdb_comm.SendPacketAndWaitForResponse("?", 1, m_last_stop_packet, false))
             {
-                SetPrivateState (SetThreadStopInfo (response));
+                SetPrivateState (SetThreadStopInfo (m_last_stop_packet));
                 
                 if (!disable_stdio)
                 {
@@ -1097,6 +1095,7 @@
 StateType
 ProcessGDBRemote::SetThreadStopInfo (StringExtractor& stop_packet)
 {
+    stop_packet.SetFilePos (0);
     const char stop_type = stop_packet.GetChar();
     switch (stop_type)
     {
@@ -1245,22 +1244,10 @@
 void
 ProcessGDBRemote::RefreshStateAfterStop ()
 {
-    // FIXME - add a variable to tell that we're in the middle of attaching if we
-    // need to know that.
-    // We must be attaching if we don't already have a valid architecture
-//    if (!GetTarget().GetArchitecture().IsValid())
-//    {
-//        Module *exe_module = GetTarget().GetExecutableModule().get();
-//        if (exe_module)
-//            m_arch_spec = exe_module->GetArchitecture();
-//    }
-    
     // Let all threads recover from stopping and do any clean up based
     // on the previous thread state (if any).
     m_thread_list.RefreshStateAfterStop();
-
-    // Discover new threads:
-    UpdateThreadListIfNeeded ();
+    SetThreadStopInfo (m_last_stop_packet);
 }
 
 Error
@@ -2342,13 +2329,11 @@
                                     case eStateCrashed:
                                     case eStateSuspended:
                                         process->m_last_stop_packet = response;
-                                        process->m_last_stop_packet.SetFilePos (0);
                                         process->SetPrivateState (stop_state);
                                         break;
 
                                     case eStateExited:
                                         process->m_last_stop_packet = response;
-                                        process->m_last_stop_packet.SetFilePos (0);
                                         response.SetFilePos(1);
                                         process->SetExitStatus(response.GetHexU8(), NULL);
                                         done = true;

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h?rev=132499&r1=132498&r2=132499&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h Thu Jun  2 17:22:38 2011
@@ -297,7 +297,7 @@
     GDBRemoteCommunicationClient m_gdb_comm;
     lldb::pid_t m_debugserver_pid;
     lldb::thread_t m_debugserver_thread;
-    StringExtractor m_last_stop_packet;
+    StringExtractorGDBRemote m_last_stop_packet;
     GDBRemoteDynamicRegisterInfo m_register_info;
     lldb_private::Broadcaster m_async_broadcaster;
     lldb::thread_t m_async_thread;





More information about the lldb-commits mailing list