aboutsummaryrefslogtreecommitdiff
path: root/python/qemu
diff options
context:
space:
mode:
authorAlex Bennée <alex.bennee@linaro.org>2020-12-10 19:04:14 +0000
committerPaolo Bonzini <pbonzini@redhat.com>2021-01-02 21:03:09 +0100
commitafded359a6c413d5dab68b1b1c692d8efc196eaa (patch)
tree15a4b7dfca956ffe0ea50e199352d0f4f7ae3c74 /python/qemu
parentc87ea11631119175a581b17900ea62e127638352 (diff)
downloadqemu-afded359a6c413d5dab68b1b1c692d8efc196eaa.zip
qemu-afded359a6c413d5dab68b1b1c692d8efc196eaa.tar.gz
qemu-afded359a6c413d5dab68b1b1c692d8efc196eaa.tar.bz2
python: add __repr__ to ConsoleSocket to aid debugging
While attempting to debug some console weirdness I thought it would be worth making it easier to see what it had inside. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: John Snow <jsnow@redhat.com> Reviewed-by: Willian Rampazzo <willianr@redhat.com> Message-Id: <20201210190417.31673-6-alex.bennee@linaro.org>
Diffstat (limited to 'python/qemu')
-rw-r--r--python/qemu/console_socket.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/python/qemu/console_socket.py b/python/qemu/console_socket.py
index f060d79..ac21130 100644
--- a/python/qemu/console_socket.py
+++ b/python/qemu/console_socket.py
@@ -45,6 +45,13 @@ class ConsoleSocket(socket.socket):
if drain:
self._drain_thread = self._thread_start()
+ def __repr__(self) -> str:
+ s = super().__repr__()
+ s = s.rstrip(">")
+ s = "%s, logfile=%s, drain_thread=%s>" % (s, self._logfile,
+ self._drain_thread)
+ return s
+
def _drain_fn(self) -> None:
"""Drains the socket and runs while the socket is open."""
while self._open: