diff options
author | Jonathan "Geenz" Goodman <geenz@lindenlab.com> | 2025-04-15 09:50:42 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-15 09:50:42 -0400 |
commit | cf2b4dbfb280986cf859b12fd55158d7b9e0ac3d (patch) | |
tree | e7af9b048afdb57799259b7ae7767457b79115ca /indra/llcommon/llcoros.cpp | |
parent | b7dd677933797a72175a95f2945b2ca8363e09b5 (diff) | |
parent | 632a8648ca5456448499a96dcc58c40f4ff80d95 (diff) |
Merge pull request #3706 from secondlife/release/2025.03
Release/2025.03
Diffstat (limited to 'indra/llcommon/llcoros.cpp')
-rw-r--r-- | indra/llcommon/llcoros.cpp | 57 |
1 files changed, 41 insertions, 16 deletions
diff --git a/indra/llcommon/llcoros.cpp b/indra/llcommon/llcoros.cpp index 1539b48bd3..9e95d9c85f 100644 --- a/indra/llcommon/llcoros.cpp +++ b/indra/llcommon/llcoros.cpp @@ -310,26 +310,55 @@ namespace static const U32 STATUS_MSC_EXCEPTION = 0xE06D7363; // compiler specific -U32 exception_filter(U32 code, struct _EXCEPTION_POINTERS *exception_infop) +U32 exception_filter(U32 code, struct _EXCEPTION_POINTERS* exception_infop) { - if (code == STATUS_MSC_EXCEPTION) + if (LLApp::instance()->reportCrashToBugsplat((void*)exception_infop)) + { + // Handled + return EXCEPTION_CONTINUE_SEARCH; + } + else if (code == STATUS_MSC_EXCEPTION) { // C++ exception, go on return EXCEPTION_CONTINUE_SEARCH; } else { - // handle it + // handle it, convert to std::exception return EXCEPTION_EXECUTE_HANDLER; } + + return EXCEPTION_CONTINUE_SEARCH; } -void sehandle(const LLCoros::callable_t& callable) +void cpphandle(const LLCoros::callable_t& callable, const std::string& name) { - __try + // SE and C++ can not coexists, thus two handlers + try { callable(); } + catch (const LLCoros::Stop& exc) + { + LL_INFOS("LLCoros") << "coroutine " << name << " terminating because " + << exc.what() << LL_ENDL; + } + catch (const LLContinueError&) + { + // Any uncaught exception derived from LLContinueError will be caught + // here and logged. This coroutine will terminate but the rest of the + // viewer will carry on. + LOG_UNHANDLED_EXCEPTION(STRINGIZE("coroutine " << name)); + } +} + +void sehandle(const LLCoros::callable_t& callable, const std::string& name) +{ + __try + { + // handle stop and continue exceptions first + cpphandle(callable, name); + } __except (exception_filter(GetExceptionCode(), GetExceptionInformation())) { // convert to C++ styled exception @@ -340,16 +369,7 @@ void sehandle(const LLCoros::callable_t& callable) throw std::exception(integer_string); } } - -#else // ! LL_WINDOWS - -inline void sehandle(const LLCoros::callable_t& callable) -{ - callable(); -} - -#endif // ! LL_WINDOWS - +#endif // LL_WINDOWS } // anonymous namespace // Top-level wrapper around caller's coroutine callable. @@ -362,10 +382,14 @@ void LLCoros::toplevel(std::string name, callable_t callable) // set it as current mCurrent.reset(&corodata); +#ifdef LL_WINDOWS + // can not use __try directly, toplevel requires unwinding, thus use of a wrapper + sehandle(callable, name); +#else // LL_WINDOWS // run the code the caller actually wants in the coroutine try { - sehandle(callable); + callable(); } catch (const Stop& exc) { @@ -387,6 +411,7 @@ void LLCoros::toplevel(std::string name, callable_t callable) << name << LL_ENDL; LLCoros::instance().saveException(name, std::current_exception()); } +#endif // else LL_WINDOWS } //static |