[Lldb-commits] [lldb] r197579 - Workaround QEMU GDB server issue.

Ed Maste emaste at freebsd.org
Wed Dec 18 07:31:46 PST 2013


Author: emaste
Date: Wed Dec 18 09:31:45 2013
New Revision: 197579

URL: http://llvm.org/viewvc/llvm-project?rev=197579&view=rev
Log:
Workaround QEMU GDB server issue. 

During testing I observed QEMU send "$T02thread:01;#04" upon connection,
before any command from LLDB.  This change from gclayton accepts (and
discards) a packet immediately after sending the initial ack, to flush
the GDB remote pipeline.

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=197579&r1=197578&r2=197579&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Wed Dec 18 09:31:45 2013
@@ -118,6 +118,14 @@ GDBRemoteCommunicationClient::HandshakeW
     // fail to send the handshake ack, there is no reason to continue...
     if (SendAck())
     {
+        // Wait for any responses that might have been queued up in the remote
+        // GDB server and flush them all
+        StringExtractorGDBRemote response;
+        PacketResult packet_result = PacketResult::Success;
+        const uint32_t timeout_usec = 10 * 1000; // Wait for 10 ms for a response
+        while (packet_result == PacketResult::Success)
+            packet_result = WaitForPacketWithTimeoutMicroSecondsNoLock (response, timeout_usec);
+
         // The return value from QueryNoAckModeSupported() is true if the packet
         // was sent and _any_ response (including UNIMPLEMENTED) was received),
         // or false if no response was received. This quickly tells us if we have





More information about the lldb-commits mailing list