This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Fix crash when launching in terminal
ClosedPublic

Authored by JDevlieghere on Apr 27 2022, 9:40 AM.

Details

Summary

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.

Diff Detail

Event Timeline

JDevlieghere created this revision.Apr 27 2022, 9:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 27 2022, 9:40 AM
JDevlieghere requested review of this revision.Apr 27 2022, 9:40 AM
labath accepted this revision.Apr 28 2022, 1:23 AM

One could add a unit test for the CFD overload, though, as this appears to be the only callsite (or other callsites were equally untested and broken), we could also remove it altogether.

This revision is now accepted and ready to land.Apr 28 2022, 1:23 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptApr 28 2022, 2:39 PM