Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit 5374d54

Browse files
committedOct 18, 2019
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 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@375288 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 20c7cd6 commit 5374d54

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
 

‎tools/driver/Driver.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,16 @@ int main(int argc, char const *argv[])
853853
signal(SIGCONT, sigcont_handler);
854854
#endif
855855

856+
// Occasionally, during test teardown, LLDB writes to a closed pipe.
857+
// Sometimes the communication is inherently unreliable, so LLDB tries to
858+
// avoid being killed due to SIGPIPE. However, LLVM's default SIGPIPE behavior
859+
// is to exit with IO_ERR. Opt LLDB out of that.
860+
//
861+
// We don't disable LLVM's signal handling entirely because we still want
862+
// pretty stack traces, and file cleanup (for when, say, the clang embedded
863+
// in LLDB leaves behind temporary objects).
864+
llvm::sys::SetPipeSignalFunction(nullptr);
865+
856866
int exit_code = 0;
857867
// Create a scope for driver so that the driver object will destroy itself
858868
// before SBDebugger::Terminate() is called.

0 commit comments

Comments
 (0)
This repository has been archived.