[Lldb-commits] [lldb] r323953 - mock_gdb_server: rectify ack handling code

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 1 03:29:07 PST 2018


Author: labath
Date: Thu Feb  1 03:29:06 2018
New Revision: 323953

URL: http://llvm.org/viewvc/llvm-project?rev=323953&view=rev
Log:
mock_gdb_server: rectify ack handling code

The mock server was sending acks back in response to spurious acks from
the client, but the client was not prepared to handle these. Most of the
time this would work because the only time the client was sending
unsolicited acks is after the initial connection, and there reply-ack
would get ignored in the "flush all packets from the server" loop which
came after the ack. However, this loop had only a 10ms delay, and
sometimes this was not enough to catch the reply (which meant the
connection got out of sync, and test failed).

Since this behavior not consistent with how lldb-server handles this
situation (it just ignores the ack), I fix the mock server to do the
same.

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py?rev=323953&r1=323952&r2=323953&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py Thu Feb  1 03:29:06 2018
@@ -200,7 +200,6 @@ class MockGDBServer:
     _receivedData = None
     _receivedDataOffset = None
     _shouldSendAck = True
-    _isExpectingAck = False
 
     def __init__(self, port = 0):
         self.responder = MockGDBServerResponder()
@@ -237,7 +236,6 @@ class MockGDBServer:
         except:
             return
         self._shouldSendAck = True
-        self._isExpectingAck = False
         self._receivedData = ""
         self._receivedDataOffset = 0
         data = None
@@ -329,21 +327,15 @@ class MockGDBServer:
 
     def _handlePacket(self, packet):
         if packet is self.PACKET_ACK:
-            # If we are expecting an ack, we'll just ignore it because there's
-            # nothing else we're supposed to do.
-            #
-            # However, if we aren't expecting an ack, it's likely the initial
-            # ack that lldb client sends, and observations of real servers
-            # suggest we're supposed to ack back.
-            if not self._isExpectingAck:
-                self._client.sendall('+')
+            # Ignore ACKs from the client. For the future, we can consider
+            # adding validation code to make sure the client only sends ACKs
+            # when it's supposed to.
             return
         response = ""
         # We'll handle the ack stuff here since it's not something any of the
         # tests will be concerned about, and it'll get turned off quicly anyway.
         if self._shouldSendAck:
             self._client.sendall('+')
-            self._isExpectingAck = True
         if packet == "QStartNoAckMode":
             self._shouldSendAck = False
             response = "OK"




More information about the lldb-commits mailing list