diff options
author | Vedant Kumar <vsk@apple.com> | 2019-10-18 21:05:30 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2019-10-18 21:05:30 +0000 |
commit | 32ce14e55e5a99dd99c3b4fd4bd0ccaaf2948c30 (patch) | |
tree | 96db1514a1898bf521d81c6fe8d0bc591a5d8ee3 /lldb | |
parent | 52d765544b50d2260cf4858ed63c827880b987df (diff) | |
download | bcm5719-llvm-32ce14e55e5a99dd99c3b4fd4bd0ccaaf2948c30.tar.gz bcm5719-llvm-32ce14e55e5a99dd99c3b4fd4bd0ccaaf2948c30.zip |
Disable exit-on-SIGPIPE in lldb
Occasionally, during test teardown, LLDB writes to a closed pipe.
Sometimes the communication is inherently unreliable, so LLDB tries to
avoid being killed due to SIGPIPE (it calls `signal(SIGPIPE, SIG_IGN)`).
However, LLVM's default SIGPIPE behavior overrides LLDB's, causing it to
exit with IO_ERR.
Opt LLDB out of the default SIGPIPE behavior. I expect that this will
resolve some LLDB test suite flakiness (tests randomly failing with
IO_ERR) that we've seen since r344372.
rdar://55750240
Differential Revision: https://reviews.llvm.org/D69148
llvm-svn: 375288
Diffstat (limited to 'lldb')
-rw-r--r-- | lldb/tools/driver/Driver.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp index 4a403a7ffb4..6ab2bd93659 100644 --- a/lldb/tools/driver/Driver.cpp +++ b/lldb/tools/driver/Driver.cpp @@ -853,6 +853,16 @@ int main(int argc, char const *argv[]) signal(SIGCONT, sigcont_handler); #endif + // Occasionally, during test teardown, LLDB writes to a closed pipe. + // Sometimes the communication is inherently unreliable, so LLDB tries to + // avoid being killed due to SIGPIPE. However, LLVM's default SIGPIPE behavior + // is to exit with IO_ERR. Opt LLDB out of that. + // + // We don't disable LLVM's signal handling entirely because we still want + // pretty stack traces, and file cleanup (for when, say, the clang embedded + // in LLDB leaves behind temporary objects). + llvm::sys::SetPipeSignalFunction(nullptr); + int exit_code = 0; // Create a scope for driver so that the driver object will destroy itself // before SBDebugger::Terminate() is called. |