[Lldb-commits] [lldb] r197543 - Fix a bug introduced in asynchronous packet sends. We were not setting the packet result, and so

Jim Ingham jingham at apple.com
Tue Dec 17 17:24:34 PST 2013


Author: jingham
Date: Tue Dec 17 19:24:33 2013
New Revision: 197543

URL: http://llvm.org/viewvc/llvm-project?rev=197543&view=rev
Log:
Fix a bug introduced in asynchronous packet sends.  We were not setting the packet result, and so
it looked like the async packet send always failed.

<rdar://problem/15657157>

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

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=197543&r1=197542&r2=197543&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Tue Dec 17 19:24:33 2013
@@ -84,6 +84,7 @@ GDBRemoteCommunicationClient::GDBRemoteC
     m_async_mutex (Mutex::eMutexTypeRecursive),
     m_async_packet_predicate (false),
     m_async_packet (),
+    m_async_result (PacketResult::Success),
     m_async_response (),
     m_async_signal (-1),
     m_thread_id_to_used_usec_map (),
@@ -430,6 +431,7 @@ GDBRemoteCommunicationClient::SendPacket
                             // Swap the response buffer to avoid malloc and string copy
                             response.GetStringRef().swap (m_async_response.GetStringRef());
                             response_len = response.GetStringRef().size();
+                            packet_result = m_async_result;
                         }
                         else
                         {
@@ -742,11 +744,12 @@ GDBRemoteCommunicationClient::SendContin
                             Log * packet_log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS));
 
                             // We are supposed to send an asynchronous packet while
-                            // we are running. 
+                            // we are running.
                             m_async_response.Clear();
                             if (m_async_packet.empty())
                             {
-                                if (packet_log) 
+                                m_async_result = PacketResult::ErrorSendFailed;
+                                if (packet_log)
                                     packet_log->Printf ("async: error: empty async packet");                            
 
                             }
@@ -755,10 +758,10 @@ GDBRemoteCommunicationClient::SendContin
                                 if (packet_log) 
                                     packet_log->Printf ("async: sending packet");
                                 
-                                SendPacketAndWaitForResponse (&m_async_packet[0], 
-                                                              m_async_packet.size(),
-                                                              m_async_response,
-                                                              false);
+                                m_async_result = SendPacketAndWaitForResponse (&m_async_packet[0],
+                                                                               m_async_packet.size(),
+                                                                               m_async_response,
+                                                                               false);
                             }
                             // Let the other thread that was trying to send the async
                             // packet know that the packet has been sent and response is

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=197543&r1=197542&r2=197543&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h Tue Dec 17 19:24:33 2013
@@ -516,6 +516,7 @@ protected:
     lldb_private::Mutex m_async_mutex;
     lldb_private::Predicate<bool> m_async_packet_predicate;
     std::string m_async_packet;
+    PacketResult m_async_result;
     StringExtractorGDBRemote m_async_response;
     int m_async_signal; // We were asked to deliver a signal to the inferior process.
     bool m_interrupt_sent;





More information about the lldb-commits mailing list