diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index a1bb670837..bbb71cbea3 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -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())); } diff --git a/interface/src/Menu.h b/interface/src/Menu.h index a3da179ad3..d33b3b0f5e 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -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"; diff --git a/libraries/shared/src/CrashHelpers.cpp b/libraries/shared/src/CrashHelpers.cpp index 1676318f3e..8a1a6df1d2 100644 --- a/libraries/shared/src/CrashHelpers.cpp +++ b/libraries/shared/src/CrashHelpers.cpp @@ -19,7 +19,7 @@ #else #include #endif - +#include 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"); +} } - -} diff --git a/libraries/shared/src/CrashHelpers.h b/libraries/shared/src/CrashHelpers.h index 247aea5cde..ccda319819 100644 --- a/libraries/shared/src/CrashHelpers.h +++ b/libraries/shared/src/CrashHelpers.h @@ -25,6 +25,7 @@ void nullDeref(); void doAbort(); void outOfBoundsVectorCrash(); void newFault(); +void throwException(); }