From 83ec9ebfbd602771dbc45c08fe203044b5ce3527 Mon Sep 17 00:00:00 2001
From: Oz Linden <oz@lindenlab.com>
Date: Tue, 24 Sep 2019 10:15:20 -0400
Subject: [PATCH] log calls that modify the fatal error hook

---
 indra/llcommon/llerror.cpp            |  2 ++
 indra/llcommon/tests/llerror_test.cpp | 17 ++++++++++-------
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index 5f3edf7f844..da68117ff54 100644
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -723,11 +723,13 @@ namespace LLError
 	{
 		SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig();
 		s->mFatalHook = fatal_hook;
+        LL_DEBUGS("FatalHook") << "set fatal hook to " << fatal_hook << LL_ENDL;
 	}
 
 	FatalHook getFatalHook()
 	{
 		SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig();
+        LL_DEBUGS("FatalHook") << "read fatal hook " << s->mFatalHook << LL_ENDL;
 		return s->mFatalHook;
 	}
 
diff --git a/indra/llcommon/tests/llerror_test.cpp b/indra/llcommon/tests/llerror_test.cpp
index 9895abc1f3e..cdc2bf8c876 100644
--- a/indra/llcommon/tests/llerror_test.cpp
+++ b/indra/llcommon/tests/llerror_test.cpp
@@ -781,30 +781,33 @@ namespace tut
 		// proper cached, efficient lookup of filtering
 	void ErrorTestObject::test<15>()
 	{
-		LLError::setDefaultLevel(LLError::LEVEL_NONE);
+		LLError::setDefaultLevel(LLError::LEVEL_NONE); 
+
+        // Note that the setFatalHook in the ErrorTestData constructor
+        // increments the shouldLogCallCount
 
 		TestAlpha::doInfo();
 		ensure_message_count(0);
-		ensure_equals("first check", LLError::shouldLogCallCount(), 1);
+		ensure_equals("first check", LLError::shouldLogCallCount(), 2);
 		TestAlpha::doInfo();
 		ensure_message_count(0);
-		ensure_equals("second check", LLError::shouldLogCallCount(), 1);
+		ensure_equals("second check", LLError::shouldLogCallCount(), 2);
 
 		LLError::setClassLevel("TestAlpha", LLError::LEVEL_DEBUG);
 		TestAlpha::doInfo();
 		ensure_message_count(1);
-		ensure_equals("third check", LLError::shouldLogCallCount(), 2);
+		ensure_equals("third check", LLError::shouldLogCallCount(), 3);
 		TestAlpha::doInfo();
 		ensure_message_count(2);
-		ensure_equals("fourth check", LLError::shouldLogCallCount(), 2);
+		ensure_equals("fourth check", LLError::shouldLogCallCount(), 3);
 
 		LLError::setClassLevel("TestAlpha", LLError::LEVEL_WARN);
 		TestAlpha::doInfo();
 		ensure_message_count(2);
-		ensure_equals("fifth check", LLError::shouldLogCallCount(), 3);
+		ensure_equals("fifth check", LLError::shouldLogCallCount(), 4);
 		TestAlpha::doInfo();
 		ensure_message_count(2);
-		ensure_equals("sixth check", LLError::shouldLogCallCount(), 3);
+		ensure_equals("sixth check", LLError::shouldLogCallCount(), 4);
 	}
 
 	template<> template<>
-- 
GitLab