[Lldb-commits] [PATCH] D124535: [lldb] Fix crash when launching in terminal

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 28 14:39:51 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG9aa6a479738c: [lldb] Fix crash when launching in terminal (authored by JDevlieghere).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D124535?vs=425542&id=425910#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124535/new/

https://reviews.llvm.org/D124535

Files:
  lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
  lldb/unittests/Host/ConnectionFileDescriptorTest.cpp


Index: lldb/unittests/Host/ConnectionFileDescriptorTest.cpp
===================================================================
--- lldb/unittests/Host/ConnectionFileDescriptorTest.cpp
+++ lldb/unittests/Host/ConnectionFileDescriptorTest.cpp
@@ -23,13 +23,22 @@
     std::unique_ptr<TCPSocket> socket_a_up;
     std::unique_ptr<TCPSocket> socket_b_up;
     CreateTCPConnectedSockets(ip, &socket_a_up, &socket_b_up);
-    auto socket = socket_a_up.release();
+    auto *socket = socket_a_up.release();
     ConnectionFileDescriptor connection_file_descriptor(socket);
 
     std::string uri(connection_file_descriptor.GetURI());
     EXPECT_EQ((URI{"connect", ip, socket->GetRemotePortNumber(), "/"}),
               URI::Parse(uri).getValue());
   }
+
+  void TestConnect(std::string ip, std::string path) {
+    std::unique_ptr<TCPSocket> socket_a_up;
+    std::unique_ptr<TCPSocket> socket_b_up;
+    CreateTCPConnectedSockets(ip, &socket_a_up, &socket_b_up);
+    auto *socket = socket_a_up.release();
+    ConnectionFileDescriptor connection_file_descriptor(socket);
+    connection_file_descriptor.Connect(path, nullptr);
+  }
 };
 
 TEST_F(ConnectionFileDescriptorTest, TCPGetURIv4) {
@@ -43,3 +52,15 @@
     return;
   TestGetURI("::1");
 }
+
+TEST_F(ConnectionFileDescriptorTest, Connectv4) {
+  if (!HostSupportsIPv4())
+    return;
+  TestConnect("127.0.0.1", "accept://127.0.0.1");
+}
+
+TEST_F(ConnectionFileDescriptorTest, Connectv6) {
+  if (!HostSupportsIPv6())
+    return;
+  TestConnect("::1", "accept://::1");
+}
Index: lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
===================================================================
--- lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
+++ lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
@@ -122,7 +122,8 @@
 
 ConnectionStatus ConnectionFileDescriptor::Connect(llvm::StringRef path,
                                                    Status *error_ptr) {
-  return Connect(path, nullptr, error_ptr);
+  return Connect(
+      path, [](llvm::StringRef) {}, error_ptr);
 }
 
 ConnectionStatus


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124535.425910.patch
Type: text/x-patch
Size: 2091 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220428/3392b41c/attachment.bin>


More information about the lldb-commits mailing list