diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-01-19 10:06:29 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-01-19 10:06:29 +0000 |
commit | 94994d372d014ce4c8758b9605d63fae651bd8aa (patch) | |
tree | 51c0b708bd59f205d6b35cb2a8c24d62f0c33d77 /unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp | |
parent | 39be7ce23363d12ae3e49aeb1fdb2bfeb892e836 (diff) |
Notes
Diffstat (limited to 'unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp')
-rw-r--r-- | unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp | 37 |
1 files changed, 4 insertions, 33 deletions
diff --git a/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp b/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp index 2acf72744d20..9a9d8a3be471 100644 --- a/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp +++ b/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp @@ -9,10 +9,10 @@ #include "GDBRemoteTestUtils.h" -#include "lldb/Host/common/TCPSocket.h" -#include "lldb/Host/posix/ConnectionFileDescriptorPosix.h" - -#include <future> +#if defined(_MSC_VER) +#include "lldb/Host/windows/windows.h" +#include <WinSock2.h> +#endif namespace lldb_private { namespace process_gdb_remote { @@ -30,34 +30,5 @@ void GDBRemoteTest::TearDownTestCase() { #endif } -llvm::Error GDBRemoteTest::Connect(GDBRemoteCommunication &client, - GDBRemoteCommunication &server) { - bool child_processes_inherit = false; - TCPSocket listen_socket(true, child_processes_inherit); - if (llvm::Error error = listen_socket.Listen("127.0.0.1:0", 5).ToError()) - return error; - - Socket *accept_socket; - std::future<Status> accept_status = std::async( - std::launch::async, [&] { return listen_socket.Accept(accept_socket); }); - - llvm::SmallString<32> remote_addr; - llvm::raw_svector_ostream(remote_addr) - << "connect://localhost:" << listen_socket.GetLocalPortNumber(); - - std::unique_ptr<ConnectionFileDescriptor> conn_up( - new ConnectionFileDescriptor()); - if (conn_up->Connect(remote_addr, nullptr) != lldb::eConnectionStatusSuccess) - return llvm::make_error<llvm::StringError>("Unable to connect", - llvm::inconvertibleErrorCode()); - - client.SetConnection(conn_up.release()); - if (llvm::Error error = accept_status.get().ToError()) - return error; - - server.SetConnection(new ConnectionFileDescriptor(accept_socket)); - return llvm::Error::success(); -} - } // namespace process_gdb_remote } // namespace lldb_private |