JDevlieghere created this revision.
JDevlieghere added reviewers: mgorny, labath.
Herald added a project: All.
JDevlieghere requested review of this revision.

This patch fixes a crash when using `process launch -t` to launch the inferior 
from a TTY. The issue is that on Darwin, Host.mm is calling 
`ConnectionFileDescriptor::Connect` without a `socket_id_callback_type`. The 
overload passes `nullptr` as the function ref, which gets called 
unconditionally as the `socket_id_callback`. One potential way to fix this is 
to change all the lambdas to include a null check, but instead I went with a 
NOOP.

The patch doesn't include a test even though it's trivial to write one. The 
reason is that we really don't want the test suite spawning (and leaving 
around) Terminal.app instances on every run.


https://reviews.llvm.org/D124535

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


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


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
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
  • [Lldb-commits] [PATCH] ... Jonas Devlieghere via Phabricator via lldb-commits

Reply via email to