================
@@ -195,18 +195,31 @@ void ConnectToRemote(MainLoop &mainloop,
bool reverse_connect, llvm::StringRef host_and_port,
const char *const progname, const char *const subcommand,
const char *const named_pipe_path, pipe_t unnamed_pipe,
- int connection_fd) {
+ shared_fd_t connection_fd) {
Status error;
std::unique_ptr<Connection> connection_up;
std::string url;
- if (connection_fd != -1) {
+ if (connection_fd != SharedSocket::kInvalidFD) {
+#ifdef _WIN32
+ NativeSocket sockfd;
+ error = SharedSocket::GetNativeSocket(connection_fd, sockfd);
+ if (error.Fail()) {
+ llvm::errs() << llvm::formatv("error: GetNativeSocket failed: {0}\n",
+ error.AsCString());
+ exit(-1);
+ }
+ connection_up =
+ std::unique_ptr<Connection>(new ConnectionFileDescriptor(new TCPSocket(
+ sockfd, /*should_close=*/true,
/*child_processes_inherit=*/false)));
+#else
url = llvm::formatv("fd://{0}", connection_fd).str();
// Create the connection.
-#if LLDB_ENABLE_POSIX && !defined _WIN32
+#if LLDB_ENABLE_POSIX
----------------
slydiman wrote:
`!defined _WIN32` is redunded here because this block is inside the another
#ifdef now:
```
#ifdef _WIN32
...
#else
// no need to check !defined _WIN32 here
#endif
```
https://github.com/llvm/llvm-project/pull/104238
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits