Revert "[GDBRemote] Remove code that flushes GDB remote packets"
authorJonas Devlieghere <jonas@devlieghere.com>
Sun, 30 Jun 2019 19:00:09 +0000 (19:00 +0000)
committerJonas Devlieghere <jonas@devlieghere.com>
Sun, 30 Jun 2019 19:00:09 +0000 (19:00 +0000)
Reverting this again as it doesn't appear to solve the flakiness on the
LLDB standalone bot.

llvm-svn: 364722

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp

index 0d6b45a..9797184 100644 (file)
@@ -115,6 +115,13 @@ bool GDBRemoteCommunicationClient::HandshakeWithServer(Status *error_ptr) {
   // Start the read thread after we send the handshake ack since if we 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;
+    while (packet_result == PacketResult::Success)
+      packet_result = ReadPacket(response, milliseconds(10), false);
+
     // 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 a