Skip to content

Commit 3e2d2ba

Browse files
committed
[lldb] Add type hints to gdbclientutils.py and fix issues
Everything in this should be python 3.9. The docs say the minimum is 3.8 but there's existing code in this suite that needs 3.9 so I think 3.9 is ok. Issues: qEcho() is passed an argument by the callers that the function didn't have Several functions in the base class would silently do nothing if not overriden. These now use @AbstractMethod to require overrides sendall() had inconsistent return types between overrides
1 parent 62f9115 commit 3e2d2ba

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lldb/packages/Python/lldbsuite/test/gdbclientutils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import socket
77
import traceback
88
from lldbsuite.support import seven
9-
from typing import Optional, List, Tuple
9+
from typing import Optional, List, Tuple, Literal
1010

1111

1212
def checksum(message):
@@ -520,10 +520,12 @@ class MockGDBServer:
520520
_receivedData = None
521521
_receivedDataOffset = None
522522
_shouldSendAck = True
523+
packetLog: list[tuple[Literal["recv"] | Literal["send"], str | bytes]]
523524

524525
def __init__(self, socket):
525526
self._socket = socket
526527
self.responder = MockGDBServerResponder()
528+
self.packetLog = []
527529

528530
def start(self):
529531
# Start a thread that waits for a client connection.
@@ -650,11 +652,13 @@ def _parsePacket(self):
650652
# can start on the next packet the next time around
651653
self._receivedData = data[i:]
652654
self._receivedDataOffset = 0
655+
self.packetLog.append(("recv", packet))
653656
return packet
654657

655658
def _sendPacket(self, packet: str):
656659
assert self._socket is not None
657660
framed_packet = seven.bitcast_to_bytes(frame_packet(packet))
661+
self.packetLog.append(("send", framed_packet))
658662
self._socket.sendall(framed_packet)
659663

660664
def _handlePacket(self, packet):

0 commit comments

Comments
 (0)