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

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 27 09:40:19 PDT 2022


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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124535.425542.patch
Type: text/x-patch
Size: 559 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220427/cbaf6ca2/attachment.bin>


More information about the lldb-commits mailing list