From a45ca18ff8160bc3edc584d6516ca019dd6c6275 Mon Sep 17 00:00:00 2001
From: Oz Linden <oz@lindenlab.com>
Date: Wed, 25 Sep 2019 12:59:20 -0400
Subject: [PATCH] when using bugsplat, do not catch SIGABRT; also, fix signal
 setting in Mac (broken macro)

---
 indra/llcommon/llapp.cpp            | 5 +++++
 indra/newview/llappviewer.cpp       | 2 +-
 indra/newview/llappviewermacosx.cpp | 9 +++++----
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp
index 34c969437b7..27960371f15 100644
--- a/indra/llcommon/llapp.cpp
+++ b/indra/llcommon/llapp.cpp
@@ -779,7 +779,9 @@ void setup_signals()
 	act.sa_flags = SA_SIGINFO;
 
 	// Synchronous signals
+#   ifndef LL_BUGSPLAT
 	sigaction(SIGABRT, &act, NULL);
+#   endif
 	sigaction(SIGALRM, &act, NULL);
 	sigaction(SIGBUS, &act, NULL);
 	sigaction(SIGFPE, &act, NULL);
@@ -816,7 +818,9 @@ void clear_signals()
 	act.sa_flags = SA_SIGINFO;
 
 	// Synchronous signals
+#   ifndef LL_BUGSPLAT
 	sigaction(SIGABRT, &act, NULL);
+#   endif
 	sigaction(SIGALRM, &act, NULL);
 	sigaction(SIGBUS, &act, NULL);
 	sigaction(SIGFPE, &act, NULL);
@@ -869,6 +873,7 @@ void default_unix_signal_handler(int signum, siginfo_t *info, void *)
 
 		return;
 	case SIGABRT:
+        // Note that this handler is not set for SIGABRT when using Bugsplat
 		// Abort just results in termination of the app, no funky error handling.
 		if (LLApp::sLogInSignal)
 		{
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 9258d1a219d..8009a9c1176 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -2231,8 +2231,8 @@ void LLAppViewer::initLoggingAndGetLastDuration()
 	}
 
     // TBD - temporary location for fatal hook (should be above, but for now it logs...)
+    LL_DEBUGS("FatalHook") << "initial setting of default fatalhook" << LL_ENDL;
     LLError::setFatalHook(fatalErrorHook);
-
 }
 
 bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key,
diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp
index 4a519b944ba..efa1da054c8 100644
--- a/indra/newview/llappviewermacosx.cpp
+++ b/indra/newview/llappviewermacosx.cpp
@@ -333,11 +333,12 @@ bool LLAppViewerMacOSX::restoreErrorTrap()
 	
 	unsigned int reset_count = 0;
 	
-#define SET_SIG(S) 	sigaction(SIGABRT, &act, &old_act); \
-					if(act.sa_sigaction != old_act.sa_sigaction) \
-						++reset_count;
+#define SET_SIG(SIGNAL) sigaction(SIGNAL, &act, &old_act); \
+                        if(act.sa_sigaction != old_act.sa_sigaction) ++reset_count;
 	// Synchronous signals
-	SET_SIG(SIGABRT)
+#   ifndef LL_BUGSPLAT
+	SET_SIG(SIGABRT) // let bugsplat catch this
+#   endif        
 	SET_SIG(SIGALRM)
 	SET_SIG(SIGBUS)
 	SET_SIG(SIGFPE)
-- 
GitLab