forked from qt-creator/qt-creator
Valgrind: Simplify RunControlFactory setup
Change-Id: Ibef142e84ce1d4aca299dd8fa53b1eabcf517100 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -488,10 +488,19 @@ static WorkerFactories &theWorkerFactories()
|
|||||||
return factories;
|
return factories;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RunControl::WorkerFactory::canRun(RunConfiguration *runConfiguration, Core::Id runMode) const
|
||||||
|
{
|
||||||
|
if (runMode != runMode)
|
||||||
|
return false;
|
||||||
|
if (!constraint)
|
||||||
|
return true;
|
||||||
|
return constraint(runConfiguration);
|
||||||
|
}
|
||||||
|
|
||||||
bool IRunControlFactory::canRun(RunConfiguration *runConfiguration, Core::Id runMode) const
|
bool IRunControlFactory::canRun(RunConfiguration *runConfiguration, Core::Id runMode) const
|
||||||
{
|
{
|
||||||
for (const RunControl::WorkerFactory &factory : theWorkerFactories()) {
|
for (const RunControl::WorkerFactory &factory : theWorkerFactories()) {
|
||||||
if (factory.runMode == runMode && factory.constraint(runConfiguration))
|
if (factory.canRun(runConfiguration, runMode))
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
return false;
|
return false;
|
||||||
@@ -500,7 +509,7 @@ bool IRunControlFactory::canRun(RunConfiguration *runConfiguration, Core::Id run
|
|||||||
RunControl *IRunControlFactory::create(RunConfiguration *runConfiguration, Core::Id runMode, QString *)
|
RunControl *IRunControlFactory::create(RunConfiguration *runConfiguration, Core::Id runMode, QString *)
|
||||||
{
|
{
|
||||||
for (const RunControl::WorkerFactory &factory : theWorkerFactories()) {
|
for (const RunControl::WorkerFactory &factory : theWorkerFactories()) {
|
||||||
if (factory.runMode == runMode && factory.constraint(runConfiguration)) {
|
if (factory.canRun(runConfiguration, runMode)) {
|
||||||
auto runControl = new RunControl(runConfiguration, runMode);
|
auto runControl = new RunControl(runConfiguration, runMode);
|
||||||
factory.producer(runControl);
|
factory.producer(runControl);
|
||||||
return runControl;
|
return runControl;
|
||||||
@@ -758,7 +767,7 @@ RunWorker *RunControl::createWorker(Core::Id id)
|
|||||||
{
|
{
|
||||||
auto keys = theWorkerCreators().keys();
|
auto keys = theWorkerCreators().keys();
|
||||||
Q_UNUSED(keys);
|
Q_UNUSED(keys);
|
||||||
Producer creator = theWorkerCreators().value(id);
|
WorkerCreator creator = theWorkerCreators().value(id);
|
||||||
if (creator)
|
if (creator)
|
||||||
return creator(this);
|
return creator(this);
|
||||||
creator = device()->workerCreator(id);
|
creator = device()->workerCreator(id);
|
||||||
@@ -767,10 +776,11 @@ RunWorker *RunControl::createWorker(Core::Id id)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
RunControl::Producer RunControl::producer(RunConfiguration *runConfiguration, Core::Id runMode)
|
RunControl::WorkerCreator RunControl::producer(RunConfiguration *runConfiguration, Core::Id runMode)
|
||||||
{
|
{
|
||||||
for (const auto &factory : theWorkerFactories()) {
|
for (const auto &factory : theWorkerFactories()) {
|
||||||
if (factory.runMode == runMode && factory.constraint(runConfiguration))
|
if (factory.runMode == runMode
|
||||||
|
&& (!factory.constraint || factory.constraint(runConfiguration)))
|
||||||
return factory.producer;
|
return factory.producer;
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
|
@@ -478,9 +478,6 @@ public:
|
|||||||
const QString &cancelButtonText = QString(),
|
const QString &cancelButtonText = QString(),
|
||||||
bool *prompt = nullptr);
|
bool *prompt = nullptr);
|
||||||
|
|
||||||
using WorkerCreator = std::function<RunWorker *(RunControl *)>;
|
|
||||||
static void registerWorkerCreator(Core::Id id, const WorkerCreator &workerCreator);
|
|
||||||
RunWorker *workerById(Core::Id id) const;
|
|
||||||
QList<QPointer<RunWorker>> workers() const;
|
QList<QPointer<RunWorker>> workers() const;
|
||||||
|
|
||||||
template <class T> T *worker() const {
|
template <class T> T *worker() const {
|
||||||
@@ -495,9 +492,16 @@ public:
|
|||||||
|
|
||||||
RunWorker *createWorker(Core::Id id);
|
RunWorker *createWorker(Core::Id id);
|
||||||
|
|
||||||
using Producer = std::function<RunWorker *(RunControl *)>;
|
using WorkerCreator = std::function<RunWorker *(RunControl *)>;
|
||||||
using Constraint = std::function<bool(RunConfiguration *)>;
|
using Constraint = std::function<bool(RunConfiguration *)>;
|
||||||
|
|
||||||
|
static void registerWorkerCreator(Core::Id id, const WorkerCreator &workerCreator);
|
||||||
|
|
||||||
|
static void registerWorker(Core::Id runMode, const WorkerCreator &producer,
|
||||||
|
const Constraint &constraint = {})
|
||||||
|
{
|
||||||
|
addWorkerFactory({runMode, constraint, producer});
|
||||||
|
}
|
||||||
template <class Worker>
|
template <class Worker>
|
||||||
static void registerWorker(Core::Id runMode, const Constraint &constraint)
|
static void registerWorker(Core::Id runMode, const Constraint &constraint)
|
||||||
{
|
{
|
||||||
@@ -515,10 +519,12 @@ public:
|
|||||||
struct WorkerFactory {
|
struct WorkerFactory {
|
||||||
Core::Id runMode;
|
Core::Id runMode;
|
||||||
Constraint constraint;
|
Constraint constraint;
|
||||||
Producer producer;
|
WorkerCreator producer;
|
||||||
|
|
||||||
|
bool canRun(RunConfiguration *runConfiguration, Core::Id runMode) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
static Producer producer(RunConfiguration *runConfiguration, Core::Id runMode);
|
static WorkerCreator producer(RunConfiguration *runConfiguration, Core::Id runMode);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void appendMessageRequested(ProjectExplorer::RunControl *runControl,
|
void appendMessageRequested(ProjectExplorer::RunControl *runControl,
|
||||||
@@ -533,7 +539,6 @@ private:
|
|||||||
friend class Internal::RunWorkerPrivate;
|
friend class Internal::RunWorkerPrivate;
|
||||||
|
|
||||||
static void addWorkerFactory(const WorkerFactory &workerFactory);
|
static void addWorkerFactory(const WorkerFactory &workerFactory);
|
||||||
|
|
||||||
void bringApplicationToForegroundInternal();
|
void bringApplicationToForegroundInternal();
|
||||||
Internal::RunControlPrivate *d;
|
Internal::RunControlPrivate *d;
|
||||||
};
|
};
|
||||||
|
@@ -41,7 +41,6 @@
|
|||||||
#include <valgrind/callgrind/callgrindproxymodel.h>
|
#include <valgrind/callgrind/callgrindproxymodel.h>
|
||||||
#include <valgrind/callgrind/callgrindstackbrowser.h>
|
#include <valgrind/callgrind/callgrindstackbrowser.h>
|
||||||
#include <valgrind/valgrindplugin.h>
|
#include <valgrind/valgrindplugin.h>
|
||||||
#include <valgrind/valgrindruncontrolfactory.h>
|
|
||||||
#include <valgrind/valgrindsettings.h>
|
#include <valgrind/valgrindsettings.h>
|
||||||
|
|
||||||
#include <debugger/debuggerconstants.h>
|
#include <debugger/debuggerconstants.h>
|
||||||
@@ -99,6 +98,7 @@ using namespace Valgrind::Callgrind;
|
|||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
using namespace std::placeholders;
|
||||||
|
|
||||||
namespace Valgrind {
|
namespace Valgrind {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -118,7 +118,7 @@ class CallgrindTool : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CallgrindTool(QObject *parent);
|
CallgrindTool();
|
||||||
~CallgrindTool();
|
~CallgrindTool();
|
||||||
|
|
||||||
ValgrindToolRunner *createRunTool(RunControl *runControl);
|
ValgrindToolRunner *createRunTool(RunControl *runControl);
|
||||||
@@ -222,8 +222,7 @@ public:
|
|||||||
bool m_toolBusy = false;
|
bool m_toolBusy = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
CallgrindTool::CallgrindTool(QObject *parent)
|
CallgrindTool::CallgrindTool()
|
||||||
: QObject(parent)
|
|
||||||
{
|
{
|
||||||
setObjectName(QLatin1String("CallgrindTool"));
|
setObjectName(QLatin1String("CallgrindTool"));
|
||||||
|
|
||||||
@@ -251,10 +250,6 @@ CallgrindTool::CallgrindTool(QObject *parent)
|
|||||||
QString toolTip = tr("Valgrind Function Profiler uses the "
|
QString toolTip = tr("Valgrind Function Profiler uses the "
|
||||||
"Callgrind tool to record function calls when a program runs.");
|
"Callgrind tool to record function calls when a program runs.");
|
||||||
|
|
||||||
RunControl::registerWorkerCreator(CALLGRIND_RUN_MODE, [this](RunControl *runControl) {
|
|
||||||
return createRunTool(runControl);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!Utils::HostOsInfo::isWindowsHost()) {
|
if (!Utils::HostOsInfo::isWindowsHost()) {
|
||||||
auto action = new QAction(tr("Valgrind Function Profiler"), this);
|
auto action = new QAction(tr("Valgrind Function Profiler"), this);
|
||||||
action->setToolTip(toolTip);
|
action->setToolTip(toolTip);
|
||||||
@@ -966,48 +961,20 @@ void CallgrindTool::createTextMarks()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class CallgrindRunControlFactory : public IRunControlFactory
|
static CallgrindTool *theCallgrindTool;
|
||||||
{
|
|
||||||
public:
|
|
||||||
CallgrindRunControlFactory() : m_tool(new CallgrindTool(this)) {}
|
|
||||||
|
|
||||||
bool canRun(RunConfiguration *runConfiguration, Core::Id runMode) const override
|
|
||||||
{
|
|
||||||
Q_UNUSED(runConfiguration);
|
|
||||||
return runMode == CALLGRIND_RUN_MODE;
|
|
||||||
}
|
|
||||||
|
|
||||||
RunControl *create(RunConfiguration *runConfiguration, Core::Id runMode, QString *errorMessage) override
|
|
||||||
{
|
|
||||||
Q_UNUSED(errorMessage);
|
|
||||||
auto runControl = new RunControl(runConfiguration, runMode);
|
|
||||||
m_tool->createRunTool(runControl);
|
|
||||||
return runControl;
|
|
||||||
}
|
|
||||||
|
|
||||||
IRunConfigurationAspect *createRunConfigurationAspect(ProjectExplorer::RunConfiguration *rc) override
|
|
||||||
{
|
|
||||||
return createValgrindRunConfigurationAspect(rc);
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
CallgrindTool *m_tool;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static CallgrindRunControlFactory *theCallgrindRunControlFactory;
|
|
||||||
|
|
||||||
void initCallgrindTool()
|
void initCallgrindTool()
|
||||||
{
|
{
|
||||||
theCallgrindRunControlFactory = new CallgrindRunControlFactory;
|
theCallgrindTool = new CallgrindTool;
|
||||||
ExtensionSystem::PluginManager::addObject(theCallgrindRunControlFactory);
|
|
||||||
|
auto producer = std::bind(&CallgrindTool::createRunTool, theCallgrindTool, _1);
|
||||||
|
RunControl::registerWorker(CALLGRIND_RUN_MODE, producer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void destroyCallgrindTool()
|
void destroyCallgrindTool()
|
||||||
{
|
{
|
||||||
ExtensionSystem::PluginManager::removeObject(theCallgrindRunControlFactory);
|
delete theCallgrindTool;
|
||||||
delete theCallgrindRunControlFactory;
|
theCallgrindTool = nullptr;
|
||||||
theCallgrindRunControlFactory = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -36,7 +36,6 @@
|
|||||||
#include <debugger/analyzer/startremotedialog.h>
|
#include <debugger/analyzer/startremotedialog.h>
|
||||||
|
|
||||||
#include <valgrind/valgrindsettings.h>
|
#include <valgrind/valgrindsettings.h>
|
||||||
#include <valgrind/valgrindruncontrolfactory.h>
|
|
||||||
#include <valgrind/xmlprotocol/errorlistmodel.h>
|
#include <valgrind/xmlprotocol/errorlistmodel.h>
|
||||||
#include <valgrind/xmlprotocol/stackmodel.h>
|
#include <valgrind/xmlprotocol/stackmodel.h>
|
||||||
#include <valgrind/xmlprotocol/error.h>
|
#include <valgrind/xmlprotocol/error.h>
|
||||||
@@ -241,7 +240,7 @@ class MemcheckTool : public QObject
|
|||||||
Q_DECLARE_TR_FUNCTIONS(Valgrind::Internal::MemcheckTool)
|
Q_DECLARE_TR_FUNCTIONS(Valgrind::Internal::MemcheckTool)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MemcheckTool(QObject *parent);
|
MemcheckTool();
|
||||||
|
|
||||||
RunWorker *createRunWorker(RunControl *runControl);
|
RunWorker *createRunWorker(RunControl *runControl);
|
||||||
|
|
||||||
@@ -286,8 +285,7 @@ private:
|
|||||||
bool m_toolBusy = false;
|
bool m_toolBusy = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
MemcheckTool::MemcheckTool(QObject *parent)
|
MemcheckTool::MemcheckTool()
|
||||||
: QObject(parent)
|
|
||||||
{
|
{
|
||||||
m_settings = ValgrindPlugin::globalSettings();
|
m_settings = ValgrindPlugin::globalSettings();
|
||||||
|
|
||||||
@@ -393,9 +391,6 @@ MemcheckTool::MemcheckTool(QObject *parent)
|
|||||||
ActionContainer *menu = ActionManager::actionContainer(Debugger::Constants::M_DEBUG_ANALYZER);
|
ActionContainer *menu = ActionManager::actionContainer(Debugger::Constants::M_DEBUG_ANALYZER);
|
||||||
QString toolTip = tr("Valgrind Analyze Memory uses the Memcheck tool to find memory leaks.");
|
QString toolTip = tr("Valgrind Analyze Memory uses the Memcheck tool to find memory leaks.");
|
||||||
|
|
||||||
RunControl::registerWorkerCreator(MEMCHECK_RUN_MODE, std::bind(&MemcheckTool::createRunWorker, this, _1));
|
|
||||||
RunControl::registerWorkerCreator(MEMCHECK_WITH_GDB_RUN_MODE, std::bind(&MemcheckTool::createRunWorker, this, _1));
|
|
||||||
|
|
||||||
if (!Utils::HostOsInfo::isWindowsHost()) {
|
if (!Utils::HostOsInfo::isWindowsHost()) {
|
||||||
action = new QAction(this);
|
action = new QAction(this);
|
||||||
action->setText(tr("Valgrind Memory Analyzer"));
|
action->setText(tr("Valgrind Memory Analyzer"));
|
||||||
@@ -711,49 +706,21 @@ void MemcheckTool::setBusyCursor(bool busy)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class MemcheckRunControlFactory : public IRunControlFactory
|
static MemcheckTool *theMemcheckTool;
|
||||||
{
|
|
||||||
public:
|
|
||||||
MemcheckRunControlFactory() : m_tool(new MemcheckTool(this)) {}
|
|
||||||
|
|
||||||
bool canRun(RunConfiguration *runConfiguration, Core::Id mode) const override
|
|
||||||
{
|
|
||||||
Q_UNUSED(runConfiguration);
|
|
||||||
return mode == MEMCHECK_RUN_MODE || mode == MEMCHECK_WITH_GDB_RUN_MODE;
|
|
||||||
}
|
|
||||||
|
|
||||||
RunControl *create(RunConfiguration *runConfiguration, Core::Id mode, QString *errorMessage) override
|
|
||||||
{
|
|
||||||
Q_UNUSED(errorMessage);
|
|
||||||
auto runControl = new RunControl(runConfiguration, mode);
|
|
||||||
runControl->createWorker(mode);
|
|
||||||
return runControl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do not create an aspect, let the Callgrind tool create one and use that, too.
|
|
||||||
// IRunConfigurationAspect *createRunConfigurationAspect(ProjectExplorer::RunConfiguration *rc) override
|
|
||||||
// {
|
|
||||||
// return createValgrindRunConfigurationAspect(rc);
|
|
||||||
// }
|
|
||||||
|
|
||||||
public:
|
|
||||||
MemcheckTool *m_tool;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static MemcheckRunControlFactory *theMemcheckRunControlFactory;
|
|
||||||
|
|
||||||
void initMemcheckTool()
|
void initMemcheckTool()
|
||||||
{
|
{
|
||||||
theMemcheckRunControlFactory = new MemcheckRunControlFactory;
|
theMemcheckTool = new MemcheckTool;
|
||||||
ExtensionSystem::PluginManager::addObject(theMemcheckRunControlFactory);
|
|
||||||
|
auto producer = std::bind(&MemcheckTool::createRunWorker, theMemcheckTool, _1);
|
||||||
|
RunControl::registerWorker(MEMCHECK_RUN_MODE, producer);
|
||||||
|
RunControl::registerWorker(MEMCHECK_WITH_GDB_RUN_MODE, producer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void destroyMemcheckTool()
|
void destroyMemcheckTool()
|
||||||
{
|
{
|
||||||
ExtensionSystem::PluginManager::removeObject(theMemcheckRunControlFactory);
|
delete theMemcheckTool;
|
||||||
delete theMemcheckRunControlFactory;
|
theMemcheckTool = nullptr;
|
||||||
theMemcheckRunControlFactory = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -23,8 +23,7 @@ HEADERS += \
|
|||||||
memchecktool.h \
|
memchecktool.h \
|
||||||
memcheckengine.h \
|
memcheckengine.h \
|
||||||
memcheckerrorview.h \
|
memcheckerrorview.h \
|
||||||
suppressiondialog.h \
|
suppressiondialog.h
|
||||||
valgrindruncontrolfactory.h
|
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
valgrindplugin.cpp \
|
valgrindplugin.cpp \
|
||||||
@@ -44,8 +43,7 @@ SOURCES += \
|
|||||||
memchecktool.cpp \
|
memchecktool.cpp \
|
||||||
memcheckengine.cpp \
|
memcheckengine.cpp \
|
||||||
memcheckerrorview.cpp \
|
memcheckerrorview.cpp \
|
||||||
suppressiondialog.cpp \
|
suppressiondialog.cpp
|
||||||
valgrindruncontrolfactory.cpp
|
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
valgrindconfigwidget.ui
|
valgrindconfigwidget.ui
|
||||||
|
@@ -34,7 +34,6 @@ QtcPlugin {
|
|||||||
"valgrindconfigwidget.cpp", "valgrindconfigwidget.h", "valgrindconfigwidget.ui",
|
"valgrindconfigwidget.cpp", "valgrindconfigwidget.h", "valgrindconfigwidget.ui",
|
||||||
"valgrindengine.cpp", "valgrindengine.h",
|
"valgrindengine.cpp", "valgrindengine.h",
|
||||||
"valgrindplugin.cpp", "valgrindplugin.h",
|
"valgrindplugin.cpp", "valgrindplugin.h",
|
||||||
"valgrindruncontrolfactory.cpp", "valgrindruncontrolfactory.h",
|
|
||||||
"valgrindrunner.cpp", "valgrindrunner.h",
|
"valgrindrunner.cpp", "valgrindrunner.h",
|
||||||
"valgrindsettings.cpp", "valgrindsettings.h",
|
"valgrindsettings.cpp", "valgrindsettings.h",
|
||||||
"workarounds.cpp", "workarounds.h",
|
"workarounds.cpp", "workarounds.h",
|
||||||
|
@@ -28,7 +28,6 @@
|
|||||||
|
|
||||||
#include "callgrindtool.h"
|
#include "callgrindtool.h"
|
||||||
#include "memchecktool.h"
|
#include "memchecktool.h"
|
||||||
#include "valgrindruncontrolfactory.h"
|
|
||||||
#include "valgrindsettings.h"
|
#include "valgrindsettings.h"
|
||||||
#include "valgrindconfigwidget.h"
|
#include "valgrindconfigwidget.h"
|
||||||
|
|
||||||
@@ -40,6 +39,7 @@
|
|||||||
#include <coreplugin/dialogs/ioptionspage.h>
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
#include <coreplugin/icontext.h>
|
#include <coreplugin/icontext.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
|
#include <debugger/analyzer/analyzerrunconfigwidget.h>
|
||||||
|
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
|
|
||||||
@@ -88,6 +88,37 @@ private:
|
|||||||
QPointer<QWidget> m_widget;
|
QPointer<QWidget> m_widget;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ValgrindRunConfigurationAspect : public IRunConfigurationAspect
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ValgrindRunConfigurationAspect(RunConfiguration *parent)
|
||||||
|
: IRunConfigurationAspect(parent)
|
||||||
|
{
|
||||||
|
setProjectSettings(new ValgrindProjectSettings());
|
||||||
|
setGlobalSettings(ValgrindPlugin::globalSettings());
|
||||||
|
setId(ANALYZER_VALGRIND_SETTINGS);
|
||||||
|
setDisplayName(QCoreApplication::translate("Valgrind::Internal::ValgrindRunConfigurationAspect",
|
||||||
|
"Valgrind Settings"));
|
||||||
|
setUsingGlobalSettings(true);
|
||||||
|
resetProjectToGlobalSettings();
|
||||||
|
setRunConfigWidgetCreator([this] { return new Debugger::AnalyzerRunConfigWidget(this); });
|
||||||
|
}
|
||||||
|
|
||||||
|
ValgrindRunConfigurationAspect *create(RunConfiguration *parent) const override
|
||||||
|
{
|
||||||
|
return new ValgrindRunConfigurationAspect(parent);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class ValgrindRunControlFactory : public IRunControlFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
IRunConfigurationAspect *createRunConfigurationAspect(RunConfiguration *rc) override
|
||||||
|
{
|
||||||
|
return new ValgrindRunConfigurationAspect(rc);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
ValgrindPlugin::~ValgrindPlugin()
|
ValgrindPlugin::~ValgrindPlugin()
|
||||||
{
|
{
|
||||||
delete theGlobalSettings;
|
delete theGlobalSettings;
|
||||||
@@ -100,6 +131,7 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
|||||||
theGlobalSettings->readSettings();
|
theGlobalSettings->readSettings();
|
||||||
|
|
||||||
addAutoReleasedObject(new ValgrindOptionsPage);
|
addAutoReleasedObject(new ValgrindOptionsPage);
|
||||||
|
addAutoReleasedObject(new ValgrindRunControlFactory);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -1,72 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 Kläralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "valgrindruncontrolfactory.h"
|
|
||||||
|
|
||||||
#include "valgrindengine.h"
|
|
||||||
#include "valgrindsettings.h"
|
|
||||||
#include "valgrindplugin.h"
|
|
||||||
#include "callgrindtool.h"
|
|
||||||
#include "memchecktool.h"
|
|
||||||
|
|
||||||
#include <debugger/analyzer/analyzermanager.h>
|
|
||||||
#include <debugger/analyzer/analyzerrunconfigwidget.h>
|
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
|
||||||
|
|
||||||
using namespace Debugger;
|
|
||||||
using namespace ProjectExplorer;
|
|
||||||
|
|
||||||
namespace Valgrind {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class ValgrindRunConfigurationAspect : public IRunConfigurationAspect
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ValgrindRunConfigurationAspect(RunConfiguration *parent)
|
|
||||||
: IRunConfigurationAspect(parent)
|
|
||||||
{
|
|
||||||
setProjectSettings(new ValgrindProjectSettings());
|
|
||||||
setGlobalSettings(ValgrindPlugin::globalSettings());
|
|
||||||
setId(ANALYZER_VALGRIND_SETTINGS);
|
|
||||||
setDisplayName(QCoreApplication::translate("Valgrind::Internal::ValgrindRunConfigurationAspect", "Valgrind Settings"));
|
|
||||||
setUsingGlobalSettings(true);
|
|
||||||
resetProjectToGlobalSettings();
|
|
||||||
setRunConfigWidgetCreator([this] { return new AnalyzerRunConfigWidget(this); });
|
|
||||||
}
|
|
||||||
|
|
||||||
ValgrindRunConfigurationAspect *create(RunConfiguration *parent) const override
|
|
||||||
{
|
|
||||||
return new ValgrindRunConfigurationAspect(parent);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
IRunConfigurationAspect *createValgrindRunConfigurationAspect(RunConfiguration *rc)
|
|
||||||
{
|
|
||||||
return new ValgrindRunConfigurationAspect(rc);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Valgrind
|
|
@@ -1,36 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 Kläralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <projectexplorer/runconfiguration.h>
|
|
||||||
|
|
||||||
namespace Valgrind {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
ProjectExplorer::IRunConfigurationAspect *createValgrindRunConfigurationAspect(ProjectExplorer::RunConfiguration *rc);
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Valgrind
|
|
Reference in New Issue
Block a user