[Lldb-commits] [lldb] r196610 - Fixed the GDBRemoteCommuncation to return a new GDBRemoteCommuncation::PacketResult enum for all packet sends/receives.

Greg Clayton gclayton at apple.com
Fri Dec 6 13:45:27 PST 2013


Author: gclayton
Date: Fri Dec  6 15:45:27 2013
New Revision: 196610

URL: http://llvm.org/viewvc/llvm-project?rev=196610&view=rev
Log:
Fixed the GDBRemoteCommuncation to return a new GDBRemoteCommuncation::PacketResult enum for all packet sends/receives.

<rdar://problem/15600045>

Due to other recent changes, all connections to GDB servers that didn't support the "QStartNoAckMode" packet would cause us to fail to attach to the remote GDB server.

The problem was that SendPacket* and WaitForResponse* packets would return a size_t indicating the number of bytes sent/received. The other issue was WaitForResponse* packets would strip the leading '$' and the trailing "#CC" (checksum) bytes, so the unimplemented response packet of "$#00" would get stripped and the WaitForResponse* packets would return 0.

These new error codes give us flexibility to to more intelligent things in response to what is returned. 


Modified:
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=196610&r1=196609&r2=196610&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Fri Dec  6 15:45:27 2013
@@ -199,14 +199,14 @@ GDBRemoteCommunication::SendNack ()
     return bytes_written;
 }
 
-size_t
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunication::SendPacket (const char *payload, size_t payload_length)
 {
     Mutex::Locker locker(m_sequence_mutex);
     return SendPacketNoLock (payload, payload_length);
 }
 
-size_t
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunication::SendPacketNoLock (const char *payload, size_t payload_length)
 {
     if (IsConnected())
@@ -239,32 +239,32 @@ GDBRemoteCommunication::SendPacketNoLock
         if (bytes_written == packet.GetSize())
         {
             if (GetSendAcks ())
-            {
-                if (GetAck () != '+')
-                {
-                    if (log)
-                        log->Printf("get ack failed...");
-                    return 0;
-                }
-            }
+                return GetAck ();
+            else
+                return PacketResult::Success;
         }
         else
         {
             if (log)
                 log->Printf ("error: failed to send packet: %.*s", (int)packet.GetSize(), packet.GetData());
         }
-        return bytes_written;
     }
-    return 0;
+    return PacketResult::ErrorSendFailed;
 }
 
-char
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunication::GetAck ()
 {
     StringExtractorGDBRemote packet;
-    if (WaitForPacketWithTimeoutMicroSecondsNoLock (packet, GetPacketTimeoutInMicroSeconds ()) == 1)
-        return packet.GetChar();
-    return 0;
+    PacketResult result = WaitForPacketWithTimeoutMicroSecondsNoLock (packet, GetPacketTimeoutInMicroSeconds ());
+    if (result == PacketResult::Success)
+    {
+        if (packet.GetResponseType() == StringExtractorGDBRemote::ResponseType::eAck)
+            return PacketResult::Success;
+        else
+            return PacketResult::ErrorSendAck;
+    }
+    return result;
 }
 
 bool
@@ -284,7 +284,7 @@ GDBRemoteCommunication::WaitForNotRunnin
     return m_private_is_running.WaitForValueEqualTo (false, timeout_ptr, NULL);
 }
 
-size_t
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunication::WaitForPacketWithTimeoutMicroSecondsNoLock (StringExtractorGDBRemote &packet, uint32_t timeout_usec)
 {
     uint8_t buffer[8192];
@@ -294,9 +294,10 @@ GDBRemoteCommunication::WaitForPacketWit
 
     // Check for a packet from our cache first without trying any reading...
     if (CheckForPacket (NULL, 0, packet))
-        return packet.GetStringRef().size();
+        return PacketResult::Success;
 
     bool timed_out = false;
+    bool disconnected = false;
     while (IsConnected() && !timed_out)
     {
         lldb::ConnectionStatus status = eConnectionStatusNoConnection;
@@ -313,7 +314,7 @@ GDBRemoteCommunication::WaitForPacketWit
         if (bytes_read > 0)
         {
             if (CheckForPacket (buffer, bytes_read, packet))
-                return packet.GetStringRef().size();
+                return PacketResult::Success;
         }
         else
         {
@@ -330,13 +331,19 @@ GDBRemoteCommunication::WaitForPacketWit
             case eConnectionStatusNoConnection:
             case eConnectionStatusLostConnection:
             case eConnectionStatusError:
+                disconnected = true;
                 Disconnect();
                 break;
             }
         }
     }
-    packet.Clear ();    
-    return 0;
+    packet.Clear ();
+    if (disconnected)
+        return PacketResult::ErrorDisconnected;
+    if (timed_out)
+        return PacketResult::ErrorReplyTimeout;
+    else
+        return PacketResult::ErrorReplyFailed;
 }
 
 bool

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h?rev=196610&r1=196609&r2=196610&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h Fri Dec  6 15:45:27 2013
@@ -35,6 +35,18 @@ public:
     {
         eBroadcastBitRunPacketSent = kLoUserBroadcastBit
     };
+    
+    enum class PacketResult
+    {
+        Success = 0,        // Success
+        ErrorSendFailed,    // Error sending the packet
+        ErrorSendAck,       // Didn't get an ack back after sending a packet
+        ErrorReplyFailed,   // Error getting the reply
+        ErrorReplyTimeout,  // Timed out waiting for reply
+        ErrorReplyInvalid,  // Got a reply but it wasn't valid for the packet that was sent
+        ErrorReplyAck,      // Sending reply ack failed
+        ErrorDisconnected   // We were disconnected
+    };
     //------------------------------------------------------------------
     // Constructors and Destructors
     //------------------------------------------------------------------
@@ -45,7 +57,7 @@ public:
     virtual
     ~GDBRemoteCommunication();
 
-    char
+    PacketResult
     GetAck ();
 
     size_t
@@ -223,15 +235,15 @@ protected:
         mutable bool m_dumped_to_log;
     };
 
-    size_t
+    PacketResult
     SendPacket (const char *payload,
                 size_t payload_length);
 
-    size_t
+    PacketResult
     SendPacketNoLock (const char *payload, 
                       size_t payload_length);
 
-    size_t
+    PacketResult
     WaitForPacketWithTimeoutMicroSecondsNoLock (StringExtractorGDBRemote &response, 
                                                 uint32_t timeout_usec);
 

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=196610&r1=196609&r2=196610&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Fri Dec  6 15:45:27 2013
@@ -148,7 +148,7 @@ GDBRemoteCommunicationClient::QueryNoAck
         m_supports_not_sending_acks = eLazyBoolNo;
 
         StringExtractorGDBRemote response;
-        if (SendPacketAndWaitForResponse("QStartNoAckMode", response, false))
+        if (SendPacketAndWaitForResponse("QStartNoAckMode", response, false) == PacketResult::Success)
         {
             if (response.IsOKResponse())
             {
@@ -169,7 +169,7 @@ GDBRemoteCommunicationClient::GetListThr
         m_supports_threads_in_stop_reply = eLazyBoolNo;
         
         StringExtractorGDBRemote response;
-        if (SendPacketAndWaitForResponse("QListThreadsInStopReply", response, false))
+        if (SendPacketAndWaitForResponse("QListThreadsInStopReply", response, false) == PacketResult::Success)
         {
             if (response.IsOKResponse())
                 m_supports_threads_in_stop_reply = eLazyBoolYes;
@@ -185,7 +185,7 @@ GDBRemoteCommunicationClient::GetVAttach
         m_attach_or_wait_reply = eLazyBoolNo;
         
         StringExtractorGDBRemote response;
-        if (SendPacketAndWaitForResponse("qVAttachOrWaitSupported", response, false))
+        if (SendPacketAndWaitForResponse("qVAttachOrWaitSupported", response, false) == PacketResult::Success)
         {
             if (response.IsOKResponse())
                 m_attach_or_wait_reply = eLazyBoolYes;
@@ -205,7 +205,7 @@ GDBRemoteCommunicationClient::GetSyncThr
         m_prepare_for_reg_writing_reply = eLazyBoolNo;
         
         StringExtractorGDBRemote response;
-        if (SendPacketAndWaitForResponse("qSyncThreadStateSupported", response, false))
+        if (SendPacketAndWaitForResponse("qSyncThreadStateSupported", response, false) == PacketResult::Success)
         {
             if (response.IsOKResponse())
                 m_prepare_for_reg_writing_reply = eLazyBoolYes;
@@ -261,7 +261,7 @@ GDBRemoteCommunicationClient::GetThreadS
     {
         StringExtractorGDBRemote response;
         m_supports_thread_suffix = eLazyBoolNo;
-        if (SendPacketAndWaitForResponse("QThreadSuffixSupported", response, false))
+        if (SendPacketAndWaitForResponse("QThreadSuffixSupported", response, false) == PacketResult::Success)
         {
             if (response.IsOKResponse())
                 m_supports_thread_suffix = eLazyBoolYes;
@@ -281,7 +281,7 @@ GDBRemoteCommunicationClient::GetVContSu
         m_supports_vCont_C = eLazyBoolNo;
         m_supports_vCont_s = eLazyBoolNo;
         m_supports_vCont_S = eLazyBoolNo;
-        if (SendPacketAndWaitForResponse("vCont?", response, false))
+        if (SendPacketAndWaitForResponse("vCont?", response, false) == PacketResult::Success)
         {
             const char *response_cstr = response.GetStringRef().c_str();
             if (::strstr (response_cstr, ";c"))
@@ -345,7 +345,7 @@ GDBRemoteCommunicationClient::GetpPacket
         else
             snprintf(packet, sizeof(packet), "p0");
         
-        if (SendPacketAndWaitForResponse(packet, response, false))
+        if (SendPacketAndWaitForResponse(packet, response, false) == PacketResult::Success)
         {
             if (response.IsNormalResponse())
                 m_supports_p = eLazyBoolYes;
@@ -354,7 +354,7 @@ GDBRemoteCommunicationClient::GetpPacket
     return m_supports_p;
 }
 
-size_t
+GDBRemoteCommunicationClient::PacketResult
 GDBRemoteCommunicationClient::SendPacketAndWaitForResponse
 (
     const char *payload,
@@ -368,7 +368,18 @@ GDBRemoteCommunicationClient::SendPacket
                                          send_async);
 }
 
-size_t
+GDBRemoteCommunicationClient::PacketResult
+GDBRemoteCommunicationClient::SendPacketAndWaitForResponseNoLock (const char *payload,
+                                                                  size_t payload_length,
+                                                                  StringExtractorGDBRemote &response)
+{
+    PacketResult packet_result = SendPacketNoLock (payload, payload_length);
+    if (packet_result == PacketResult::Success)
+        packet_result = WaitForPacketWithTimeoutMicroSecondsNoLock (response, GetPacketTimeoutInMicroSeconds ());
+    return packet_result;
+}
+
+GDBRemoteCommunicationClient::PacketResult
 GDBRemoteCommunicationClient::SendPacketAndWaitForResponse
 (
     const char *payload,
@@ -377,18 +388,13 @@ GDBRemoteCommunicationClient::SendPacket
     bool send_async
 )
 {
+    PacketResult packet_result = PacketResult::ErrorSendFailed;
     Mutex::Locker locker;
     Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS));
     size_t response_len = 0;
     if (GetSequenceMutex (locker))
     {
-        if (SendPacketNoLock (payload, payload_length))
-           response_len = WaitForPacketWithTimeoutMicroSecondsNoLock (response, GetPacketTimeoutInMicroSeconds ());
-        else 
-        {
-            if (log)
-                log->Printf("error: failed to send '%*s'", (int) payload_length, payload);   
-        }
+        packet_result = SendPacketAndWaitForResponseNoLock (payload, payload_length, response);
     }
     else
     {
@@ -456,13 +462,7 @@ GDBRemoteCommunicationClient::SendPacket
                         if (log) 
                             log->Printf ("async: got lock without sending interrupt");
                         // Send the packet normally since we got the lock
-                        if (SendPacketNoLock (payload, payload_length))
-                            response_len = WaitForPacketWithTimeoutMicroSecondsNoLock (response, GetPacketTimeoutInMicroSeconds ());
-                        else 
-                        {
-                            if (log)
-                                log->Printf("error: failed to send '%*s'", (int) payload_length, payload);   
-                        }
+                        packet_result = SendPacketAndWaitForResponseNoLock (payload, payload_length, response);
                     }
                 }
                 else
@@ -483,12 +483,7 @@ GDBRemoteCommunicationClient::SendPacket
                 log->Printf("error: failed to get packet sequence mutex, not sending packet '%*s'", (int) payload_length, payload);
         }
     }
-    if (response_len == 0)
-    {
-        if (log) 
-            log->Printf("error: failed to get response for '%*s'", (int) payload_length, payload);
-    }        
-    return response_len;
+    return packet_result;
 }
 
 static const char *end_delimiter = "--end--;";
@@ -615,7 +610,7 @@ GDBRemoteCommunicationClient::SendContin
         {
             if (log)
                 log->Printf ("GDBRemoteCommunicationClient::%s () sending continue packet: %s", __FUNCTION__, continue_packet.c_str());
-            if (SendPacketNoLock(continue_packet.c_str(), continue_packet.size()) == 0)
+            if (SendPacketNoLock(continue_packet.c_str(), continue_packet.size()) != PacketResult::Success)
                 state = eStateInvalid;
         
             m_private_is_running.SetValue (true, eBroadcastAlways);
@@ -626,7 +621,7 @@ GDBRemoteCommunicationClient::SendContin
         if (log)
             log->Printf ("GDBRemoteCommunicationClient::%s () WaitForPacket(%s)", __FUNCTION__, continue_packet.c_str());
 
-        if (WaitForPacketWithTimeoutMicroSecondsNoLock(response, UINT32_MAX))
+        if (WaitForPacketWithTimeoutMicroSecondsNoLock(response, UINT32_MAX) == PacketResult::Success)
         {
             if (response.Empty())
                 state = eStateInvalid;
@@ -683,7 +678,7 @@ GDBRemoteCommunicationClient::SendContin
                                 // packet to make sure it doesn't get in the way
                                 StringExtractorGDBRemote extra_stop_reply_packet;
                                 uint32_t timeout_usec = 1000;
-                                if (WaitForPacketWithTimeoutMicroSecondsNoLock (extra_stop_reply_packet, timeout_usec))
+                                if (WaitForPacketWithTimeoutMicroSecondsNoLock (extra_stop_reply_packet, timeout_usec) == PacketResult::Success)
                                 {
                                     switch (extra_stop_reply_packet.GetChar())
                                     {
@@ -973,7 +968,7 @@ lldb::pid_t
 GDBRemoteCommunicationClient::GetCurrentProcessID ()
 {
     StringExtractorGDBRemote response;
-    if (SendPacketAndWaitForResponse("qC", strlen("qC"), response, false))
+    if (SendPacketAndWaitForResponse("qC", strlen("qC"), response, false) == PacketResult::Success)
     {
         if (response.GetChar() == 'Q')
             if (response.GetChar() == 'C')
@@ -987,7 +982,7 @@ GDBRemoteCommunicationClient::GetLaunchS
 {
     error_str.clear();
     StringExtractorGDBRemote response;
-    if (SendPacketAndWaitForResponse("qLaunchSuccess", strlen("qLaunchSuccess"), response, false))
+    if (SendPacketAndWaitForResponse("qLaunchSuccess", strlen("qLaunchSuccess"), response, false) == PacketResult::Success)
     {
         if (response.IsOKResponse())
             return true;
@@ -1050,7 +1045,7 @@ GDBRemoteCommunicationClient::SendArgume
         }
 
         StringExtractorGDBRemote response;
-        if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false))
+        if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false) == PacketResult::Success)
         {
             if (response.IsOKResponse())
                 return 0;
@@ -1097,7 +1092,7 @@ GDBRemoteCommunicationClient::SendEnviro
             {
                 packet.PutCString("QEnvironmentHexEncoded:");
                 packet.PutBytesAsRawHex8 (name_equal_value, strlen(name_equal_value));
-                if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false))
+                if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false) == PacketResult::Success)
                 {
                     if (response.IsOKResponse())
                         return 0;
@@ -1113,7 +1108,7 @@ GDBRemoteCommunicationClient::SendEnviro
         else if (m_supports_QEnvironment)
         {
             packet.Printf("QEnvironment:%s", name_equal_value);
-            if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false))
+            if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false) == PacketResult::Success)
             {
                 if (response.IsOKResponse())
                     return 0;
@@ -1136,7 +1131,7 @@ GDBRemoteCommunicationClient::SendLaunch
         StreamString packet;
         packet.Printf("QLaunchArch:%s", arch);
         StringExtractorGDBRemote response;
-        if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false))
+        if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false) == PacketResult::Success)
         {
             if (response.IsOKResponse())
                 return 0;
@@ -1236,7 +1231,7 @@ GDBRemoteCommunicationClient::GetHostInf
     {
         m_qHostInfo_is_valid = eLazyBoolNo;
         StringExtractorGDBRemote response;
-        if (SendPacketAndWaitForResponse ("qHostInfo", response, false))
+        if (SendPacketAndWaitForResponse ("qHostInfo", response, false) == PacketResult::Success)
         {
             if (response.IsNormalResponse())
             {
@@ -1474,7 +1469,7 @@ GDBRemoteCommunicationClient::SendAttach
         char packet[64];
         const int packet_len = ::snprintf (packet, sizeof(packet), "vAttach;%" PRIx64, pid);
         assert (packet_len < (int)sizeof(packet));
-        if (SendPacketAndWaitForResponse (packet, packet_len, response, false))
+        if (SendPacketAndWaitForResponse (packet, packet_len, response, false) == PacketResult::Success)
         {
             if (response.IsErrorResponse())
                 return response.GetError();
@@ -1514,7 +1509,7 @@ GDBRemoteCommunicationClient::AllocateMe
                                            permissions & lldb::ePermissionsExecutable ? "x" : "");
         assert (packet_len < (int)sizeof(packet));
         StringExtractorGDBRemote response;
-        if (SendPacketAndWaitForResponse (packet, packet_len, response, false))
+        if (SendPacketAndWaitForResponse (packet, packet_len, response, false) == PacketResult::Success)
         {
             if (!response.IsErrorResponse())
                 return response.GetHexMaxU64(false, LLDB_INVALID_ADDRESS);
@@ -1537,7 +1532,7 @@ GDBRemoteCommunicationClient::Deallocate
         const int packet_len = ::snprintf(packet, sizeof(packet), "_m%" PRIx64, (uint64_t)addr);
         assert (packet_len < (int)sizeof(packet));
         StringExtractorGDBRemote response;
-        if (SendPacketAndWaitForResponse (packet, packet_len, response, false))
+        if (SendPacketAndWaitForResponse (packet, packet_len, response, false) == PacketResult::Success)
         {
             if (response.IsOKResponse())
                 return true;
@@ -1563,7 +1558,7 @@ GDBRemoteCommunicationClient::Detach (bo
             const int packet_len = ::snprintf(packet, sizeof(packet), "qSupportsDetachAndStayStopped:");
             assert (packet_len < (int)sizeof(packet));
             StringExtractorGDBRemote response;
-            if (SendPacketAndWaitForResponse (packet, packet_len, response, false))
+            if (SendPacketAndWaitForResponse (packet, packet_len, response, false) == PacketResult::Success)
             {
                 m_supports_detach_stay_stopped = eLazyBoolYes;        
             }
@@ -1580,15 +1575,15 @@ GDBRemoteCommunicationClient::Detach (bo
         }
         else
         {
-            size_t num_sent = SendPacket ("D1", 2);
-            if (num_sent == 0)
+            PacketResult packet_result = SendPacket ("D1", 2);
+            if (packet_result != PacketResult::Success)
                 error.SetErrorString ("Sending extended disconnect packet failed.");
         }
     }
     else
     {
-        size_t num_sent = SendPacket ("D", 1);
-        if (num_sent == 0)
+        PacketResult packet_result = SendPacket ("D", 1);
+        if (packet_result != PacketResult::Success)
             error.SetErrorString ("Sending disconnect packet failed.");
     }
     return error;
@@ -1608,7 +1603,7 @@ GDBRemoteCommunicationClient::GetMemoryR
         const int packet_len = ::snprintf(packet, sizeof(packet), "qMemoryRegionInfo:%" PRIx64, (uint64_t)addr);
         assert (packet_len < (int)sizeof(packet));
         StringExtractorGDBRemote response;
-        if (SendPacketAndWaitForResponse (packet, packet_len, response, false))
+        if (SendPacketAndWaitForResponse (packet, packet_len, response, false) == PacketResult::Success)
         {
             std::string name;
             std::string value;
@@ -1711,7 +1706,7 @@ GDBRemoteCommunicationClient::GetWatchpo
         const int packet_len = ::snprintf(packet, sizeof(packet), "qWatchpointSupportInfo:");
         assert (packet_len < (int)sizeof(packet));
         StringExtractorGDBRemote response;
-        if (SendPacketAndWaitForResponse (packet, packet_len, response, false))
+        if (SendPacketAndWaitForResponse (packet, packet_len, response, false) == PacketResult::Success)
         {
             m_supports_watchpoint_support_info = eLazyBoolYes;        
             std::string name;
@@ -1773,7 +1768,7 @@ GDBRemoteCommunicationClient::SetSTDIN (
         packet.PutBytesAsRawHex8(path, strlen(path));
 
         StringExtractorGDBRemote response;
-        if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false))
+        if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false) == PacketResult::Success)
         {
             if (response.IsOKResponse())
                 return 0;
@@ -1795,7 +1790,7 @@ GDBRemoteCommunicationClient::SetSTDOUT
         packet.PutBytesAsRawHex8(path, strlen(path));
         
         StringExtractorGDBRemote response;
-        if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false))
+        if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false) == PacketResult::Success)
         {
             if (response.IsOKResponse())
                 return 0;
@@ -1817,7 +1812,7 @@ GDBRemoteCommunicationClient::SetSTDERR
         packet.PutBytesAsRawHex8(path, strlen(path));
         
         StringExtractorGDBRemote response;
-        if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false))
+        if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false) == PacketResult::Success)
         {
             if (response.IsOKResponse())
                 return 0;
@@ -1833,7 +1828,7 @@ bool
 GDBRemoteCommunicationClient::GetWorkingDir (std::string &cwd)
 {
     StringExtractorGDBRemote response;
-    if (SendPacketAndWaitForResponse ("qGetWorkingDir", response, false))
+    if (SendPacketAndWaitForResponse ("qGetWorkingDir", response, false) == PacketResult::Success)
     {
         if (response.IsUnsupportedResponse())
             return false;
@@ -1855,7 +1850,7 @@ GDBRemoteCommunicationClient::SetWorking
         packet.PutBytesAsRawHex8(path, strlen(path));
         
         StringExtractorGDBRemote response;
-        if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false))
+        if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false) == PacketResult::Success)
         {
             if (response.IsOKResponse())
                 return 0;
@@ -1874,7 +1869,7 @@ GDBRemoteCommunicationClient::SetDisable
     const int packet_len = ::snprintf (packet, sizeof (packet), "QSetDisableASLR:%i", enable ? 1 : 0);
     assert (packet_len < (int)sizeof(packet));
     StringExtractorGDBRemote response;
-    if (SendPacketAndWaitForResponse (packet, packet_len, response, false))
+    if (SendPacketAndWaitForResponse (packet, packet_len, response, false) == PacketResult::Success)
     {
         if (response.IsOKResponse())
             return 0;
@@ -1957,7 +1952,7 @@ GDBRemoteCommunicationClient::GetProcess
         const int packet_len = ::snprintf (packet, sizeof (packet), "qProcessInfoPID:%" PRIu64, pid);
         assert (packet_len < (int)sizeof(packet));
         StringExtractorGDBRemote response;
-        if (SendPacketAndWaitForResponse (packet, packet_len, response, false))
+        if (SendPacketAndWaitForResponse (packet, packet_len, response, false) == PacketResult::Success)
         {
             return DecodeProcessInfoResponse (response, process_info);
         }
@@ -1981,7 +1976,7 @@ GDBRemoteCommunicationClient::GetCurrent
     GetHostInfo ();
 
     StringExtractorGDBRemote response;
-    if (SendPacketAndWaitForResponse ("qProcessInfo", response, false))
+    if (SendPacketAndWaitForResponse ("qProcessInfo", response, false) == PacketResult::Success)
     {
         if (response.IsNormalResponse())
         {
@@ -2141,7 +2136,7 @@ GDBRemoteCommunicationClient::FindProces
             }
         }
         StringExtractorGDBRemote response;
-        if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false))
+        if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false) == PacketResult::Success)
         {
             do
             {
@@ -2151,7 +2146,7 @@ GDBRemoteCommunicationClient::FindProces
                 process_infos.Append(process_info);
                 response.GetStringRef().clear();
                 response.SetFilePos(0);
-            } while (SendPacketAndWaitForResponse ("qsProcessInfo", strlen ("qsProcessInfo"), response, false));
+            } while (SendPacketAndWaitForResponse ("qsProcessInfo", strlen ("qsProcessInfo"), response, false) == PacketResult::Success);
         }
         else
         {
@@ -2172,7 +2167,7 @@ GDBRemoteCommunicationClient::GetUserNam
         const int packet_len = ::snprintf (packet, sizeof (packet), "qUserName:%i", uid);
         assert (packet_len < (int)sizeof(packet));
         StringExtractorGDBRemote response;
-        if (SendPacketAndWaitForResponse (packet, packet_len, response, false))
+        if (SendPacketAndWaitForResponse (packet, packet_len, response, false) == PacketResult::Success)
         {
             if (response.IsNormalResponse())
             {
@@ -2202,7 +2197,7 @@ GDBRemoteCommunicationClient::GetGroupNa
         const int packet_len = ::snprintf (packet, sizeof (packet), "qGroupName:%i", gid);
         assert (packet_len < (int)sizeof(packet));
         StringExtractorGDBRemote response;
-        if (SendPacketAndWaitForResponse (packet, packet_len, response, false))
+        if (SendPacketAndWaitForResponse (packet, packet_len, response, false) == PacketResult::Success)
         {
             if (response.IsNormalResponse())
             {
@@ -2296,8 +2291,7 @@ GDBRemoteCommunicationClient::SendSpeedT
     }
 
     StringExtractorGDBRemote response;
-    return SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false) > 0;
-    return false;
+    return SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false)  == PacketResult::Success;
 }
 
 uint16_t
@@ -2326,7 +2320,7 @@ GDBRemoteCommunicationClient::LaunchGDBs
     const char *packet = stream.GetData();
     int packet_len = stream.GetSize();
 
-    if (SendPacketAndWaitForResponse(packet, packet_len, response, false))
+    if (SendPacketAndWaitForResponse(packet, packet_len, response, false) == PacketResult::Success)
     {
         std::string name;
         std::string value;
@@ -2352,7 +2346,7 @@ GDBRemoteCommunicationClient::KillSpawne
     int packet_len = stream.GetSize();
 
     StringExtractorGDBRemote response;
-    if (SendPacketAndWaitForResponse(packet, packet_len, response, false))
+    if (SendPacketAndWaitForResponse(packet, packet_len, response, false) == PacketResult::Success)
     {
         if (response.IsOKResponse())
             return true;
@@ -2374,7 +2368,7 @@ GDBRemoteCommunicationClient::SetCurrent
         packet_len = ::snprintf (packet, sizeof(packet), "Hg%" PRIx64, tid);
     assert (packet_len + 1 < (int)sizeof(packet));
     StringExtractorGDBRemote response;
-    if (SendPacketAndWaitForResponse(packet, packet_len, response, false))
+    if (SendPacketAndWaitForResponse(packet, packet_len, response, false) == PacketResult::Success)
     {
         if (response.IsOKResponse())
         {
@@ -2400,7 +2394,7 @@ GDBRemoteCommunicationClient::SetCurrent
 
     assert (packet_len + 1 < (int)sizeof(packet));
     StringExtractorGDBRemote response;
-    if (SendPacketAndWaitForResponse(packet, packet_len, response, false))
+    if (SendPacketAndWaitForResponse(packet, packet_len, response, false) == PacketResult::Success)
     {
         if (response.IsOKResponse())
         {
@@ -2414,7 +2408,7 @@ GDBRemoteCommunicationClient::SetCurrent
 bool
 GDBRemoteCommunicationClient::GetStopReply (StringExtractorGDBRemote &response)
 {
-    if (SendPacketAndWaitForResponse("?", 1, response, false))
+    if (SendPacketAndWaitForResponse("?", 1, response, false) == PacketResult::Success)
         return response.IsNormalResponse();
     return false;
 }
@@ -2427,7 +2421,7 @@ GDBRemoteCommunicationClient::GetThreadS
         char packet[256];
         int packet_len = ::snprintf(packet, sizeof(packet), "qThreadStopInfo%" PRIx64, tid);
         assert (packet_len < (int)sizeof(packet));
-        if (SendPacketAndWaitForResponse(packet, packet_len, response, false))
+        if (SendPacketAndWaitForResponse(packet, packet_len, response, false) == PacketResult::Success)
         {
             if (response.IsUnsupportedResponse())
                 m_supports_qThreadStopInfo = false;
@@ -2468,7 +2462,7 @@ GDBRemoteCommunicationClient::SendGDBSto
 
     assert (packet_len + 1 < (int)sizeof(packet));
     StringExtractorGDBRemote response;
-    if (SendPacketAndWaitForResponse(packet, packet_len, response, true))
+    if (SendPacketAndWaitForResponse(packet, packet_len, response, true) == PacketResult::Success)
     {
         if (response.IsOKResponse())
             return 0;
@@ -2502,9 +2496,10 @@ GDBRemoteCommunicationClient::GetCurrent
         sequence_mutex_unavailable = false;
         StringExtractorGDBRemote response;
         
-        for (SendPacketNoLock ("qfThreadInfo", strlen("qfThreadInfo")) && WaitForPacketWithTimeoutMicroSecondsNoLock (response, GetPacketTimeoutInMicroSeconds ());
-             response.IsNormalResponse();
-             SendPacketNoLock ("qsThreadInfo", strlen("qsThreadInfo")) && WaitForPacketWithTimeoutMicroSecondsNoLock (response, GetPacketTimeoutInMicroSeconds ()))
+        PacketResult packet_result;
+        for (packet_result = SendPacketAndWaitForResponseNoLock ("qfThreadInfo", strlen("qfThreadInfo"), response);
+             packet_result == PacketResult::Success && response.IsNormalResponse();
+             packet_result = SendPacketAndWaitForResponseNoLock ("qsThreadInfo", strlen("qsThreadInfo"), response))
         {
             char ch = response.GetChar();
             if (ch == 'l')
@@ -2544,7 +2539,7 @@ GDBRemoteCommunicationClient::GetShlibIn
     if (!IsRunning())
     {
         StringExtractorGDBRemote response;
-        if (SendPacketAndWaitForResponse("qShlibInfoAddr", ::strlen ("qShlibInfoAddr"), response, false))
+        if (SendPacketAndWaitForResponse("qShlibInfoAddr", ::strlen ("qShlibInfoAddr"), response, false) == PacketResult::Success)
         {
             if (response.IsNormalResponse())
                 return response.GetHexMaxU64(false, LLDB_INVALID_ADDRESS);
@@ -2574,7 +2569,7 @@ GDBRemoteCommunicationClient::RunShellCo
     const char *packet = stream.GetData();
     int packet_len = stream.GetSize();
     StringExtractorGDBRemote response;
-    if (SendPacketAndWaitForResponse(packet, packet_len, response, false))
+    if (SendPacketAndWaitForResponse(packet, packet_len, response, false) == PacketResult::Success)
     {
         if (response.GetChar() != 'F')
             return Error("malformed reply");
@@ -2613,7 +2608,7 @@ GDBRemoteCommunicationClient::MakeDirect
     const char *packet = stream.GetData();
     int packet_len = stream.GetSize();
     StringExtractorGDBRemote response;
-    if (SendPacketAndWaitForResponse(packet, packet_len, response, false))
+    if (SendPacketAndWaitForResponse(packet, packet_len, response, false) == PacketResult::Success)
     {
         return Error(response.GetHexMaxU32(false, UINT32_MAX), eErrorTypePOSIX);
     }
@@ -2633,7 +2628,7 @@ GDBRemoteCommunicationClient::SetFilePer
     const char *packet = stream.GetData();
     int packet_len = stream.GetSize();
     StringExtractorGDBRemote response;
-    if (SendPacketAndWaitForResponse(packet, packet_len, response, false))
+    if (SendPacketAndWaitForResponse(packet, packet_len, response, false) == PacketResult::Success)
     {
         return Error(response.GetHexMaxU32(false, UINT32_MAX), eErrorTypePOSIX);
     }
@@ -2684,7 +2679,7 @@ GDBRemoteCommunicationClient::OpenFile (
     const char* packet = stream.GetData();
     int packet_len = stream.GetSize();
     StringExtractorGDBRemote response;
-    if (SendPacketAndWaitForResponse(packet, packet_len, response, false))
+    if (SendPacketAndWaitForResponse(packet, packet_len, response, false) == PacketResult::Success)
     {
         return ParseHostIOPacketResponse (response, UINT64_MAX, error);
     }
@@ -2700,7 +2695,7 @@ GDBRemoteCommunicationClient::CloseFile
     const char* packet = stream.GetData();
     int packet_len = stream.GetSize();
     StringExtractorGDBRemote response;
-    if (SendPacketAndWaitForResponse(packet, packet_len, response, false))
+    if (SendPacketAndWaitForResponse(packet, packet_len, response, false) == PacketResult::Success)
     {
         return ParseHostIOPacketResponse (response, -1, error) == 0;
     }
@@ -2718,7 +2713,7 @@ GDBRemoteCommunicationClient::GetFileSiz
     const char* packet = stream.GetData();
     int packet_len = stream.GetSize();
     StringExtractorGDBRemote response;
-    if (SendPacketAndWaitForResponse(packet, packet_len, response, false))
+    if (SendPacketAndWaitForResponse(packet, packet_len, response, false) == PacketResult::Success)
     {
         if (response.GetChar() != 'F')
             return UINT64_MAX;
@@ -2738,7 +2733,7 @@ GDBRemoteCommunicationClient::GetFilePer
     const char* packet = stream.GetData();
     int packet_len = stream.GetSize();
     StringExtractorGDBRemote response;
-    if (SendPacketAndWaitForResponse(packet, packet_len, response, false))
+    if (SendPacketAndWaitForResponse(packet, packet_len, response, false) == PacketResult::Success)
     {
         if (response.GetChar() != 'F')
         {
@@ -2785,7 +2780,7 @@ GDBRemoteCommunicationClient::ReadFile (
     const char* packet = stream.GetData();
     int packet_len = stream.GetSize();
     StringExtractorGDBRemote response;
-    if (SendPacketAndWaitForResponse(packet, packet_len, response, false))
+    if (SendPacketAndWaitForResponse(packet, packet_len, response, false) == PacketResult::Success)
     {
         if (response.GetChar() != 'F')
             return 0;
@@ -2824,7 +2819,7 @@ GDBRemoteCommunicationClient::WriteFile
     const char* packet = stream.GetData();
     int packet_len = stream.GetSize();
     StringExtractorGDBRemote response;
-    if (SendPacketAndWaitForResponse(packet, packet_len, response, false))
+    if (SendPacketAndWaitForResponse(packet, packet_len, response, false) == PacketResult::Success)
     {
         if (response.GetChar() != 'F')
         {
@@ -2866,7 +2861,7 @@ GDBRemoteCommunicationClient::CreateSyml
     const char* packet = stream.GetData();
     int packet_len = stream.GetSize();
     StringExtractorGDBRemote response;
-    if (SendPacketAndWaitForResponse(packet, packet_len, response, false))
+    if (SendPacketAndWaitForResponse(packet, packet_len, response, false) == PacketResult::Success)
     {
         if (response.GetChar() == 'F')
         {
@@ -2907,7 +2902,7 @@ GDBRemoteCommunicationClient::Unlink (co
     const char* packet = stream.GetData();
     int packet_len = stream.GetSize();
     StringExtractorGDBRemote response;
-    if (SendPacketAndWaitForResponse(packet, packet_len, response, false))
+    if (SendPacketAndWaitForResponse(packet, packet_len, response, false) == PacketResult::Success)
     {
         if (response.GetChar() == 'F')
         {
@@ -2947,7 +2942,7 @@ GDBRemoteCommunicationClient::GetFileExi
     const char* packet = stream.GetData();
     int packet_len = stream.GetSize();
     StringExtractorGDBRemote response;
-    if (SendPacketAndWaitForResponse(packet, packet_len, response, false))
+    if (SendPacketAndWaitForResponse(packet, packet_len, response, false) == PacketResult::Success)
     {
         if (response.GetChar() != 'F')
             return false;
@@ -2971,7 +2966,7 @@ GDBRemoteCommunicationClient::CalculateM
     const char* packet = stream.GetData();
     int packet_len = stream.GetSize();
     StringExtractorGDBRemote response;
-    if (SendPacketAndWaitForResponse(packet, packet_len, response, false))
+    if (SendPacketAndWaitForResponse(packet, packet_len, response, false) == PacketResult::Success)
     {
         if (response.GetChar() != 'F')
             return false;
@@ -3003,7 +2998,7 @@ GDBRemoteCommunicationClient::ReadRegist
             else
                 packet_len = ::snprintf (packet, sizeof(packet), "p%x", reg);
             assert (packet_len < ((int)sizeof(packet) - 1));
-            return SendPacketAndWaitForResponse(packet, response, false);
+            return SendPacketAndWaitForResponse(packet, response, false) == PacketResult::Success;
         }
     }
     return false;
@@ -3029,7 +3024,7 @@ GDBRemoteCommunicationClient::ReadAllReg
             else
                 packet_len = ::snprintf (packet, sizeof(packet), "g");
             assert (packet_len < ((int)sizeof(packet) - 1));
-            return SendPacketAndWaitForResponse(packet, response, false);
+            return SendPacketAndWaitForResponse(packet, response, false) == PacketResult::Success;
         }
     }
     return false;
@@ -3056,7 +3051,7 @@ GDBRemoteCommunicationClient::SaveRegist
             
             StringExtractorGDBRemote response;
 
-            if (SendPacketAndWaitForResponse(packet, response, false))
+            if (SendPacketAndWaitForResponse(packet, response, false) == PacketResult::Success)
             {
                 if (response.IsUnsupportedResponse())
                 {
@@ -3099,7 +3094,7 @@ GDBRemoteCommunicationClient::RestoreReg
             
             StringExtractorGDBRemote response;
             
-            if (SendPacketAndWaitForResponse(packet, response, false))
+            if (SendPacketAndWaitForResponse(packet, response, false) == PacketResult::Success)
             {
                 if (response.IsOKResponse())
                 {

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h?rev=196610&r1=196609&r2=196610&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h Fri Dec  6 15:45:27 2013
@@ -47,12 +47,12 @@ public:
     bool
     HandshakeWithServer (lldb_private::Error *error_ptr);
 
-    size_t
+    PacketResult
     SendPacketAndWaitForResponse (const char *send_payload,
                                   StringExtractorGDBRemote &response,
                                   bool send_async);
 
-    size_t
+    PacketResult
     SendPacketAndWaitForResponse (const char *send_payload,
                                   size_t send_length,
                                   StringExtractorGDBRemote &response,
@@ -458,6 +458,11 @@ public:
     
 protected:
 
+    PacketResult
+    SendPacketAndWaitForResponseNoLock (const char *payload,
+                                        size_t payload_length,
+                                        StringExtractorGDBRemote &response);
+
     bool
     GetCurrentProcessInfo ();
 

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp?rev=196610&r1=196609&r2=196610&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp Fri Dec  6 15:45:27 2013
@@ -90,155 +90,195 @@ GDBRemoteCommunicationServer::GetPacketA
                                                         bool &quit)
 {
     StringExtractorGDBRemote packet;
-    if (WaitForPacketWithTimeoutMicroSecondsNoLock (packet, timeout_usec))
+    PacketResult packet_result = WaitForPacketWithTimeoutMicroSecondsNoLock (packet, timeout_usec);
+    if (packet_result == PacketResult::Success)
     {
         const StringExtractorGDBRemote::ServerPacketType packet_type = packet.GetServerPacketType ();
         switch (packet_type)
         {
-            case StringExtractorGDBRemote::eServerPacketType_nack:
-            case StringExtractorGDBRemote::eServerPacketType_ack:
-                break;
-
-            case StringExtractorGDBRemote::eServerPacketType_invalid:
-                error.SetErrorString("invalid packet");
-                quit = true;
-                break;
-
-            case StringExtractorGDBRemote::eServerPacketType_interrupt:
-                error.SetErrorString("interrupt received");
-                interrupt = true;
-                break;
-
-            default:
-            case StringExtractorGDBRemote::eServerPacketType_unimplemented:
-                return SendUnimplementedResponse (packet.GetStringRef().c_str()) > 0;
-
-            case StringExtractorGDBRemote::eServerPacketType_A:
-                return Handle_A (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_qfProcessInfo:
-                return Handle_qfProcessInfo (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_qsProcessInfo:
-                return Handle_qsProcessInfo (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_qC:
-                return Handle_qC (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_qHostInfo:
-                return Handle_qHostInfo (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_qLaunchGDBServer:
-                return Handle_qLaunchGDBServer (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_qKillSpawnedProcess:
-                return Handle_qKillSpawnedProcess (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_qLaunchSuccess:
-                return Handle_qLaunchSuccess (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_qGroupName:
-                return Handle_qGroupName (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_qProcessInfoPID:
-                return Handle_qProcessInfoPID (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_qSpeedTest:
-                return Handle_qSpeedTest (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_qUserName:
-                return Handle_qUserName (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_qGetWorkingDir:
-                return Handle_qGetWorkingDir(packet);
-    
-            case StringExtractorGDBRemote::eServerPacketType_QEnvironment:
-                return Handle_QEnvironment (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_QLaunchArch:
-                return Handle_QLaunchArch (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_QSetDisableASLR:
-                return Handle_QSetDisableASLR (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_QSetSTDIN:
-                return Handle_QSetSTDIN (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_QSetSTDOUT:
-                return Handle_QSetSTDOUT (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_QSetSTDERR:
-                return Handle_QSetSTDERR (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_QSetWorkingDir:
-                return Handle_QSetWorkingDir (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_QStartNoAckMode:
-                return Handle_QStartNoAckMode (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_qPlatform_mkdir:
-                return Handle_qPlatform_mkdir (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_qPlatform_chmod:
-                return Handle_qPlatform_chmod (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_qPlatform_shell:
-                return Handle_qPlatform_shell (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_vFile_open:
-                return Handle_vFile_Open (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_vFile_close:
-                return Handle_vFile_Close (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_vFile_pread:
-                return Handle_vFile_pRead (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_vFile_pwrite:
-                return Handle_vFile_pWrite (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_vFile_size:
-                return Handle_vFile_Size (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_vFile_mode:
-                return Handle_vFile_Mode (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_vFile_exists:
-                return Handle_vFile_Exists (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_vFile_stat:
-                return Handle_vFile_Stat (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_vFile_md5:
-                return Handle_vFile_MD5 (packet);
-
-            case StringExtractorGDBRemote::eServerPacketType_vFile_symlink:
-                return Handle_vFile_symlink (packet);
-                
-            case StringExtractorGDBRemote::eServerPacketType_vFile_unlink:
-                return Handle_vFile_unlink (packet);
+        case StringExtractorGDBRemote::eServerPacketType_nack:
+        case StringExtractorGDBRemote::eServerPacketType_ack:
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_invalid:
+            error.SetErrorString("invalid packet");
+            quit = true;
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_interrupt:
+            error.SetErrorString("interrupt received");
+            interrupt = true;
+            break;
+
+        default:
+        case StringExtractorGDBRemote::eServerPacketType_unimplemented:
+            packet_result = SendUnimplementedResponse (packet.GetStringRef().c_str());
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_A:
+            packet_result = Handle_A (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_qfProcessInfo:
+            packet_result = Handle_qfProcessInfo (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_qsProcessInfo:
+            packet_result = Handle_qsProcessInfo (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_qC:
+            packet_result = Handle_qC (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_qHostInfo:
+            packet_result = Handle_qHostInfo (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_qLaunchGDBServer:
+            packet_result = Handle_qLaunchGDBServer (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_qKillSpawnedProcess:
+            packet_result = Handle_qKillSpawnedProcess (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_qLaunchSuccess:
+            packet_result = Handle_qLaunchSuccess (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_qGroupName:
+            packet_result = Handle_qGroupName (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_qProcessInfoPID:
+            packet_result = Handle_qProcessInfoPID (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_qSpeedTest:
+            packet_result = Handle_qSpeedTest (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_qUserName:
+            packet_result = Handle_qUserName (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_qGetWorkingDir:
+            packet_result = Handle_qGetWorkingDir(packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_QEnvironment:
+            packet_result = Handle_QEnvironment (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_QLaunchArch:
+            packet_result = Handle_QLaunchArch (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_QSetDisableASLR:
+            packet_result = Handle_QSetDisableASLR (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_QSetSTDIN:
+            packet_result = Handle_QSetSTDIN (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_QSetSTDOUT:
+            packet_result = Handle_QSetSTDOUT (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_QSetSTDERR:
+            packet_result = Handle_QSetSTDERR (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_QSetWorkingDir:
+            packet_result = Handle_QSetWorkingDir (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_QStartNoAckMode:
+            packet_result = Handle_QStartNoAckMode (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_qPlatform_mkdir:
+            packet_result = Handle_qPlatform_mkdir (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_qPlatform_chmod:
+            packet_result = Handle_qPlatform_chmod (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_qPlatform_shell:
+            packet_result = Handle_qPlatform_shell (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_vFile_open:
+            packet_result = Handle_vFile_Open (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_vFile_close:
+            packet_result = Handle_vFile_Close (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_vFile_pread:
+            packet_result = Handle_vFile_pRead (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_vFile_pwrite:
+            packet_result = Handle_vFile_pWrite (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_vFile_size:
+            packet_result = Handle_vFile_Size (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_vFile_mode:
+            packet_result = Handle_vFile_Mode (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_vFile_exists:
+            packet_result = Handle_vFile_Exists (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_vFile_stat:
+            packet_result = Handle_vFile_Stat (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_vFile_md5:
+            packet_result = Handle_vFile_MD5 (packet);
+            break;
+
+        case StringExtractorGDBRemote::eServerPacketType_vFile_symlink:
+            packet_result = Handle_vFile_symlink (packet);
+            break;
+            
+        case StringExtractorGDBRemote::eServerPacketType_vFile_unlink:
+            packet_result = Handle_vFile_unlink (packet);
+            break;
         }
-        return true;
     }
     else
     {
         if (!IsConnected())
+        {
             error.SetErrorString("lost connection");
+            quit = true;
+        }
         else
+        {
             error.SetErrorString("timeout");
+        }
     }
-
-    return false;
+    return packet_result == PacketResult::Success;
 }
 
-size_t
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::SendUnimplementedResponse (const char *)
 {
     // TODO: Log the packet we aren't handling...
     return SendPacketNoLock ("", 0);
 }
 
-size_t
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::SendErrorResponse (uint8_t err)
 {
     char packet[16];
@@ -248,7 +288,7 @@ GDBRemoteCommunicationServer::SendErrorR
 }
 
 
-size_t
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::SendOKResponse ()
 {
     return SendPacketNoLock ("OK", 2);
@@ -257,10 +297,10 @@ GDBRemoteCommunicationServer::SendOKResp
 bool
 GDBRemoteCommunicationServer::HandshakeWithClient(Error *error_ptr)
 {
-    return GetAck();
+    return GetAck() == PacketResult::Success;
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_qHostInfo (StringExtractorGDBRemote &packet)
 {
     StreamString response;
@@ -352,7 +392,7 @@ GDBRemoteCommunicationServer::Handle_qHo
     }
 #endif  // #if defined(__APPLE__)
 
-    return SendPacketNoLock (response.GetData(), response.GetSize()) > 0;
+    return SendPacketNoLock (response.GetData(), response.GetSize());
 }
 
 static void
@@ -378,7 +418,7 @@ CreateProcessInfoResponse (const Process
     }
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_qProcessInfoPID (StringExtractorGDBRemote &packet)
 {
     // Packet format: "qProcessInfoPID:%i" where %i is the pid
@@ -397,7 +437,7 @@ GDBRemoteCommunicationServer::Handle_qPr
     return SendErrorResponse (1);
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_qfProcessInfo (StringExtractorGDBRemote &packet)
 {
     m_proc_infos_index = 0;
@@ -498,7 +538,7 @@ GDBRemoteCommunicationServer::Handle_qfP
     return SendErrorResponse (3);
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_qsProcessInfo (StringExtractorGDBRemote &packet)
 {
     if (m_proc_infos_index < m_proc_infos.GetSize())
@@ -511,7 +551,7 @@ GDBRemoteCommunicationServer::Handle_qsP
     return SendErrorResponse (4);
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_qUserName (StringExtractorGDBRemote &packet)
 {
     // Packet format: "qUserName:%i" where %i is the uid
@@ -531,7 +571,7 @@ GDBRemoteCommunicationServer::Handle_qUs
 
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_qGroupName (StringExtractorGDBRemote &packet)
 {
     // Packet format: "qGroupName:%i" where %i is the gid
@@ -550,7 +590,7 @@ GDBRemoteCommunicationServer::Handle_qGr
     return SendErrorResponse (6);
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_qSpeedTest (StringExtractorGDBRemote &packet)
 {
     packet.SetFilePos(::strlen ("qSpeedTest:"));
@@ -642,7 +682,7 @@ AcceptPortFromInferior (void *arg)
 //    return false;
 //}
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_A (StringExtractorGDBRemote &packet)
 {
     // The 'A' packet is the most over designed packet ever here with
@@ -719,7 +759,7 @@ GDBRemoteCommunicationServer::Handle_A (
     return SendErrorResponse (8);
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_qC (StringExtractorGDBRemote &packet)
 {
     lldb::pid_t pid = m_process_launch_info.GetProcessID();
@@ -762,7 +802,7 @@ GDBRemoteCommunicationServer::ReapDebugs
     return true;
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_qLaunchGDBServer (StringExtractorGDBRemote &packet)
 {
 #ifdef _WIN32
@@ -834,19 +874,17 @@ GDBRemoteCommunicationServer::Handle_qLa
 
             if (error.Success())
             {
-                bool success = false;
-
                 char response[256];
                 const int response_len = ::snprintf (response, sizeof(response), "pid:%" PRIu64 ";port:%u;", debugserver_pid, port + m_port_offset);
                 assert (response_len < sizeof(response));
-                success = SendPacketNoLock (response, response_len) > 0;
+                PacketResult packet_result = SendPacketNoLock (response, response_len);
 
-                if (!success)
+                if (packet_result != PacketResult::Success)
                 {
                     if (debugserver_pid != LLDB_INVALID_PROCESS_ID)
                         ::kill (debugserver_pid, SIGINT);
                 }
-                return success;
+                return packet_result;
             }
         }
     }
@@ -854,7 +892,7 @@ GDBRemoteCommunicationServer::Handle_qLa
 #endif
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_qKillSpawnedProcess (StringExtractorGDBRemote &packet)
 {
     // Spawn a local debugserver as a platform so we can then attach or launch
@@ -907,7 +945,7 @@ GDBRemoteCommunicationServer::Handle_qKi
     return SendErrorResponse (11);
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_qLaunchSuccess (StringExtractorGDBRemote &packet)
 {
     if (m_process_launch_error.Success())
@@ -918,7 +956,7 @@ GDBRemoteCommunicationServer::Handle_qLa
     return SendPacketNoLock (response.GetData(), response.GetSize());
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_QEnvironment  (StringExtractorGDBRemote &packet)
 {
     packet.SetFilePos(::strlen ("QEnvironment:"));
@@ -931,7 +969,7 @@ GDBRemoteCommunicationServer::Handle_QEn
     return SendErrorResponse (12);
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_QLaunchArch (StringExtractorGDBRemote &packet)
 {
     packet.SetFilePos(::strlen ("QLaunchArch:"));
@@ -946,7 +984,7 @@ GDBRemoteCommunicationServer::Handle_QLa
     return SendErrorResponse(13);
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_QSetDisableASLR (StringExtractorGDBRemote &packet)
 {
     packet.SetFilePos(::strlen ("QSetDisableASLR:"));
@@ -957,7 +995,7 @@ GDBRemoteCommunicationServer::Handle_QSe
     return SendOKResponse ();
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_QSetWorkingDir (StringExtractorGDBRemote &packet)
 {
     packet.SetFilePos(::strlen ("QSetWorkingDir:"));
@@ -981,7 +1019,7 @@ GDBRemoteCommunicationServer::Handle_QSe
     return SendOKResponse ();
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_qGetWorkingDir (StringExtractorGDBRemote &packet)
 {
     StreamString response;
@@ -997,8 +1035,7 @@ GDBRemoteCommunicationServer::Handle_qGe
         else
         {
             response.PutBytesAsRawHex8(cwd, strlen(cwd));
-            SendPacketNoLock(response.GetData(), response.GetSize());
-            return true;
+            return SendPacketNoLock(response.GetData(), response.GetSize());
         }
     }
     else
@@ -1007,8 +1044,7 @@ GDBRemoteCommunicationServer::Handle_qGe
         if (working_dir && working_dir[0])
         {
             response.PutBytesAsRawHex8(working_dir, strlen(working_dir));
-            SendPacketNoLock(response.GetData(), response.GetSize());
-            return true;
+            return SendPacketNoLock(response.GetData(), response.GetSize());
         }
         else
         {
@@ -1017,7 +1053,7 @@ GDBRemoteCommunicationServer::Handle_qGe
     }
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_QSetSTDIN (StringExtractorGDBRemote &packet)
 {
     packet.SetFilePos(::strlen ("QSetSTDIN:"));
@@ -1034,7 +1070,7 @@ GDBRemoteCommunicationServer::Handle_QSe
     return SendErrorResponse (15);
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_QSetSTDOUT (StringExtractorGDBRemote &packet)
 {
     packet.SetFilePos(::strlen ("QSetSTDOUT:"));
@@ -1051,7 +1087,7 @@ GDBRemoteCommunicationServer::Handle_QSe
     return SendErrorResponse (16);
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_QSetSTDERR (StringExtractorGDBRemote &packet)
 {
     packet.SetFilePos(::strlen ("QSetSTDERR:"));
@@ -1068,16 +1104,16 @@ GDBRemoteCommunicationServer::Handle_QSe
     return SendErrorResponse (17);
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_QStartNoAckMode (StringExtractorGDBRemote &packet)
 {
     // Send response first before changing m_send_acks to we ack this packet
-    SendOKResponse ();
+    PacketResult packet_result = SendOKResponse ();
     m_send_acks = false;
-    return true;
+    return packet_result;
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_qPlatform_mkdir (StringExtractorGDBRemote &packet)
 {
     packet.SetFilePos(::strlen("qPlatform_mkdir:"));
@@ -1095,7 +1131,7 @@ GDBRemoteCommunicationServer::Handle_qPl
     return SendErrorResponse(20);
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_qPlatform_chmod (StringExtractorGDBRemote &packet)
 {
     packet.SetFilePos(::strlen("qPlatform_chmod:"));
@@ -1114,7 +1150,7 @@ GDBRemoteCommunicationServer::Handle_qPl
     return SendErrorResponse(19);
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_vFile_Open (StringExtractorGDBRemote &packet)
 {
     packet.SetFilePos(::strlen("vFile:open:"));
@@ -1143,7 +1179,7 @@ GDBRemoteCommunicationServer::Handle_vFi
     return SendErrorResponse(18);
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_vFile_Close (StringExtractorGDBRemote &packet)
 {
     packet.SetFilePos(::strlen("vFile:close:"));
@@ -1168,7 +1204,7 @@ GDBRemoteCommunicationServer::Handle_vFi
     return SendPacketNoLock(response.GetData(), response.GetSize());
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_vFile_pRead (StringExtractorGDBRemote &packet)
 {
 #ifdef _WIN32
@@ -1210,7 +1246,7 @@ GDBRemoteCommunicationServer::Handle_vFi
 #endif
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_vFile_pWrite (StringExtractorGDBRemote &packet)
 {
 #ifdef _WIN32
@@ -1247,7 +1283,7 @@ GDBRemoteCommunicationServer::Handle_vFi
 #endif
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_vFile_Size (StringExtractorGDBRemote &packet)
 {
     packet.SetFilePos(::strlen("vFile:size:"));
@@ -1269,7 +1305,7 @@ GDBRemoteCommunicationServer::Handle_vFi
     return SendErrorResponse(22);
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_vFile_Mode (StringExtractorGDBRemote &packet)
 {
     packet.SetFilePos(::strlen("vFile:mode:"));
@@ -1288,7 +1324,7 @@ GDBRemoteCommunicationServer::Handle_vFi
     return SendErrorResponse(23);
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_vFile_Exists (StringExtractorGDBRemote &packet)
 {
     packet.SetFilePos(::strlen("vFile:exists:"));
@@ -1309,7 +1345,7 @@ GDBRemoteCommunicationServer::Handle_vFi
     return SendErrorResponse(24);
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_vFile_symlink (StringExtractorGDBRemote &packet)
 {
     packet.SetFilePos(::strlen("vFile:symlink:"));
@@ -1323,7 +1359,7 @@ GDBRemoteCommunicationServer::Handle_vFi
     return SendPacketNoLock(response.GetData(), response.GetSize());
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_vFile_unlink (StringExtractorGDBRemote &packet)
 {
     packet.SetFilePos(::strlen("vFile:unlink:"));
@@ -1335,7 +1371,7 @@ GDBRemoteCommunicationServer::Handle_vFi
     return SendPacketNoLock(response.GetData(), response.GetSize());
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_qPlatform_shell (StringExtractorGDBRemote &packet)
 {
     packet.SetFilePos(::strlen("qPlatform_shell:"));
@@ -1377,13 +1413,13 @@ GDBRemoteCommunicationServer::Handle_qPl
     return SendErrorResponse(24);
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_vFile_Stat (StringExtractorGDBRemote &packet)
 {
     return SendUnimplementedResponse("GDBRemoteCommunicationServer::Handle_vFile_Stat() unimplemented");
 }
 
-bool
+GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServer::Handle_vFile_MD5 (StringExtractorGDBRemote &packet)
 {
     packet.SetFilePos(::strlen("vFile:MD5:"));

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h?rev=196610&r1=196609&r2=196610&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h Fri Dec  6 15:45:27 2013
@@ -150,118 +150,118 @@ protected:
     uint16_t m_port_offset;
     
 
-    size_t
+    PacketResult
     SendUnimplementedResponse (const char *packet);
 
-    size_t
+    PacketResult
     SendErrorResponse (uint8_t error);
 
-    size_t
+    PacketResult
     SendOKResponse ();
 
-    bool
+    PacketResult
     Handle_A (StringExtractorGDBRemote &packet);
     
-    bool
+    PacketResult
     Handle_qLaunchSuccess (StringExtractorGDBRemote &packet);
 
-    bool
+    PacketResult
     Handle_qHostInfo (StringExtractorGDBRemote &packet);
     
-    bool
+    PacketResult
     Handle_qLaunchGDBServer (StringExtractorGDBRemote &packet);
     
-    bool
+    PacketResult
     Handle_qKillSpawnedProcess (StringExtractorGDBRemote &packet);
 
-    bool
+    PacketResult
     Handle_qPlatform_mkdir (StringExtractorGDBRemote &packet);
     
-    bool
+    PacketResult
     Handle_qPlatform_chmod (StringExtractorGDBRemote &packet);
     
-    bool
+    PacketResult
     Handle_qProcessInfoPID (StringExtractorGDBRemote &packet);
     
-    bool
+    PacketResult
     Handle_qfProcessInfo (StringExtractorGDBRemote &packet);
     
-    bool 
+    PacketResult
     Handle_qsProcessInfo (StringExtractorGDBRemote &packet);
 
-    bool
+    PacketResult
     Handle_qC (StringExtractorGDBRemote &packet);
 
-    bool 
+    PacketResult
     Handle_qUserName (StringExtractorGDBRemote &packet);
 
-    bool 
+    PacketResult
     Handle_qGroupName (StringExtractorGDBRemote &packet);
 
-    bool
+    PacketResult
     Handle_qSpeedTest (StringExtractorGDBRemote &packet);
 
-    bool
+    PacketResult
     Handle_QEnvironment  (StringExtractorGDBRemote &packet);
     
-    bool
+    PacketResult
     Handle_QLaunchArch (StringExtractorGDBRemote &packet);
     
-    bool
+    PacketResult
     Handle_QSetDisableASLR (StringExtractorGDBRemote &packet);
 
-    bool
+    PacketResult
     Handle_QSetWorkingDir (StringExtractorGDBRemote &packet);
     
-    bool
+    PacketResult
     Handle_qGetWorkingDir (StringExtractorGDBRemote &packet);
 
-    bool
+    PacketResult
     Handle_QStartNoAckMode (StringExtractorGDBRemote &packet);
 
-    bool
+    PacketResult
     Handle_QSetSTDIN (StringExtractorGDBRemote &packet);
 
-    bool
+    PacketResult
     Handle_QSetSTDOUT (StringExtractorGDBRemote &packet);
 
-    bool
+    PacketResult
     Handle_QSetSTDERR (StringExtractorGDBRemote &packet);
     
-    bool
+    PacketResult
     Handle_vFile_Open (StringExtractorGDBRemote &packet);
 
-    bool
+    PacketResult
     Handle_vFile_Close (StringExtractorGDBRemote &packet);
 
-    bool
+    PacketResult
     Handle_vFile_pRead (StringExtractorGDBRemote &packet);
 
-    bool
+    PacketResult
     Handle_vFile_pWrite (StringExtractorGDBRemote &packet);
 
-    bool
+    PacketResult
     Handle_vFile_Size (StringExtractorGDBRemote &packet);
     
-    bool
+    PacketResult
     Handle_vFile_Mode (StringExtractorGDBRemote &packet);
 
-    bool
+    PacketResult
     Handle_vFile_Exists (StringExtractorGDBRemote &packet);
     
-    bool
+    PacketResult
     Handle_vFile_symlink (StringExtractorGDBRemote &packet);
     
-    bool
+    PacketResult
     Handle_vFile_unlink (StringExtractorGDBRemote &packet);
 
-    bool
+    PacketResult
     Handle_vFile_Stat (StringExtractorGDBRemote &packet);
     
-    bool
+    PacketResult
     Handle_vFile_MD5 (StringExtractorGDBRemote &packet);
     
-    bool
+    PacketResult
     Handle_qPlatform_shell (StringExtractorGDBRemote &packet);
 
 private:

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=196610&r1=196609&r2=196610&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp Fri Dec  6 15:45:27 2013
@@ -275,7 +275,7 @@ GDBRemoteRegisterContext::SetPrimordialR
     if (gdb_comm.SendPacketAndWaitForResponse(packet.GetString().c_str(),
                                               packet.GetString().size(),
                                               response,
-                                              false))
+                                              false) == GDBRemoteCommunication::PacketResult::Success)
     {
         if (response.IsOKResponse())
             return true;
@@ -298,7 +298,7 @@ GDBRemoteRegisterContext::SyncThreadStat
     if (gdb_comm.SendPacketAndWaitForResponse(packet.GetString().c_str(),
                                               packet.GetString().size(),
                                               response,
-                                              false))
+                                              false) == GDBRemoteCommunication::PacketResult::Success)
     {
         if (response.IsOKResponse())
             InvalidateAllRegisters();
@@ -363,7 +363,7 @@ GDBRemoteRegisterContext::WriteRegisterB
                     if (gdb_comm.SendPacketAndWaitForResponse(packet.GetString().c_str(),
                                                               packet.GetString().size(),
                                                               response,
-                                                              false))
+                                                              false) == GDBRemoteCommunication::PacketResult::Success)
                     {
                         SetAllRegisterValid (false);
                         if (response.IsOKResponse())
@@ -519,7 +519,7 @@ GDBRemoteRegisterContext::ReadAllRegiste
                 packet_len = ::snprintf (packet, sizeof(packet), "g");
             assert (packet_len < ((int)sizeof(packet) - 1));
 
-            if (gdb_comm.SendPacketAndWaitForResponse(packet, packet_len, response, false))
+            if (gdb_comm.SendPacketAndWaitForResponse(packet, packet_len, response, false) == GDBRemoteCommunication::PacketResult::Success)
             {
                 if (response.IsErrorResponse())
                     return false;
@@ -591,7 +591,7 @@ GDBRemoteRegisterContext::WriteAllRegist
             if (gdb_comm.SendPacketAndWaitForResponse (G_packet,
                                                        G_packet_len,
                                                        response,
-                                                       false))
+                                                       false) == GDBRemoteCommunication::PacketResult::Success)
             {
                 if (response.IsOKResponse())
                     return true;
@@ -660,7 +660,7 @@ GDBRemoteRegisterContext::WriteAllRegist
                                 if (gdb_comm.SendPacketAndWaitForResponse(packet.GetString().c_str(),
                                                                           packet.GetString().size(),
                                                                           response,
-                                                                          false))
+                                                                          false) == GDBRemoteCommunication::PacketResult::Success)
                                 {
                                     if (response.IsOKResponse())
                                         ++num_restored;

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=196610&r1=196609&r2=196610&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Fri Dec  6 15:45:27 2013
@@ -358,7 +358,7 @@ ProcessGDBRemote::BuildDynamicRegisterIn
         const int packet_len = ::snprintf (packet, sizeof(packet), "qRegisterInfo%x", reg_num);
         assert (packet_len < (int)sizeof(packet));
         StringExtractorGDBRemote response;
-        if (m_gdb_comm.SendPacketAndWaitForResponse(packet, packet_len, response, false))
+        if (m_gdb_comm.SendPacketAndWaitForResponse(packet, packet_len, response, false) == GDBRemoteCommunication::PacketResult::Success)
         {
             response_type = response.GetResponseType();
             if (response_type == StringExtractorGDBRemote::eResponse)
@@ -617,7 +617,7 @@ ProcessGDBRemote::DoConnectRemote (Strea
         // We have a valid process
         SetID (pid);
         GetThreadList();
-        if (m_gdb_comm.SendPacketAndWaitForResponse("?", 1, m_last_stop_packet, false))
+        if (m_gdb_comm.SendPacketAndWaitForResponse("?", 1, m_last_stop_packet, false) == GDBRemoteCommunication::PacketResult::Success)
         {
             if (!m_target.GetArchitecture().IsValid()) { // Make sure we have an architecture
                m_target.SetArchitecture(m_gdb_comm.GetProcessArchitecture());
@@ -807,7 +807,7 @@ ProcessGDBRemote::DoLaunch (Module *exe_
                 return error;
             }
 
-            if (m_gdb_comm.SendPacketAndWaitForResponse("?", 1, m_last_stop_packet, false))
+            if (m_gdb_comm.SendPacketAndWaitForResponse("?", 1, m_last_stop_packet, false) == GDBRemoteCommunication::PacketResult::Success)
             {
                 if (!m_target.GetArchitecture().IsValid()) { // Make sure we have an architecture
                    m_target.SetArchitecture(m_gdb_comm.GetProcessArchitecture());
@@ -1972,7 +1972,7 @@ ProcessGDBRemote::DoDestroy ()
             bool send_async = true;
             const uint32_t old_packet_timeout = m_gdb_comm.SetPacketTimeout (3);
 
-            if (m_gdb_comm.SendPacketAndWaitForResponse("k", 1, response, send_async))
+            if (m_gdb_comm.SendPacketAndWaitForResponse("k", 1, response, send_async) == GDBRemoteCommunication::PacketResult::Success)
             {
                 char packet_cmd = response.GetChar(0);
 
@@ -2074,7 +2074,7 @@ ProcessGDBRemote::DoReadMemory (addr_t a
     const int packet_len = ::snprintf (packet, sizeof(packet), "m%" PRIx64 ",%" PRIx64, (uint64_t)addr, (uint64_t)size);
     assert (packet_len + 1 < (int)sizeof(packet));
     StringExtractorGDBRemote response;
-    if (m_gdb_comm.SendPacketAndWaitForResponse(packet, packet_len, response, true))
+    if (m_gdb_comm.SendPacketAndWaitForResponse(packet, packet_len, response, true) == GDBRemoteCommunication::PacketResult::Success)
     {
         if (response.IsNormalResponse())
         {
@@ -2110,7 +2110,7 @@ ProcessGDBRemote::DoWriteMemory (addr_t
     packet.Printf("M%" PRIx64 ",%" PRIx64 ":", addr, (uint64_t)size);
     packet.PutBytesAsRawHex8(buf, size, lldb::endian::InlHostByteOrder(), lldb::endian::InlHostByteOrder());
     StringExtractorGDBRemote response;
-    if (m_gdb_comm.SendPacketAndWaitForResponse(packet.GetData(), packet.GetSize(), response, true))
+    if (m_gdb_comm.SendPacketAndWaitForResponse(packet.GetData(), packet.GetSize(), response, true) == GDBRemoteCommunication::PacketResult::Success)
     {
         if (response.IsOKResponse())
         {





More information about the lldb-commits mailing list