This is an archive of the discontinued LLVM Phabricator instance.

[Driver] Force llvm to install its handlers before lldb's
ClosedPublic

Authored by vsk on Oct 24 2019, 1:22 PM.

Details

Summary

Install llvm's signal handlers up front to prevent lldb's handlers from being
ignored. This is (hopefully) a stopgap workaround.

When lldb invokes an llvm API that installs signal handlers (e.g.
llvm::sys::RemoveFileOnSignal, possibly via a compiler embedded within lldb),
lldb's signal handlers are overriden if llvm is installing its handlers for the
first time.

To work around llvm's behavior, force it to install its handlers up front, and
*then* install lldb's handlers. In practice this is used to prevent lldb test
processes from exiting due to IO_ERR when SIGPIPE is received.

Note that when llvm installs its handlers, it 1) records the old handlers it
replaces and 2) re-installs the old handlers when its new handler is invoked.
That means that a signal not explicitly handled by lldb can fall back to being
handled by llvm's handler the first time it is received, and then by the
default handler the second time it is received.

Diff Detail

Event Timeline

vsk created this revision.Oct 24 2019, 1:22 PM
labath accepted this revision.Oct 24 2019, 2:00 PM

Not ideal, but better than adding a new llvm api, which doesn't even really do what we want.

This revision is now accepted and ready to land.Oct 24 2019, 2:00 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptOct 25 2019, 11:21 AM