Author: tfiala
Date: Tue May 13 19:15:32 2014
New Revision: 208741

URL: http://llvm.org/viewvc/llvm-project?rev=208741&view=rev
Log:
lldb: gdb remote support always falls back to $qC when no $qProcessInfo.

See thread here:
http://lists.cs.uiuc.edu/pipermail/lldb-dev/2014-May/003992.html

This is meant to address case 3 that I recently broke with an earlier
change to rectify usage of the $qC message for thread ids, specifically:

3. TOT lldb <=> gdbserver (without $qProcessInfo support and not Apple/iOS).


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

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=208741&r1=208740&r2=208741&view=diff
==============================================================================
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
Tue May 13 19:15:32 2014
@@ -1193,25 +1193,22 @@ GDBRemoteCommunicationClient::GetCurrent
     }
     else
     {
-        // For Apple iOS targets, go back and ask the qC packet for its 
result.  In earlier iterations of debugserver, $qC returned
-        // the process id of the current process.
-        const llvm::Triple &triple = GetProcessArchitecture().GetTriple();
-        if ((triple.getVendor() == llvm::Triple::Apple) &&
-            (triple.getOS() == llvm::Triple::IOS))
+        // If we don't get a response for qProcessInfo, check if $qC gives us 
a result.
+        // $qC only returns a real process id on older debugserver and 
lldb-platform stubs.
+        // The gdb remote protocol documents $qC as returning the thread id, 
which newer
+        // debugserver and lldb-gdbserver stubs return correctly.
+        StringExtractorGDBRemote response;
+        if (SendPacketAndWaitForResponse("qC", strlen("qC"), response, false) 
== PacketResult::Success)
         {
-            StringExtractorGDBRemote response;
-            if (SendPacketAndWaitForResponse("qC", strlen("qC"), response, 
false) == PacketResult::Success)
+            if (response.GetChar() == 'Q')
             {
-                if (response.GetChar() == 'Q')
+                if (response.GetChar() == 'C')
                 {
-                    if (response.GetChar() == 'C')
+                    m_curr_pid = response.GetHexMaxU32 (false, 
LLDB_INVALID_PROCESS_ID);
+                    if (m_curr_pid != LLDB_INVALID_PROCESS_ID)
                     {
-                        m_curr_pid = response.GetHexMaxU32 (false, 
LLDB_INVALID_PROCESS_ID);
-                        if (m_curr_pid != LLDB_INVALID_PROCESS_ID)
-                        {
-                            m_curr_pid_is_valid = eLazyBoolYes;
-                            return m_curr_pid;
-                        }
+                        m_curr_pid_is_valid = eLazyBoolYes;
+                        return m_curr_pid;
                     }
                 }
             }


_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to