Author: Pavel Labath Date: 2021-11-25T12:33:23+01:00 New Revision: a6fedbf20c8f87061f333169120790e2c6f22806
URL: https://github.com/llvm/llvm-project/commit/a6fedbf20c8f87061f333169120790e2c6f22806 DIFF: https://github.com/llvm/llvm-project/commit/a6fedbf20c8f87061f333169120790e2c6f22806.diff LOG: [lldb/gdb-remote] Remove initial pipe-draining workaround This code, added in rL197579 (Dec 2013) is supposed to work around what was presumably a qemu bug, where it would send unsolicited stop-reply packets after the initial connection. At present, qemu does not exhibit such behavior. Also, the 10ms delay introduced by this code is sufficient to mask bugs in other stubs, but it is not sufficient to *reliably* mask those bugs. This resulted in flakyness in one of our stubs, which was (incorrectly) sending a + packet at the start of the connection, resulting in a small-but-annoying number of dropped connections. Differential Revision: https://reviews.llvm.org/D114529 Added: Modified: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Removed: ################################################################################ diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index 78e722eee080d..07dfa5e04ee57 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -86,13 +86,6 @@ bool GDBRemoteCommunicationClient::HandshakeWithServer(Status *error_ptr) { std::chrono::steady_clock::time_point start_of_handshake = std::chrono::steady_clock::now(); 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 @@ -106,17 +99,15 @@ bool GDBRemoteCommunicationClient::HandshakeWithServer(Status *error_ptr) { std::chrono::duration<double>(end_of_handshake - start_of_handshake) .count(); if (error_ptr) { - if (packet_result == PacketResult::ErrorDisconnected) + if (!IsConnected()) error_ptr->SetErrorString("Connection shut down by remote side " "while waiting for reply to initial " "handshake packet"); - else if (packet_result == PacketResult::ErrorReplyTimeout) + else error_ptr->SetErrorStringWithFormat( "failed to get reply to handshake packet within timeout of " "%.1f seconds", handshake_timeout); - else - error_ptr->SetErrorString("failed to get reply to handshake packet"); } } } else { _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits