Skip to content

[lldb] Extend information for failed connection for gdb server #139916

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 20, 2025

Conversation

ita-sc
Copy link
Contributor

@ita-sc ita-sc commented May 14, 2025

Before:

(lldb) r
error: connect remote failed (Failed to connect port)
error: Failed to connect port

After the patch:

(lldb) r
error: connect remote failed (Failed to connect localhost:47140)
error: Failed to connect localhost:47140

@ita-sc ita-sc requested a review from JDevlieghere as a code owner May 14, 2025 14:48
@llvmbot llvmbot added the lldb label May 14, 2025
@llvmbot
Copy link
Member

llvmbot commented May 14, 2025

@llvm/pr-subscribers-lldb

Author: None (ita-sc)

Changes

Before:

(lldb) r
error: connect remote failed (Failed to connect port)
error: Failed to connect port

After the patch:

(lldb) r
error: connect remote failed (Failed to connect localhost:47140)
error: Failed to connect localhost:47140

Full diff: https://github.com/llvm/llvm-project/pull/139916.diff

1 Files Affected:

  • (modified) lldb/source/Host/common/TCPSocket.cpp (+2-1)
diff --git a/lldb/source/Host/common/TCPSocket.cpp b/lldb/source/Host/common/TCPSocket.cpp
index d3282ab58b818..4148ad67b04bf 100644
--- a/lldb/source/Host/common/TCPSocket.cpp
+++ b/lldb/source/Host/common/TCPSocket.cpp
@@ -169,7 +169,8 @@ Status TCPSocket::Connect(llvm::StringRef name) {
     return error;
   }
 
-  error = Status::FromErrorString("Failed to connect port");
+  error = Status::FromErrorStringWithFormatv("Failed to connect {0}:{1}",
+                                  host_port->hostname, host_port->port);
   return error;
 }
 

Copy link

github-actions bot commented May 14, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@ita-sc ita-sc force-pushed the extend_error_info branch from 845a736 to 670b90b Compare May 14, 2025 15:03
Copy link
Member

@JDevlieghere JDevlieghere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo (pre-existing) typo.

Before:
```
(lldb) r
error: connect remote failed (Failed to connect port)
error: Failed to connect port
```

After the patch:
```
(lldb) r
error: connect remote failed (Failed to connect to localhost:47140)
error: Failed to connect to localhost:47140
```
@ita-sc ita-sc force-pushed the extend_error_info branch from 670b90b to 67ee27f Compare May 15, 2025 08:34
@ita-sc
Copy link
Contributor Author

ita-sc commented May 19, 2025

Thanks for review.
Could you please merge this? (I do not have write access yet)

@DavidSpickett DavidSpickett changed the title Extend information for failed connection for gdb server [lldb] Extend information for failed connection for gdb server May 20, 2025
@DavidSpickett DavidSpickett merged commit b3e15ba into llvm:main May 20, 2025
10 checks passed
sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Jun 3, 2025
…139916)

Before:
```
(lldb) r
error: connect remote failed (Failed to connect port)
error: Failed to connect port
```

After the patch:
```
(lldb) r
error: connect remote failed (Failed to connect localhost:47140)
error: Failed to connect localhost:47140
```
ajaden-codes pushed a commit to Jaddyen/llvm-project that referenced this pull request Jun 6, 2025
…139916)

Before:
```
(lldb) r
error: connect remote failed (Failed to connect port)
error: Failed to connect port
```

After the patch:
```
(lldb) r
error: connect remote failed (Failed to connect localhost:47140)
error: Failed to connect localhost:47140
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants