aboutsummaryrefslogtreecommitdiff
path: root/lldb/packages/Python/lldbsuite/test/gdbclientutils.py
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2021-11-18 13:52:44 +0100
committerPavel Labath <pavel@labath.sk>2021-11-22 15:14:50 +0100
commit7c8ae65f2c3d5c1a6aba2f7ee7588f9f76f94f84 (patch)
treef0c6046fca8c8e27677190f91a7a54d8fa063bde /lldb/packages/Python/lldbsuite/test/gdbclientutils.py
parent247a1a55eb6a58199006565d594c6f6c6b58b736 (diff)
downloadllvm-7c8ae65f2c3d5c1a6aba2f7ee7588f9f76f94f84.zip
llvm-7c8ae65f2c3d5c1a6aba2f7ee7588f9f76f94f84.tar.gz
llvm-7c8ae65f2c3d5c1a6aba2f7ee7588f9f76f94f84.tar.bz2
[lldb/test] Make it possible to run the mock gdb server on a single thread
This is a preparatory commit to enable mocking of qemu startup. That will involve running the mock server in a separate process, so there's no need for multithreading. Initialization is moved from the start function into the constructor (which can then take an actual socket instead of a class), and the run method is made public. Depends on D114156. Differential Revision: https://reviews.llvm.org/D114157
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/gdbclientutils.py')
-rw-r--r--lldb/packages/Python/lldbsuite/test/gdbclientutils.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/gdbclientutils.py b/lldb/packages/Python/lldbsuite/test/gdbclientutils.py
index 7fdf18e..6b4650e 100644
--- a/lldb/packages/Python/lldbsuite/test/gdbclientutils.py
+++ b/lldb/packages/Python/lldbsuite/test/gdbclientutils.py
@@ -461,18 +461,16 @@ class MockGDBServer:
_receivedDataOffset = None
_shouldSendAck = True
- def __init__(self, socket_class):
- self._socket_class = socket_class
+ def __init__(self, socket):
+ self._socket = socket
self.responder = MockGDBServerResponder()
def start(self):
- self._socket = self._socket_class()
# Start a thread that waits for a client connection.
- self._thread = threading.Thread(target=self._run)
+ self._thread = threading.Thread(target=self.run)
self._thread.start()
def stop(self):
- self._socket.close_server()
self._thread.join()
self._thread = None
@@ -482,7 +480,7 @@ class MockGDBServer:
def get_connect_url(self):
return self._socket.get_connect_url()
- def _run(self):
+ def run(self):
# For testing purposes, we only need to worry about one client
# connecting just one time.
try: