Merge pull request #16098 from hyperlogic/feature/backtrace-shutdown-flag

Added "shutdown" crash annotation and crash menu option
This commit is contained in:
Shannon Romano 2019-08-27 10:57:07 -07:00 committed by GitHub
commit 3134332513
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 0 deletions

View file

@ -74,6 +74,7 @@
#include <Midi.h> #include <Midi.h>
#include <AudioInjectorManager.h> #include <AudioInjectorManager.h>
#include <AvatarBookmarks.h> #include <AvatarBookmarks.h>
#include <CrashHelpers.h>
#include <CursorManager.h> #include <CursorManager.h>
#include <VirtualPadManager.h> #include <VirtualPadManager.h>
#include <DebugDraw.h> #include <DebugDraw.h>
@ -2679,6 +2680,8 @@ void Application::updateHeartbeat() const {
} }
void Application::onAboutToQuit() { void Application::onAboutToQuit() {
setCrashAnnotation("shutdown", "1");
// quickly save AvatarEntityData before the EntityTree is dismantled // quickly save AvatarEntityData before the EntityTree is dismantled
getMyAvatar()->saveAvatarEntityDataToSettings(); getMyAvatar()->saveAvatarEntityDataToSettings();
@ -2717,6 +2720,11 @@ void Application::onAboutToQuit() {
cleanupBeforeQuit(); cleanupBeforeQuit();
if (_crashOnShutdown) {
// triggered by crash menu
crash::nullDeref();
}
getRefreshRateManager().setRefreshRateRegime(RefreshRateManager::RefreshRateRegime::SHUTDOWN); getRefreshRateManager().setRefreshRateRegime(RefreshRateManager::RefreshRateRegime::SHUTDOWN);
} }
@ -9527,6 +9535,14 @@ void Application::showUrlHandler(const QUrl& url) {
} }
}); });
} }
// used to test "shutdown" crash annotation.
void Application::crashOnShutdown() {
qDebug() << "crashOnShutdown(), ON PURPOSE!";
_crashOnShutdown = true;
quit();
}
void Application::overrideEntry(){ void Application::overrideEntry(){
_overrideEntry = true; _overrideEntry = true;
} }

View file

@ -497,6 +497,9 @@ public slots:
bool gpuTextureMemSizeStable(); bool gpuTextureMemSizeStable();
void showUrlHandler(const QUrl& url); void showUrlHandler(const QUrl& url);
// used to test "shutdown" crash annotation.
void crashOnShutdown();
private slots: private slots:
void onDesktopRootItemCreated(QQuickItem* qmlContext); void onDesktopRootItemCreated(QQuickItem* qmlContext);
void onDesktopRootContextCreated(QQmlContext* qmlContext); void onDesktopRootContextCreated(QQmlContext* qmlContext);
@ -844,5 +847,7 @@ private:
bool _overrideEntry { false }; bool _overrideEntry { false };
VisionSqueeze _visionSqueeze; VisionSqueeze _visionSqueeze;
bool _crashOnShutdown { false };
}; };
#endif // hifi_Application_h #endif // hifi_Application_h

View file

@ -763,6 +763,8 @@ Menu::Menu() {
action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashNewFaultThreaded); action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashNewFaultThreaded);
connect(action, &QAction::triggered, qApp, []() { std::thread(crash::newFault).join(); }); connect(action, &QAction::triggered, qApp, []() { std::thread(crash::newFault).join(); });
addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashOnShutdown, 0, qApp, SLOT(crashOnShutdown()));
// Developer > Show Statistics // Developer > Show Statistics
addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::Stats, 0, true); addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::Stats, 0, true);

View file

@ -72,6 +72,7 @@ namespace MenuOption {
const QString CrashNullDereferenceThreaded = "Null Dereference (threaded)"; const QString CrashNullDereferenceThreaded = "Null Dereference (threaded)";
const QString CrashAbort = "Abort"; const QString CrashAbort = "Abort";
const QString CrashAbortThreaded = "Abort (threaded)"; const QString CrashAbortThreaded = "Abort (threaded)";
const QString CrashOnShutdown = "Crash During Shutdown";
const QString CrashOutOfBoundsVectorAccess = "Out of Bounds Vector Access"; const QString CrashOutOfBoundsVectorAccess = "Out of Bounds Vector Access";
const QString CrashOutOfBoundsVectorAccessThreaded = "Out of Bounds Vector Access (threaded)"; const QString CrashOutOfBoundsVectorAccessThreaded = "Out of Bounds Vector Access (threaded)";
const QString CrashNewFault = "New Fault"; const QString CrashNewFault = "New Fault";