diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2024-01-19 23:01:06 +0200 |
---|---|---|
committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2024-01-22 18:47:43 +0200 |
commit | fee2dc981cb15c54cacd63f778f106ff93a85796 (patch) | |
tree | e08babb6862cff7d5ef4d94fb7ab87d92e82e131 /indra/newview | |
parent | 337a2356a923ab5a3ac99c3adf81101084926179 (diff) |
NSException test
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llappviewer.cpp | 7 | ||||
-rw-r--r-- | indra/newview/llappviewer.h | 1 | ||||
-rw-r--r-- | indra/newview/llappviewermacosx-objc.h | 2 | ||||
-rw-r--r-- | indra/newview/llappviewermacosx-objc.mm | 6 | ||||
-rw-r--r-- | indra/newview/llappviewermacosx.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llappviewermacosx.h | 2 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 26 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_viewer.xml | 8 |
8 files changed, 57 insertions, 0 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 08a6c20acf..30fb0be46c 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -5445,6 +5445,13 @@ void LLAppViewer::forceErrorSoftwareException() LLTHROW(LLException("User selected Force Software Exception")); } +void LLAppViewer::forceErrorOSSpecificException() +{ + // Virtual, MacOS only + const std::string exception_text = "User selected Force OS Exception, Not implemented on this OS"; + throw std::runtime_error(exception_text); +} + void LLAppViewer::forceErrorDriverCrash() { LL_WARNS() << "Forcing a deliberate driver crash" << LL_ENDL; diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 6d1496d517..c5faa67120 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -156,6 +156,7 @@ public: virtual void forceErrorBadMemoryAccess(); virtual void forceErrorInfiniteLoop(); virtual void forceErrorSoftwareException(); + virtual void forceErrorOSSpecificException(); virtual void forceErrorDriverCrash(); virtual void forceErrorCoroutineCrash(); virtual void forceErrorThreadCrash(); diff --git a/indra/newview/llappviewermacosx-objc.h b/indra/newview/llappviewermacosx-objc.h index c6dcec8e34..3721151aba 100644 --- a/indra/newview/llappviewermacosx-objc.h +++ b/indra/newview/llappviewermacosx-objc.h @@ -33,4 +33,6 @@ //Why? Because BOOL void launchApplication(const std::string* app_name, const std::vector<std::string>* args); +void force_ns_sxeption(); + #endif // LL_LLAPPVIEWERMACOSX_OBJC_H diff --git a/indra/newview/llappviewermacosx-objc.mm b/indra/newview/llappviewermacosx-objc.mm index 17301847e8..5d9ca24db2 100644 --- a/indra/newview/llappviewermacosx-objc.mm +++ b/indra/newview/llappviewermacosx-objc.mm @@ -71,3 +71,9 @@ void launchApplication(const std::string* app_name, const std::vector<std::strin [pool release]; return; } + +void force_ns_sxeption() +{ + NSException *exception = [NSException exceptionWithName:@"Forced NSException" reason:nullptr userInfo:nullptr]; + @throw exception; +} diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp index 8b313a321b..c42c3b3daf 100644 --- a/indra/newview/llappviewermacosx.cpp +++ b/indra/newview/llappviewermacosx.cpp @@ -250,6 +250,11 @@ bool LLAppViewerMacOSX::init() return LLAppViewer::init(); } +void LLAppViewerMacOSX::forceErrorOSSpecificException() +{ + force_ns_sxeption(); +} + // MacOSX may add and addition command line arguement for the process serial number. // The option takes a form like '-psn_0_12345'. The following method should be able to recognize // and either ignore or return a pair of values for the option. diff --git a/indra/newview/llappviewermacosx.h b/indra/newview/llappviewermacosx.h index b0e325a955..15c55c44a6 100644 --- a/indra/newview/llappviewermacosx.h +++ b/indra/newview/llappviewermacosx.h @@ -42,6 +42,8 @@ public: // virtual bool init(); // Override to do application initialization + virtual void forceErrorOSSpecificException(); + protected: virtual bool restoreErrorTrap(); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 11eed8f456..3e307c9f4e 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -292,6 +292,7 @@ void force_error_llerror(void *); void force_error_bad_memory_access(void *); void force_error_infinite_loop(void *); void force_error_software_exception(void *); +void force_error_os_exception(void*); void force_error_driver_crash(void *); void force_error_coroutine_crash(void *); void force_error_thread_crash(void *); @@ -2419,6 +2420,15 @@ class LLAdvancedForceErrorSoftwareException : public view_listener_t } }; +class LLAdvancedForceOSException: public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + force_error_os_exception(NULL); + return true; + } +}; + class LLAdvancedForceErrorSoftwareExceptionCoro : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -3200,6 +3210,15 @@ bool enable_object_select_in_pathfinding_characters() return LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion() && LLSelectMgr::getInstance()->selectGetViewableCharacters(); } +bool enable_os_exception() +{ +#if LL_DARWIN + return true; +#else + return false; +#endif +} + class LLSelfRemoveAllAttachments : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -8371,6 +8390,11 @@ void force_error_software_exception(void *) LLAppViewer::instance()->forceErrorSoftwareException(); } +void force_error_os_exception(void*) +{ + LLAppViewer::instance()->forceErrorOSSpecificException(); +} + void force_error_driver_crash(void *) { LLAppViewer::instance()->forceErrorDriverCrash(); @@ -9598,6 +9622,7 @@ void initialize_menus() view_listener_t::addMenu(new LLAdvancedForceErrorBadMemoryAccessCoro(), "Advanced.ForceErrorBadMemoryAccessCoro"); view_listener_t::addMenu(new LLAdvancedForceErrorInfiniteLoop(), "Advanced.ForceErrorInfiniteLoop"); view_listener_t::addMenu(new LLAdvancedForceErrorSoftwareException(), "Advanced.ForceErrorSoftwareException"); + view_listener_t::addMenu(new LLAdvancedForceOSException(), "Advanced.ForceErrorOSException"); view_listener_t::addMenu(new LLAdvancedForceErrorSoftwareExceptionCoro(), "Advanced.ForceErrorSoftwareExceptionCoro"); view_listener_t::addMenu(new LLAdvancedForceErrorDriverCrash(), "Advanced.ForceErrorDriverCrash"); view_listener_t::addMenu(new LLAdvancedForceErrorCoroutineCrash(), "Advanced.ForceErrorCoroutineCrash"); @@ -9779,6 +9804,7 @@ void initialize_menus() enable.add("VisibleSelectInPathfindingLinksets", boost::bind(&visible_object_select_in_pathfinding_linksets)); commit.add("Pathfinding.Characters.Select", boost::bind(&LLFloaterPathfindingCharacters::openCharactersWithSelectedObjects)); enable.add("EnableSelectInPathfindingCharacters", boost::bind(&enable_object_select_in_pathfinding_characters)); + enable.add("Advanced.EnableErrorOSException", boost::bind(&enable_os_exception)); view_listener_t::addMenu(new LLFloaterVisible(), "FloaterVisible"); view_listener_t::addMenu(new LLShowSidetrayPanel(), "ShowSidetrayPanel"); diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 2c26296547..910c2a969c 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -2755,6 +2755,14 @@ function="World.EnvPreset" function="Advanced.ForceErrorSoftwareException" /> </menu_item_call> <menu_item_call + label="Force OS Exception" + name="Force OS Exception"> + <menu_item_call.on_click + function="Advanced.ForceErrorOSException" /> + <menu_item_call.on_visible + function="Advanced.EnableErrorOSException" /> + </menu_item_call> + <menu_item_call label="Force a Crash in a Coroutine" name="Force a Crash in a Coroutine"> <menu_item_call.on_click |