aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Unix/Signals.inc
diff options
context:
space:
mode:
authorAlexandre Ganea <alexandre.ganea@ubisoft.com>2020-09-24 08:14:45 -0400
committerAlexandre Ganea <alexandre.ganea@ubisoft.com>2020-09-24 08:21:43 -0400
commitf5314d15af4f4514103ea12c74cb208538b8bef5 (patch)
tree446c418e4b8034d031609091307c9e72b4738264 /llvm/lib/Support/Unix/Signals.inc
parentb3418cb4eb1456c41606f4621dcfa362fe54183c (diff)
downloadllvm-f5314d15af4f4514103ea12c74cb208538b8bef5.zip
llvm-f5314d15af4f4514103ea12c74cb208538b8bef5.tar.gz
llvm-f5314d15af4f4514103ea12c74cb208538b8bef5.tar.bz2
[Support] On Unix, let the CrashRecoveryContext return the signal code
Before this patch, the CrashRecoveryContext was returning -2 upon a signal, like ExecuteAndWait does. This didn't match the behavior on Windows, where the the exception code was returned. We now return the signal's code, which optionally allows for re-throwing the signal later. Doing so requires all custom handlers to be removed first, through llvm::sys::unregisterHandlers() which we made a public API. This is part of https://reviews.llvm.org/D70378
Diffstat (limited to 'llvm/lib/Support/Unix/Signals.inc')
-rw-r--r--llvm/lib/Support/Unix/Signals.inc4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Support/Unix/Signals.inc b/llvm/lib/Support/Unix/Signals.inc
index 50b2ad4..03181a7 100644
--- a/llvm/lib/Support/Unix/Signals.inc
+++ b/llvm/lib/Support/Unix/Signals.inc
@@ -331,7 +331,7 @@ static void RegisterHandlers() { // Not signal-safe.
registerHandler(S, SignalKind::IsInfo);
}
-static void UnregisterHandlers() {
+void sys::unregisterHandlers() {
// Restore all of the signal handlers to how they were before we showed up.
for (unsigned i = 0, e = NumRegisteredSignals.load(); i != e; ++i) {
sigaction(RegisteredSignalInfo[i].SigNo,
@@ -367,7 +367,7 @@ static RETSIGTYPE SignalHandler(int Sig) {
// crashes when we return and the signal reissues. This also ensures that if
// we crash in our signal handler that the program will terminate immediately
// instead of recursing in the signal handler.
- UnregisterHandlers();
+ sys::unregisterHandlers();
// Unmask all potentially blocked kill signals.
sigset_t SigMask;