<feed xmlns='http://www.w3.org/2005/Atom'>
<title>viewer.git/indra/llcommon/tests/llerror_test.cpp, branch cef_147</title>
<subtitle>Megapahit's fork of the Second Life viewer.
</subtitle>
<id>https://megapahit.org/viewer.git/atom?h=cef_147</id>
<link rel='self' href='https://megapahit.org/viewer.git/atom?h=cef_147'/>
<link rel='alternate' type='text/html' href='https://megapahit.org/viewer.git/'/>
<updated>2024-04-29T04:56:09Z</updated>
<entry>
<title>#824 Process source files in bulk: replace tabs with spaces, convert CRLF to LF, and trim trailing whitespaces as needed</title>
<updated>2024-04-29T04:56:09Z</updated>
<author>
<name>Andrey Lihatskiy</name>
<email>alihatskiy@productengine.com</email>
</author>
<published>2024-04-29T04:43:28Z</published>
<link rel='alternate' type='text/html' href='https://megapahit.org/viewer.git/commit/?id=1b68f71348ecf3983b76b40d7940da8377f049b7'/>
<id>urn:sha1:1b68f71348ecf3983b76b40d7940da8377f049b7</id>
<content type='text'>
</content>
</entry>
<entry>
<title>replace boost library to standard</title>
<updated>2024-01-08T21:29:21Z</updated>
<author>
<name>AiraYumi</name>
<email>aira.youme@airanyumi.net</email>
</author>
<published>2024-01-06T14:29:06Z</published>
<link rel='alternate' type='text/html' href='https://megapahit.org/viewer.git/commit/?id=7c8907522fe6600918dacc15ee138ca72b2cf35e'/>
<id>urn:sha1:7c8907522fe6600918dacc15ee138ca72b2cf35e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>SL-10297: Move LL_ERRS crash location into the LL_ERRS macro itself.</title>
<updated>2021-05-12T01:42:14Z</updated>
<author>
<name>Nat Goodspeed</name>
<email>nat@lindenlab.com</email>
</author>
<published>2021-05-12T01:42:14Z</published>
<link rel='alternate' type='text/html' href='https://megapahit.org/viewer.git/commit/?id=c9fc4349b7d4ab1f5a7bfc0125014a96a07e51a3'/>
<id>urn:sha1:c9fc4349b7d4ab1f5a7bfc0125014a96a07e51a3</id>
<content type='text'>
Introduce Oz's LLERROR_CRASH macro analogous to the old LLError::crashAndLoop()
function. Change LL_ENDL macro so that, after calling flush(), if the CallSite
is for LEVEL_ERROR, we invoke LLERROR_CRASH right there.

Change the meaning of LLError::FatalFunction. It used to be responsible for
the actual crash (hence crashAndLoop()). Now, instead, its role is to disrupt
control flow in some other way if you DON'T want to crash: throw an exception,
or call exit() or some such. Any FatalFunction that returns normally will fall
into the new crash in LL_ENDL.

Accordingly, the new default FatalFunction is a no-op lambda. This eliminates
the need to test for empty (not set) FatalFunction in Log::flush().

Remove LLError::crashAndLoop() because the official LL_ERRS crash is now in
LL_ENDL.

One of the two common use cases for setFatalFunction() used to be to intercept
control in the last moments before crashing -- not to crash or to avoid
crashing, but to capture the LL_ERRS message in some way. Especially when
that's temporary, though (e.g. LLLeap), saving and restoring the previous
FatalFunction only works when the lifespans of the relevant objects are
strictly LIFO.

Either way, that's a misuse of FatalFunction. Fortunately the Recorder
mechanism exactly addresses that case. Introduce a GenericRecorder template
subclass, with LLError::addGenericRecorder(callable) that accepts a callable
with suitable (level, message) signature, instantiates a GenericRecorder, adds
it to the logging machinery and returns the RecorderPtr for possible later use
with removeRecorder().

Change llappviewer.cpp's errorCallback() to an addGenericRecorder() callable.
Its role was simply to update gDebugInfo["FatalMessage"] with the LL_ERRS
message, then call writeDebugInfo(), before calling crashAndLoop() to finish
crashing. Remove the crashAndLoop() call, retaining the gDebugInfo logic. Pass
errorCallback() to LLError::addGenericRecorder() instead of setFatalFunction().

Oddly, errorCallback()'s crashAndLoop() call was conditional on a compile-time
SHADER_CRASH_NONFATAL symbol. The new mechanism provides no way to support
SHADER_CRASH_NONFATAL -- it is a Bad Idea to return normally from any LL_ERRS
invocation!

Rename LLLeapImpl::fatalFunction() to onError(). Instead of passing it to
LLError::setFatalFunction(), pass it to addGenericRecorder(). Capture the
returned RecorderPtr in mRecorder, replacing mPrevFatalFunction. Then
~LLLeapImpl() calls removeRecorder(mRecorder) instead of restoring
mPrevFatalFunction (which, as noted above, was order-sensitive).

Of course, every enabled Recorder is called with every log message. onError()
and errorCallback() must specifically test for calls with LEVEL_ERROR.

LLSingletonBase::logerrs() used to call LLError::getFatalFunction(), check the
return and call it if non-empty, else call LLError::crashAndLoop(). Replace
all that with LLERROR_CRASH.

Remove from llappviewer.cpp the watchdog_llerrs_callback() and
watchdog_killer_callback() functions. watchdog_killer_callback(), passed to
Watchdog::init(), used to setFatalFunction(watchdog_llerrs_callback) and then
invoke LL_ERRS() -- which seems a bit roundabout. watchdog_llerrs_callback(),
in turn, replicated much of the logic in the primary errorCallback() function
before replicating the crash from llwatchdog.cpp's default_killer_callback().

Instead, pass LLWatchdog::init() a lambda that invokes the LL_ERRS() message
formerly found in watchdog_killer_callback(). It no longer needs to override
FatalFunction with watchdog_llerrs_callback() because errorCallback() will
still be called as a Recorder, obviating watchdog_llerrs_callback()'s first
half; and LL_ENDL will handle the crash, obviating the second half.

Remove from llappviewer.cpp the static fast_exit() function, which was simply
an alias for _exit() acceptable to boost::bind(). Use a lambda directly
calling _exit() instead of using boost::bind() at all.

In the CaptureLog class in llcommon/tests/wrapllerrs.h, instead of statically
referencing the wouldHaveCrashed() function from test.cpp, simply save and
restore the current FatalFunction across the LLError::saveAndResetSettings()
call.

llerror_test.cpp calls setFatalFunction(fatalCall), where fatalCall() was a
function that simply set a fatalWasCalled bool rather than actually crashing
in any way. Of course, that implementation would now lead to crashing the test
program. Make fatalCall() throw a new FatalWasCalled exception. Introduce a
CATCH(LL_ERRS("tag"), "message") macro that expands to:
LL_ERRS("tag") &lt;&lt; "message" &lt;&lt; LL_ENDL;
within a try/catch block that catches FatalWasCalled and sets the same bool.

Change all existing LL_ERRS() in llerror_test.cpp to corresponding CATCH()
calls. In fact there's also an LL_DEBUGS(bad tag) invocation that exercises an
LL_ERRS internal to llerror.cpp; wrap that too.
</content>
</entry>
<entry>
<title>DRTVWR-447: Move test&lt;5&gt; and writeMsgNeedsEscaping() into sequence.</title>
<updated>2018-10-17T20:42:59Z</updated>
<author>
<name>Nat Goodspeed</name>
<email>nat@lindenlab.com</email>
</author>
<published>2018-10-17T20:42:59Z</published>
<link rel='alternate' type='text/html' href='https://megapahit.org/viewer.git/commit/?id=cd9d051b9024e4e0fc16a4aca28601d2a88a4045'/>
<id>urn:sha1:cd9d051b9024e4e0fc16a4aca28601d2a88a4045</id>
<content type='text'>
</content>
</entry>
<entry>
<title>renumber the new test to replace the one that was removed</title>
<updated>2018-10-16T20:18:31Z</updated>
<author>
<name>Oz Linden</name>
<email>oz@lindenlab.com</email>
</author>
<published>2018-10-16T20:18:31Z</published>
<link rel='alternate' type='text/html' href='https://megapahit.org/viewer.git/commit/?id=00a839d66590de1204af5fa295f66abcff87e477'/>
<id>urn:sha1:00a839d66590de1204af5fa295f66abcff87e477</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Modify logging so that the in-viewer console and stderr do not escape line breaks</title>
<updated>2018-10-11T18:17:52Z</updated>
<author>
<name>Oz Linden</name>
<email>oz@lindenlab.com</email>
</author>
<published>2018-10-11T18:17:52Z</published>
<link rel='alternate' type='text/html' href='https://megapahit.org/viewer.git/commit/?id=d87cc1859f3f96b98a627fdc674e297e78438681'/>
<id>urn:sha1:d87cc1859f3f96b98a627fdc674e297e78438681</id>
<content type='text'>
Improve the implementation so that escaping is computed only once
</content>
</entry>
<entry>
<title>SL-967 simplify viewer log file field syntax</title>
<updated>2018-08-29T20:43:45Z</updated>
<author>
<name>Oz Linden</name>
<email>oz@lindenlab.com</email>
</author>
<published>2018-08-29T20:43:45Z</published>
<link rel='alternate' type='text/html' href='https://megapahit.org/viewer.git/commit/?id=f1d4e788e73857f14c016d13b6c879d86bd5b692'/>
<id>urn:sha1:f1d4e788e73857f14c016d13b6c879d86bd5b692</id>
<content type='text'>
MAINT-8991: only escape log message characters once, add unit test
remove extra log line created by LL_ERRS
document that tags may not contain spaces
</content>
</entry>
<entry>
<title>merge maint-6633 to fork of viewer-bear</title>
<updated>2016-10-11T21:42:58Z</updated>
<author>
<name>Glenn Glazer</name>
<email>coyot@lindenlab.com</email>
</author>
<published>2016-10-11T21:42:58Z</published>
<link rel='alternate' type='text/html' href='https://megapahit.org/viewer.git/commit/?id=86be29fe80af4bc49c31636cb5b7cc21ac100427'/>
<id>urn:sha1:86be29fe80af4bc49c31636cb5b7cc21ac100427</id>
<content type='text'>
</content>
</entry>
<entry>
<title>maint-6633: space, the final frontier</title>
<updated>2016-10-11T18:41:25Z</updated>
<author>
<name>Glenn Glazer</name>
<email>coyot@lindenlab.com</email>
</author>
<published>2016-10-11T18:41:25Z</published>
<link rel='alternate' type='text/html' href='https://megapahit.org/viewer.git/commit/?id=19f576872aec60aae359e567cdd80f3d081b2b73'/>
<id>urn:sha1:19f576872aec60aae359e567cdd80f3d081b2b73</id>
<content type='text'>
</content>
</entry>
<entry>
<title>maint-6633: space after colon</title>
<updated>2016-10-11T16:21:33Z</updated>
<author>
<name>Glenn Glazer</name>
<email>coyot@lindenlab.com</email>
</author>
<published>2016-10-11T16:21:33Z</published>
<link rel='alternate' type='text/html' href='https://megapahit.org/viewer.git/commit/?id=e6043fad2ab549a16f1bf4e81851357de4995862'/>
<id>urn:sha1:e6043fad2ab549a16f1bf4e81851357de4995862</id>
<content type='text'>
</content>
</entry>
</feed>
