[Lldb-commits] [lldb] Fixing FindUnusedPort method tcp_socket object creation with proper constructor parameter (PR #121879)
Sad Al Abdullah via lldb-commits
lldb-commits at lists.llvm.org
Mon Jan 6 19:04:23 PST 2025
https://github.com/SiamAbdullah created https://github.com/llvm/llvm-project/pull/121879
### Issue:
Currently lldb `platform connect unix-connect://localhost:43045/` is failing and showing "Failed to connect port" error message.
![IMG_2492](https://github.com/user-attachments/assets/816931e2-8b06-427e-b11a-39b813094e36)
### Cause:
TCPSocket(bool should_close, bool child_processes_inherit) constructor was removed in commit [c1dff71](https://github.com/llvm/llvm-project/commit/c1dff7152592f1beee9059ee8e2cb3cc68baea4d#diff-91817651b505a466ea94ddc44eca856f62073e03b05d0d0d2f4a55dcfea0002eL20). However, the tcp_socket object creation still passes the deleted constructor parameters, which causes the invocation of the wrong constructor. As a result, the `FindUnusedPort` method is unable to resolve the local port and always returns 0.
>From 3e60e4fcbbe560ac147662f0dba0f0984dfd2a9d Mon Sep 17 00:00:00 2001
From: Sad Al Abdullah <siam9090 at gmail.com>
Date: Mon, 6 Jan 2025 18:56:17 -0800
Subject: [PATCH] Fixing FindUnusedPort method tcp_socket object with proper
constructor parameter
TCPSocket(bool should_close, bool child_processes_inherit) constructor was removed in commit c1dff71. However, the tcp_socket object creation still passes the deleted constructor parameters, which causes the invocation of the wrong constructor. As a result, the FindUnusedPort method is unable to resolve the local port and always returns 0.
---
.../Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
index d18b718d4a56cf..0cf64807ec0d64 100644
--- a/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
+++ b/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
@@ -64,7 +64,7 @@ static Status DeleteForwardPortWithAdb(uint16_t local_port,
static Status FindUnusedPort(uint16_t &port) {
Status error;
- std::unique_ptr<TCPSocket> tcp_socket(new TCPSocket(true, false));
+ std::unique_ptr<TCPSocket> tcp_socket(new TCPSocket(true));
if (error.Fail())
return error;
More information about the lldb-commits
mailing list