mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 18:16:45 +02:00
Merge pull request #7652 from huffman/feat/crash-menu
Move crash menu items to submenu and add new crash types
This commit is contained in:
commit
37dcfdad8a
5 changed files with 132 additions and 13 deletions
|
@ -5158,13 +5158,6 @@ mat4 Application::getHMDSensorPose() const {
|
||||||
return mat4();
|
return mat4();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::crashApplication() {
|
|
||||||
qCDebug(interfaceapp) << "Intentionally crashed Interface";
|
|
||||||
QObject* object = nullptr;
|
|
||||||
bool value = object->isWindowType();
|
|
||||||
Q_UNUSED(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Application::deadlockApplication() {
|
void Application::deadlockApplication() {
|
||||||
qCDebug(interfaceapp) << "Intentionally deadlocked Interface";
|
qCDebug(interfaceapp) << "Intentionally deadlocked Interface";
|
||||||
// Using a loop that will *technically* eventually exit (in ~600 billion years)
|
// Using a loop that will *technically* eventually exit (in ~600 billion years)
|
||||||
|
|
|
@ -275,7 +275,6 @@ public slots:
|
||||||
|
|
||||||
void updateHeartbeat() const;
|
void updateHeartbeat() const;
|
||||||
|
|
||||||
static void crashApplication();
|
|
||||||
static void deadlockApplication();
|
static void deadlockApplication();
|
||||||
|
|
||||||
void rotationModeChanged() const;
|
void rotationModeChanged() const;
|
||||||
|
|
|
@ -13,8 +13,11 @@
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
|
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
#include <AddressManager.h>
|
#include <AddressManager.h>
|
||||||
#include <AudioClient.h>
|
#include <AudioClient.h>
|
||||||
|
#include <CrashHelpers.h>
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
#include <display-plugins/DisplayPlugin.h>
|
#include <display-plugins/DisplayPlugin.h>
|
||||||
#include <PathUtils.h>
|
#include <PathUtils.h>
|
||||||
|
@ -587,10 +590,41 @@ Menu::Menu() {
|
||||||
|
|
||||||
// Developer > Display Crash Options
|
// Developer > Display Crash Options
|
||||||
addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::DisplayCrashOptions, 0, true);
|
addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::DisplayCrashOptions, 0, true);
|
||||||
// Developer > Crash Application
|
|
||||||
addActionToQMenuAndActionHash(developerMenu, MenuOption::CrashInterface, 0, qApp, SLOT(crashApplication()));
|
// Developer > Crash >>>
|
||||||
// Developer > Deadlock Application
|
MenuWrapper* crashMenu = developerMenu->addMenu("Crash");
|
||||||
addActionToQMenuAndActionHash(developerMenu, MenuOption::DeadlockInterface, 0, qApp, SLOT(deadlockApplication()));
|
|
||||||
|
addActionToQMenuAndActionHash(crashMenu, MenuOption::DeadlockInterface, 0, qApp, SLOT(deadlockApplication()));
|
||||||
|
|
||||||
|
action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashPureVirtualFunction);
|
||||||
|
connect(action, &QAction::triggered, qApp, []() { crash::pureVirtualCall(); });
|
||||||
|
action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashPureVirtualFunctionThreaded);
|
||||||
|
connect(action, &QAction::triggered, qApp, []() { std::thread([]() { crash::pureVirtualCall(); }); });
|
||||||
|
|
||||||
|
action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashDoubleFree);
|
||||||
|
connect(action, &QAction::triggered, qApp, []() { crash::doubleFree(); });
|
||||||
|
action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashDoubleFreeThreaded);
|
||||||
|
connect(action, &QAction::triggered, qApp, []() { std::thread([]() { crash::doubleFree(); }); });
|
||||||
|
|
||||||
|
action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashAbort);
|
||||||
|
connect(action, &QAction::triggered, qApp, []() { crash::doAbort(); });
|
||||||
|
action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashAbortThreaded);
|
||||||
|
connect(action, &QAction::triggered, qApp, []() { std::thread([]() { crash::doAbort(); }); });
|
||||||
|
|
||||||
|
action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashNullDereference);
|
||||||
|
connect(action, &QAction::triggered, qApp, []() { crash::nullDeref(); });
|
||||||
|
action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashNullDereferenceThreaded);
|
||||||
|
connect(action, &QAction::triggered, qApp, []() { std::thread([]() { crash::nullDeref(); }); });
|
||||||
|
|
||||||
|
action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashOutOfBoundsVectorAccess);
|
||||||
|
connect(action, &QAction::triggered, qApp, []() { crash::outOfBoundsVectorCrash(); });
|
||||||
|
action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashOutOfBoundsVectorAccessThreaded);
|
||||||
|
connect(action, &QAction::triggered, qApp, []() { std::thread([]() { crash::outOfBoundsVectorCrash(); }); });
|
||||||
|
|
||||||
|
action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashNewFault);
|
||||||
|
connect(action, &QAction::triggered, qApp, []() { crash::newFault(); });
|
||||||
|
action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashNewFaultThreaded);
|
||||||
|
connect(action, &QAction::triggered, qApp, []() { std::thread([]() { crash::newFault(); }); });
|
||||||
|
|
||||||
// Developer > Log...
|
// Developer > Log...
|
||||||
addActionToQMenuAndActionHash(developerMenu, MenuOption::Log, Qt::CTRL | Qt::SHIFT | Qt::Key_L,
|
addActionToQMenuAndActionHash(developerMenu, MenuOption::Log, Qt::CTRL | Qt::SHIFT | Qt::Key_L,
|
||||||
|
|
|
@ -66,7 +66,18 @@ namespace MenuOption {
|
||||||
const QString CopyAddress = "Copy Address to Clipboard";
|
const QString CopyAddress = "Copy Address to Clipboard";
|
||||||
const QString CopyPath = "Copy Path to Clipboard";
|
const QString CopyPath = "Copy Path to Clipboard";
|
||||||
const QString CoupleEyelids = "Couple Eyelids";
|
const QString CoupleEyelids = "Couple Eyelids";
|
||||||
const QString CrashInterface = "Crash Interface";
|
const QString CrashPureVirtualFunction = "Pure Virtual Function Call";
|
||||||
|
const QString CrashPureVirtualFunctionThreaded = "Pure Virtual Function Call (threaded)";
|
||||||
|
const QString CrashDoubleFree = "Double Free";
|
||||||
|
const QString CrashDoubleFreeThreaded = "Double Free (threaded)";
|
||||||
|
const QString CrashNullDereference = "Null Dereference";
|
||||||
|
const QString CrashNullDereferenceThreaded = "Null Dereference (threaded)";
|
||||||
|
const QString CrashAbort = "Abort";
|
||||||
|
const QString CrashAbortThreaded = "Abort (threaded)";
|
||||||
|
const QString CrashOutOfBoundsVectorAccess = "Out of Bounds Vector Access";
|
||||||
|
const QString CrashOutOfBoundsVectorAccessThreaded = "Out of Bounds Vector Access (threaded)";
|
||||||
|
const QString CrashNewFault = "New Fault";
|
||||||
|
const QString CrashNewFaultThreaded = "New Fault (threaded)";
|
||||||
const QString DeadlockInterface = "Deadlock Interface";
|
const QString DeadlockInterface = "Deadlock Interface";
|
||||||
const QString DecreaseAvatarSize = "Decrease Avatar Size";
|
const QString DecreaseAvatarSize = "Decrease Avatar Size";
|
||||||
const QString DeleteBookmark = "Delete Bookmark...";
|
const QString DeleteBookmark = "Delete Bookmark...";
|
||||||
|
|
82
libraries/shared/src/CrashHelpers.h
Normal file
82
libraries/shared/src/CrashHelpers.h
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
//
|
||||||
|
// CrashHelpers.h
|
||||||
|
// libraries/shared/src
|
||||||
|
//
|
||||||
|
// Created by Ryan Huffman on 11 April 2016.
|
||||||
|
// Copyright 2016 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef hifi_CrashHelpers_h
|
||||||
|
#define hifi_CrashHelpers_h
|
||||||
|
|
||||||
|
namespace crash {
|
||||||
|
|
||||||
|
class B;
|
||||||
|
class A {
|
||||||
|
public:
|
||||||
|
A(B* b) : _b(b) { }
|
||||||
|
~A();
|
||||||
|
virtual void virtualFunction() = 0;
|
||||||
|
|
||||||
|
private:
|
||||||
|
B* _b;
|
||||||
|
};
|
||||||
|
|
||||||
|
class B : public A {
|
||||||
|
public:
|
||||||
|
B() : A(this) { }
|
||||||
|
virtual void virtualFunction() { }
|
||||||
|
};
|
||||||
|
|
||||||
|
A::~A() {
|
||||||
|
_b->virtualFunction();
|
||||||
|
}
|
||||||
|
|
||||||
|
void pureVirtualCall() {
|
||||||
|
qDebug() << "About to make a pure virtual call";
|
||||||
|
B b;
|
||||||
|
}
|
||||||
|
|
||||||
|
void doubleFree() {
|
||||||
|
qDebug() << "About to double delete memory";
|
||||||
|
int* blah = new int(200);
|
||||||
|
delete blah;
|
||||||
|
delete blah;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nullDeref() {
|
||||||
|
qDebug() << "About to dereference a null pointer";
|
||||||
|
int* p = nullptr;
|
||||||
|
*p = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void doAbort() {
|
||||||
|
qDebug() << "About to abort";
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
void outOfBoundsVectorCrash() {
|
||||||
|
qDebug() << "std::vector out of bounds crash!";
|
||||||
|
std::vector<int> v;
|
||||||
|
v[0] = 42;
|
||||||
|
}
|
||||||
|
|
||||||
|
void newFault() {
|
||||||
|
qDebug() << "About to crash inside new fault";
|
||||||
|
|
||||||
|
// Force crash with multiple large allocations
|
||||||
|
while (true) {
|
||||||
|
const size_t GIGABYTE = 1024 * 1024 * 1024;
|
||||||
|
new char[GIGABYTE];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // hifi_CrashHelpers_h
|
Loading…
Reference in a new issue