[Lldb-commits] [lldb] [lldb] Fix broken pipe error (PR #127100)

Georgiy Samoylov via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 14 04:53:34 PST 2025


https://github.com/sga-sc updated https://github.com/llvm/llvm-project/pull/127100

>From 1fdc2f811c239bc8992fba9aa8e3d4eb9c76e96a Mon Sep 17 00:00:00 2001
From: Georgiy Samoylov <g.samoylov at syntacore.com>
Date: Thu, 6 Feb 2025 13:23:13 +0300
Subject: [PATCH 1/2] [lldb] Fixed a typo

---
 .../test/tools/lldb-server/gdbremote_testcase.py          | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
index cbe430c92fa7f..cf94bf08a5bce 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
@@ -397,13 +397,13 @@ def connect_to_debug_monitor(self, attach_pid=None):
             # Schedule debug monitor to be shut down during teardown.
             logger = self.logger
 
-            connect_attemps = 0
+            connect_attempts = 0
             MAX_CONNECT_ATTEMPTS = 10
 
-            while connect_attemps < MAX_CONNECT_ATTEMPTS:
+            while connect_attempts < MAX_CONNECT_ATTEMPTS:
                 # Create a socket to talk to the server
                 try:
-                    logger.info("Connect attempt %d", connect_attemps + 1)
+                    logger.info("Connect attempt %d", connect_attempts + 1)
                     self.sock = self.create_socket()
                     self._server = Server(self.sock, server)
                     return server
@@ -411,7 +411,7 @@ def connect_to_debug_monitor(self, attach_pid=None):
                     # Ignore, and try again.
                     pass
                 time.sleep(0.5)
-                connect_attemps += 1
+                connect_attempts += 1
 
             # We should close the server here to be safe.
             server.terminate()

>From 9aab5677f83b826b796c3884c4c09364b27a38f2 Mon Sep 17 00:00:00 2001
From: Georgiy Samoylov <g.samoylov at syntacore.com>
Date: Fri, 14 Feb 2025 15:53:04 +0300
Subject: [PATCH 2/2] [lldb] Made socket verification process more generic

---
 .../lldbsuite/test/tools/lldb-server/gdbremote_testcase.py | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
index cf94bf08a5bce..fb96b3d4de560 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
@@ -249,14 +249,11 @@ def remove_port_forward():
 
     def _verify_socket(self, sock):
         # Normally, when the remote stub is not ready, we will get ECONNREFUSED during the
-        # connect() attempt. However, due to the way how ADB forwarding works, on android targets
+        # connect() attempt. However, due to the way how port forwarding can work, on some targets
         # the connect() will always be successful, but the connection will be immediately dropped
-        # if ADB could not connect on the remote side. This function tries to detect this
+        # if we could not connect on the remote side. This function tries to detect this
         # situation, and report it as "connection refused" so that the upper layers attempt the
         # connection again.
-        triple = self.dbg.GetSelectedPlatform().GetTriple()
-        if not re.match(".*-.*-.*-android", triple):
-            return  # Not android.
         can_read, _, _ = select.select([sock], [], [], 0.1)
         if sock not in can_read:
             return  # Data is not available, but the connection is alive.



More information about the lldb-commits mailing list