qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] python: add __repr__ to ConsoleSocket to aid debugging
@ 2020-12-07 20:07 Alex Bennée
  2020-12-07 21:02 ` John Snow
  2020-12-07 21:35 ` Willian Rampazzo
  0 siblings, 2 replies; 6+ messages in thread
From: Alex Bennée @ 2020-12-07 20:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: John Snow, Alex Bennée, Eduardo Habkost, Cleber Rosa

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>
---
 python/qemu/console_socket.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/python/qemu/console_socket.py b/python/qemu/console_socket.py
index f060d79e06..77966d1fe9 100644
--- a/python/qemu/console_socket.py
+++ b/python/qemu/console_socket.py
@@ -45,6 +45,14 @@ class ConsoleSocket(socket.socket):
         if drain:
             self._drain_thread = self._thread_start()
 
+    def __repr__(self):
+        s = super(ConsoleSocket, self).__repr__()
+        s = s.rstrip(">")
+        s += ", logfile=%s" % (self._logfile)
+        s += ", drain_thread=%s" % (self._drain_thread)
+        s += ">"
+        return s
+
     def _drain_fn(self) -> None:
         """Drains the socket and runs while the socket is open."""
         while self._open:
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-12-08 15:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-07 20:07 [RFC PATCH] python: add __repr__ to ConsoleSocket to aid debugging Alex Bennée
2020-12-07 21:02 ` John Snow
2020-12-07 21:35 ` Willian Rampazzo
2020-12-07 22:14   ` Philippe Mathieu-Daudé
2020-12-07 23:14     ` Willian Rampazzo
2020-12-08 15:09   ` John Snow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).