added "c++ crash" to crash menu

This commit is contained in:
Heather Anderson 2020-06-19 18:26:26 -07:00
parent d92bb16d0c
commit b6e1c9e3af
4 changed files with 16 additions and 4 deletions

View file

@ -705,7 +705,7 @@ Menu::Menu() {
// Developer > Crash >>>
bool result = false;
const QString HIFI_SHOW_DEVELOPER_CRASH_MENU("HIFI_SHOW_DEVELOPER_CRASH_MENU");
result = QProcessEnvironment::systemEnvironment().contains(HIFI_SHOW_DEVELOPER_CRASH_MENU);
result = true;//QProcessEnvironment::systemEnvironment().contains(HIFI_SHOW_DEVELOPER_CRASH_MENU);
if (result) {
MenuWrapper* crashMenu = developerMenu->addMenu("Crash");
@ -745,6 +745,11 @@ Menu::Menu() {
action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashNewFaultThreaded);
connect(action, &QAction::triggered, qApp, []() { std::thread(crash::newFault).join(); });
action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashThrownException);
connect(action, &QAction::triggered, qApp, []() { crash::throwException(); });
action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashThrownExceptionThreaded);
connect(action, &QAction::triggered, qApp, []() { std::thread(crash::throwException).join(); });
addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashOnShutdown, 0, qApp, SLOT(crashOnShutdown()));
}

View file

@ -77,6 +77,8 @@ namespace MenuOption {
const QString CrashOutOfBoundsVectorAccessThreaded = "Out of Bounds Vector Access (threaded)";
const QString CrashNewFault = "New Fault";
const QString CrashNewFaultThreaded = "New Fault (threaded)";
const QString CrashThrownException = "Thrown C++ exception";
const QString CrashThrownExceptionThreaded = "Thrown C++ exception (threaded)";
const QString CreateEntitiesGrabbable = "Create Entities As Grabbable (except Zones, Particles, and Lights)";
const QString DeadlockInterface = "Deadlock Interface";
const QString UnresponsiveInterface = "Unresponsive Interface";

View file

@ -19,7 +19,7 @@
#else
#include <assert.h>
#endif
#include <stdexcept>
namespace crash {
@ -86,7 +86,11 @@ void newFault() {
const size_t GIGABYTE = 1024 * 1024 * 1024;
new char[GIGABYTE];
}
}
void throwException() {
qCDebug(shared) << "About to throw an exception";
throw std::runtime_error("unexpected exception");
}
}
}

View file

@ -25,6 +25,7 @@ void nullDeref();
void doAbort();
void outOfBoundsVectorCrash();
void newFault();
void throwException();
}