SL-10190: Add menu commands to force AV or exception in coroutine.

"Bad memory access" and "unhandled exception" are the two categories of error
that we expect might be different in a coroutine than in the viewer's main
fiber. Without this change, we've had no reliable way to force either of those
to occur.

This will require translation work for two new menu items.

# Conflicts:
#	indra/newview/skins/default/xui/en/menu_viewer.xml
master
Nat Goodspeed 2018-12-17 09:58:00 -05:00 committed by Andrey Kleshchev
parent 913bddf18f
commit cedbf23fd1
4 changed files with 47 additions and 27 deletions

View File

@ -5566,12 +5566,6 @@ void LLAppViewer::forceErrorDriverCrash()
glDeleteTextures(1, NULL);
}
void LLAppViewer::forceErrorCoroutineCrash()
{
LL_WARNS() << "Forcing a crash in LLCoros" << LL_ENDL;
LLCoros::instance().launch("LLAppViewer::crashyCoro", [] {throw LLException("A deliberate crash from LLCoros"); });
}
void LLAppViewer::forceErrorThreadCrash()
{
class LLCrashTestThread : public LLThread

View File

@ -154,7 +154,6 @@ public:
virtual void forceErrorInfiniteLoop();
virtual void forceErrorSoftwareException();
virtual void forceErrorDriverCrash();
virtual void forceErrorCoroutineCrash();
virtual void forceErrorThreadCrash();
// The list is found in app_settings/settings_files.xml

View File

@ -33,10 +33,11 @@
#include "llviewermenu.h"
// linden library includes
#include "llavatarnamecache.h" // IDEVO
#include "llavatarnamecache.h" // IDEVO (I Are Not Men!)
#include "llcombobox.h"
#include "llcoros.h"
#include "llfloaterreg.h"
#include "llfloatersidepanelcontainer.h"
#include "llcombobox.h"
#include "llinventorypanel.h"
#include "llnotifications.h"
#include "llnotificationsutil.h"
@ -2379,6 +2380,7 @@ class LLAdvancedForceErrorLlerror : public view_listener_t
return true;
}
};
class LLAdvancedForceErrorBadMemoryAccess : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
@ -2388,6 +2390,22 @@ class LLAdvancedForceErrorBadMemoryAccess : public view_listener_t
}
};
class LLAdvancedForceErrorBadMemoryAccessCoro : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
LLCoros::instance().launch(
"AdvancedForceErrorBadMemoryAccessCoro",
[](){
// Wait for one mainloop() iteration, letting the enclosing
// handleEvent() method return.
llcoro::suspend();
force_error_bad_memory_access(NULL);
});
return true;
}
};
class LLAdvancedForceErrorInfiniteLoop : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
@ -2406,6 +2424,22 @@ class LLAdvancedForceErrorSoftwareException : public view_listener_t
}
};
class LLAdvancedForceErrorSoftwareExceptionCoro : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
LLCoros::instance().launch(
"AdvancedForceErrorSoftwareExceptionCoro",
[](){
// Wait for one mainloop() iteration, letting the enclosing
// handleEvent() method return.
llcoro::suspend();
force_error_software_exception(NULL);
});
return true;
}
};
class LLAdvancedForceErrorDriverCrash : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
@ -2415,15 +2449,6 @@ class LLAdvancedForceErrorDriverCrash : public view_listener_t
}
};
class LLAdvancedForceErrorCoroutineCrash : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
force_error_coroutine_crash(NULL);
return true;
}
};
class LLAdvancedForceErrorThreadCrash : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
@ -8150,11 +8175,6 @@ void force_error_driver_crash(void *)
LLAppViewer::instance()->forceErrorDriverCrash();
}
void force_error_coroutine_crash(void *)
{
LLAppViewer::instance()->forceErrorCoroutineCrash();
}
void force_error_thread_crash(void *)
{
LLAppViewer::instance()->forceErrorThreadCrash();
@ -9330,10 +9350,11 @@ void initialize_menus()
view_listener_t::addMenu(new LLAdvancedForceErrorBreakpoint(), "Advanced.ForceErrorBreakpoint");
view_listener_t::addMenu(new LLAdvancedForceErrorLlerror(), "Advanced.ForceErrorLlerror");
view_listener_t::addMenu(new LLAdvancedForceErrorBadMemoryAccess(), "Advanced.ForceErrorBadMemoryAccess");
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 LLAdvancedForceErrorSoftwareExceptionCoro(), "Advanced.ForceErrorSoftwareExceptionCoro");
view_listener_t::addMenu(new LLAdvancedForceErrorDriverCrash(), "Advanced.ForceErrorDriverCrash");
view_listener_t::addMenu(new LLAdvancedForceErrorCoroutineCrash(), "Advanced.ForceErrorCoroutineCrash");
view_listener_t::addMenu(new LLAdvancedForceErrorThreadCrash(), "Advanced.ForceErrorThreadCrash");
view_listener_t::addMenu(new LLAdvancedForceErrorDisconnectViewer(), "Advanced.ForceErrorDisconnectViewer");

View File

@ -2649,6 +2649,12 @@ function="World.EnvPreset"
<menu_item_call.on_click
function="Advanced.ForceErrorBadMemoryAccess" />
</menu_item_call>
<menu_item_call
label="Force Bad Memory Access in Coroutine"
name="Force Bad Memory Access in Coroutine">
<menu_item_call.on_click
function="Advanced.ForceErrorBadMemoryAccessCoro" />
</menu_item_call>
<menu_item_call
label="Force Infinite Loop"
name="Force Infinite Loop">
@ -2668,10 +2674,10 @@ function="World.EnvPreset"
function="Advanced.ForceErrorSoftwareException" />
</menu_item_call>
<menu_item_call
label="Force a Crash in a Coroutine"
name="Force a Crash in a Coroutine">
label="Force Software Exception in Coroutine"
name="Force Software Exception in Coroutine">
<menu_item_call.on_click
function="Advanced.ForceErrorCoroutineCrash" />
function="Advanced.ForceErrorSoftwareExceptionCoro" />
</menu_item_call>
<menu_item_call
label="Force a Crash in a Thread"