summaryrefslogtreecommitdiffstats
path: root/lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp
diff options
context:
space:
mode:
authorChris Bieneman <beanz@apple.com>2017-04-18 20:01:52 +0000
committerChris Bieneman <beanz@apple.com>2017-04-18 20:01:52 +0000
commit31e7c5e89f2f3a1617a0aca6aa9935192ffc74b9 (patch)
treecd0043f46d70d05910f8e08af7e485c95c042efb /lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp
parent0a40d67b209e496cf20ad09ea4c11aff80fb8b98 (diff)
downloadbcm5719-llvm-31e7c5e89f2f3a1617a0aca6aa9935192ffc74b9.tar.gz
bcm5719-llvm-31e7c5e89f2f3a1617a0aca6aa9935192ffc74b9.zip
Update LLDB Host to support IPv6 over TCP
Summary: This patch adds IPv6 support to LLDB/Host's TCP socket implementation. Supporting IPv6 involved a few significant changes to the implementation of the socket layers, and I have performed some significant code cleanup along the way. This patch changes the Socket constructors for all types of sockets to not create sockets until first use. This is required for IPv6 support because the socket type will vary based on the address you are connecting to. This also has the benefit of removing code that could have errors from the Socket subclass constructors (which seems like a win to me). The patch also slightly changes the API and behaviors of the Listen/Accept pattern. Previously both Listen and Accept calls took an address specified as a string. Now only listen does. This change was made because the Listen call can result in opening more than one socket. In order to support listening for both IPv4 and IPv6 connections we need to open one AF_INET socket and one AF_INET6 socket. During the listen call we construct a map of file descriptors to addrin structures which represent the allowable incoming connection address. This map removes the need for taking an address into the Accept call. This does have a change in functionality. Previously you could Listen for connections based on one address, and Accept connections from a different address. This is no longer supported. I could not find anywhere in LLDB where we actually used the APIs in that way. The new API does still support AnyAddr for allowing incoming connections from any address. The Listen implementation is implemented using kqueue on FreeBSD and Darwin, WSAPoll on Windows and poll(2) everywhere else. Reviewers: zturner, clayborg Subscribers: jasonmolenda, labath, lldb-commits, emaste Differential Revision: https://reviews.llvm.org/D31823 llvm-svn: 300579
Diffstat (limited to 'lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp')
-rw-r--r--lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp
index 08501f50f65..6440e814efd 100644
--- a/lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp
+++ b/lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp
@@ -33,15 +33,14 @@ void GDBRemoteTest::TearDownTestCase() {
void Connect(GDBRemoteCommunication &client, GDBRemoteCommunication &server) {
bool child_processes_inherit = false;
Error error;
- TCPSocket listen_socket(child_processes_inherit, error);
+ TCPSocket listen_socket(true, child_processes_inherit);
ASSERT_FALSE(error.Fail());
error = listen_socket.Listen("127.0.0.1:0", 5);
ASSERT_FALSE(error.Fail());
Socket *accept_socket;
std::future<Error> accept_error = std::async(std::launch::async, [&] {
- return listen_socket.Accept("127.0.0.1:0", child_processes_inherit,
- accept_socket);
+ return listen_socket.Accept(accept_socket);
});
char connect_remote_address[64];
OpenPOWER on IntegriCloud