Commit 8150209f authored by hjk's avatar hjk

Analyzer: Slim down AnalyzerStartParameters

* SysRoot can always be determined from kit.
* Pass around RunMode as extra parameter
  not as part of AnalyzerStartParameters.
  That's closer to the pattern used elsewhere.
* Environment was always initialized from the runconfig's
  EnvironmentAspect. The tools can do that directly.
* Provide setter for display name for cases where
  it is not equal to RunConfiguration::displayName

Change-Id: I811a0d7cdeb55cc37a16a593b3942abb567a2150
Reviewed-by: default avatarBogDan Vatra <bogdan@kdab.com>
Reviewed-by: default avatarUlf Hermann <ulf.hermann@theqtcompany.com>
parent 31206920
......@@ -715,12 +715,11 @@ void AnalyzerManager::handleToolFinished()
d->handleToolFinished();
}
AnalyzerRunControl *AnalyzerManager::createRunControl(
const AnalyzerStartParameters &sp, RunConfiguration *runConfiguration)
AnalyzerRunControl *AnalyzerManager::createRunControl(const AnalyzerStartParameters &sp, RunConfiguration *runConfiguration, Id runMode)
{
foreach (AnalyzerAction *action, d->m_actions) {
if (action->runMode() == sp.runMode)
return action->runControlCreator()(sp, runConfiguration);
if (action->runMode() == runMode)
return action->runControlCreator()(sp, runConfiguration, runMode);
}
return 0;
}
......
......@@ -34,9 +34,7 @@
#include "analyzerbase_global.h"
#include <coreplugin/id.h>
#include <QObject>
#include <projectexplorer/runconfiguration.h>
QT_BEGIN_NAMESPACE
class QDockWidget;
......@@ -44,7 +42,6 @@ class QAction;
QT_END_NAMESPACE
namespace Utils { class FancyMainWindow; }
namespace ProjectExplorer { class RunConfiguration; }
namespace Analyzer {
......@@ -86,7 +83,7 @@ public:
static QAction *stopAction();
static AnalyzerRunControl *createRunControl(const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration);
ProjectExplorer::RunConfiguration *runConfiguration, Core::Id runMode);
};
} // namespace Analyzer
......
......@@ -35,6 +35,10 @@
#include "analyzermanager.h"
#include "analyzerstartparameters.h"
#include <projectexplorer/project.h>
#include <projectexplorer/runconfigurationaspects.h>
#include <projectexplorer/target.h>
#include <QDebug>
#include <QAction>
......@@ -49,11 +53,18 @@ using namespace ProjectExplorer;
namespace Analyzer {
AnalyzerRunControl::AnalyzerRunControl(const AnalyzerStartParameters &sp,
RunConfiguration *runConfiguration)
: RunControl(runConfiguration, sp.runMode)
RunConfiguration *runConfiguration, Core::Id runMode)
: RunControl(runConfiguration, runMode)
{
setIcon(Icons::ANALYZER_CONTROL_START);
if (runConfiguration) {
m_displayName = runConfiguration->displayName();
if (auto aspect = runConfiguration->extraAspect<WorkingDirectoryAspect>())
m_workingDirectory = aspect->workingDirectory().toString();
if (m_workingDirectory.isEmpty())
m_workingDirectory = runConfiguration->target()->project()->projectDirectory().toString();
}
m_sp = sp;
connect(this, &AnalyzerRunControl::finished,
......@@ -74,6 +85,11 @@ void AnalyzerRunControl::runControlFinished()
AnalyzerManager::handleToolFinished();
}
QString AnalyzerRunControl::workingDirectory() const
{
return m_workingDirectory;
}
void AnalyzerRunControl::start()
{
AnalyzerManager::handleToolStarted();
......@@ -101,7 +117,17 @@ bool AnalyzerRunControl::isRunning() const
QString AnalyzerRunControl::displayName() const
{
return m_sp.displayName;
return m_displayName;
}
void AnalyzerRunControl::setDisplayName(const QString &displayName)
{
m_displayName = displayName;
}
void AnalyzerRunControl::setWorkingDirectory(const QString &workingDirectory)
{
m_workingDirectory = workingDirectory;
}
} // namespace Analyzer
......@@ -32,17 +32,13 @@
#ifndef ANALYZERRUNCONTROL_H
#define ANALYZERRUNCONTROL_H
#include "analyzerbase_global.h"
#include "analyzerstartparameters.h"
#include <projectexplorer/applicationlauncher.h>
#include <projectexplorer/runconfiguration.h>
#include "analyzerstartparameters.h"
#include <utils/outputformat.h>
#include <QObject>
#include <QString>
namespace Analyzer {
/**
......@@ -56,7 +52,8 @@ class ANALYZER_EXPORT AnalyzerRunControl : public ProjectExplorer::RunControl
public:
AnalyzerRunControl(const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration);
ProjectExplorer::RunConfiguration *runConfiguration,
Core::Id runMode);
/// Start analyzation process.
virtual bool startEngine() = 0;
......@@ -74,14 +71,16 @@ public:
virtual void notifyRemoteSetupDone(quint16) {}
virtual void notifyRemoteFinished() {}
bool m_isRunning;
// ProjectExplorer::RunControl
void start();
StopResult stop();
bool isRunning() const;
QString displayName() const;
void setDisplayName(const QString &displayName);
QString workingDirectory() const;
void setWorkingDirectory(const QString &workingDirectory);
public slots:
virtual void logApplicationMessage(const QString &, Utils::OutputFormat) {}
......@@ -95,6 +94,13 @@ signals:
private:
bool supportsReRunning() const { return false; }
protected:
bool m_isRunning;
private:
QString m_displayName; // Default to runConfig->displayName, unless overridden by setDisplayName
QString m_workingDirectory;
AnalyzerStartParameters m_sp;
};
} // namespace Analyzer
......
......@@ -34,33 +34,21 @@
#include "analyzerbase_global.h"
#include "analyzerconstants.h"
#include <QMetaType>
#include <coreplugin/id.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <ssh/sshconnection.h>
#include <utils/environment.h>
#include <projectexplorer/applicationlauncher.h>
#include <projectexplorer/projectexplorerconstants.h>
namespace Analyzer {
#include <QMetaType>
// Note: This is part of the "soft interface" of the analyzer plugin.
// Do not add anything that needs implementation in a .cpp file.
namespace Analyzer {
class ANALYZER_EXPORT AnalyzerStartParameters
{
public:
Core::Id runMode = ProjectExplorer::Constants::NO_RUN_MODE;
QSsh::SshConnectionParameters connParams;
ProjectExplorer::ApplicationLauncher::Mode localRunMode
= ProjectExplorer::ApplicationLauncher::Gui;
QString debuggee;
QString debuggeeArgs;
QString displayName;
Utils::Environment environment;
QString workingDirectory;
QString sysroot;
QString analyzerHost;
QString analyzerSocket;
quint16 analyzerPort = 0;
......@@ -68,6 +56,4 @@ public:
} // namespace Analyzer
Q_DECLARE_METATYPE(Analyzer::AnalyzerStartParameters)
#endif // ANALYZERSTARTPARAMETERS_H
......@@ -104,8 +104,8 @@ public:
/// Returns a new engine for the given start parameters.
/// Called each time the tool is launched.
typedef std::function<AnalyzerRunControl *(const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration)> RunControlCreator;
typedef std::function<AnalyzerRunControl *(const AnalyzerStartParameters &,
ProjectExplorer::RunConfiguration *runConfiguration, Core::Id runMode)> RunControlCreator;
RunControlCreator runControlCreator() const { return m_runControlCreator; }
void setRunControlCreator(const RunControlCreator &creator) { m_runControlCreator = creator; }
......
......@@ -56,11 +56,6 @@ RunControl *AndroidAnalyzeSupport::createAnalyzeRunControl(AndroidRunConfigurati
{
Target *target = runConfig->target();
AnalyzerStartParameters params;
params.runMode = runMode;
params.displayName = AndroidManager::packageName(target);
params.sysroot = SysRootKitInformation::sysRoot(target->kit()).toString();
// TODO: Not sure if these are the right paths.
params.workingDirectory = target->project()->projectDirectory().toString();
if (runMode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) {
QTcpServer server;
QTC_ASSERT(server.listen(QHostAddress::LocalHost)
......@@ -68,8 +63,11 @@ RunControl *AndroidAnalyzeSupport::createAnalyzeRunControl(AndroidRunConfigurati
params.analyzerHost = server.serverAddress().toString();
}
AnalyzerRunControl *analyzerRunControl = AnalyzerManager::createRunControl(params, runConfig);
(void) new AndroidAnalyzeSupport(runConfig, analyzerRunControl);
AnalyzerRunControl *analyzerRunControl = AnalyzerManager::createRunControl(params, runConfig, runMode);
if (analyzerRunControl) {
analyzerRunControl->setDisplayName(AndroidManager::packageName(target));
(void) new AndroidAnalyzeSupport(runConfig, analyzerRunControl);
}
return analyzerRunControl;
}
......
......@@ -41,8 +41,8 @@
#include <projectexplorer/runconfigurationaspects.h>
#include <projectexplorer/target.h>
#include <utils/pathchooser.h>
#include <utils/detailswidget.h>
#include <utils/pathchooser.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <utils/stringutils.h>
......
......@@ -80,8 +80,6 @@ RunControl *IosAnalyzeSupport::createAnalyzeRunControl(IosRunConfiguration *runC
if (device.isNull())
return 0;
AnalyzerStartParameters params;
params.runMode = ProjectExplorer::Constants::QML_PROFILER_RUN_MODE;
params.sysroot = SysRootKitInformation::sysRoot(target->kit()).toString();
params.debuggee = runConfig->localExecutable().toUserOutput();
params.debuggeeArgs = Utils::QtcProcess::joinArgs(runConfig->commandLineArguments());
params.analyzerHost = QLatin1String("localhost");
......@@ -90,9 +88,10 @@ RunControl *IosAnalyzeSupport::createAnalyzeRunControl(IosRunConfiguration *runC
if (iosDevice.isNull())
return 0;
}
params.displayName = runConfig->applicationName();
AnalyzerRunControl *analyzerRunControl = AnalyzerManager::createRunControl(params, runConfig);
AnalyzerRunControl *analyzerRunControl =
AnalyzerManager::createRunControl(params, runConfig, ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
if (analyzerRunControl)
analyzerRunControl->setDisplayName(runConfig->applicationName());
(void) new IosAnalyzeSupport(runConfig, analyzerRunControl, false, true);
return analyzerRunControl;
}
......
......@@ -60,7 +60,7 @@ Analyzer::AnalyzerRunControl *LocalQmlProfilerRunner::createLocalRunControl(
QTC_ASSERT(device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE, return 0);
Analyzer::AnalyzerRunControl *rc = Analyzer::AnalyzerManager::createRunControl(
sp, runConfiguration);
sp, runConfiguration, ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
QmlProfilerRunControl *engine = qobject_cast<QmlProfilerRunControl *>(rc);
if (!engine) {
delete rc;
......@@ -70,9 +70,10 @@ Analyzer::AnalyzerRunControl *LocalQmlProfilerRunner::createLocalRunControl(
Configuration conf;
conf.executable = sp.debuggee;
conf.executableArguments = sp.debuggeeArgs;
conf.workingDirectory = sp.workingDirectory;
conf.environment = sp.environment;
conf.workingDirectory = rc->workingDirectory();
conf.socket = sp.analyzerSocket;
if (EnvironmentAspect *environment = runConfiguration->extraAspect<EnvironmentAspect>())
conf.environment = environment->environment();
conf.port = sp.analyzerPort;
if (conf.executable.isEmpty()) {
......
......@@ -60,7 +60,7 @@ bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorS
auto tool = new QmlProfilerTool(this);
auto widgetCreator = [tool] { return tool->createWidgets(); };
auto runControlCreator = [tool](const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration) {
ProjectExplorer::RunConfiguration *runConfiguration, Core::Id) {
return tool->createRunControl(sp, runConfiguration);
};
......
......@@ -66,12 +66,10 @@ namespace QmlProfiler {
class QmlProfilerRunControl::QmlProfilerRunControlPrivate
{
public:
QmlProfilerRunControlPrivate() : m_running(false) {}
QmlProfilerStateManager *m_profilerState;
QmlProfilerStateManager *m_profilerState = 0;
QTimer m_noDebugOutputTimer;
QmlDebug::QmlOutputParser m_outputParser;
bool m_running;
bool m_running = false;
};
//
......@@ -79,11 +77,10 @@ public:
//
QmlProfilerRunControl::QmlProfilerRunControl(const AnalyzerStartParameters &sp,
RunConfiguration *runConfiguration) :
AnalyzerRunControl(sp, runConfiguration), d(new QmlProfilerRunControlPrivate)
RunConfiguration *runConfiguration)
: AnalyzerRunControl(sp, runConfiguration, ProjectExplorer::Constants::QML_PROFILER_RUN_MODE)
, d(new QmlProfilerRunControlPrivate)
{
d->m_profilerState = 0;
// Only wait 4 seconds for the 'Waiting for connection' on application output, then just try to connect
// (application output might be redirected / blocked)
d->m_noDebugOutputTimer.setSingleShot(true);
......
......@@ -69,18 +69,12 @@ bool QmlProfilerRunControlFactory::canRun(RunConfiguration *runConfiguration, Co
static AnalyzerStartParameters createQmlProfilerStartParameters(RunConfiguration *runConfiguration)
{
AnalyzerStartParameters sp;
EnvironmentAspect *environment = runConfiguration->extraAspect<EnvironmentAspect>();
// FIXME: This is only used to communicate the connParams settings.
LocalApplicationRunConfiguration *rc =
qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
auto rc = qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
QTC_ASSERT(rc, return sp);
if (environment)
sp.environment = environment->environment();
sp.workingDirectory = rc->workingDirectory();
sp.debuggee = rc->executable();
sp.debuggeeArgs = rc->commandLineArguments();
sp.displayName = rc->displayName();
const QtSupport::BaseQtVersion *version =
QtSupport::QtKitInformation::qtVersion(runConfiguration->target()->kit());
......@@ -103,7 +97,6 @@ RunControl *QmlProfilerRunControlFactory::create(RunConfiguration *runConfigurat
QTC_ASSERT(canRun(runConfiguration, mode), return 0);
AnalyzerStartParameters sp = createQmlProfilerStartParameters(runConfiguration);
sp.runMode = mode;
return LocalQmlProfilerRunner::createLocalRunControl(runConfiguration, sp, errorMessage);
}
......
......@@ -197,6 +197,15 @@ QmlProfilerTool::~QmlProfilerTool()
delete d;
}
static QString sysroot(RunConfiguration *runConfig)
{
QTC_ASSERT(runConfig, return QString());
Kit *k = runConfig->target()->kit();
if (k && SysRootKitInformation::hasSysRoot(k))
return SysRootKitInformation::sysRoot(runConfig->target()->kit()).toString();
return QString();
}
AnalyzerRunControl *QmlProfilerTool::createRunControl(const AnalyzerStartParameters &sp,
RunConfiguration *runConfiguration)
{
......@@ -231,7 +240,7 @@ AnalyzerRunControl *QmlProfilerTool::createRunControl(const AnalyzerStartParamet
projectDirectory = project->projectDirectory().toString();
}
populateFileFinder(projectDirectory, sp.sysroot);
populateFileFinder(projectDirectory, sysroot(runConfiguration));
if (sp.analyzerSocket.isEmpty())
connect(engine, &QmlProfilerRunControl::processRunning,
......@@ -242,15 +251,6 @@ AnalyzerRunControl *QmlProfilerTool::createRunControl(const AnalyzerStartParamet
return engine;
}
static QString sysroot(RunConfiguration *runConfig)
{
QTC_ASSERT(runConfig, return QString());
Kit *k = runConfig->target()->kit();
if (k && SysRootKitInformation::hasSysRoot(k))
return SysRootKitInformation::sysRoot(runConfig->target()->kit()).toString();
return QString();
}
QWidget *QmlProfilerTool::createWidgets()
{
QTC_ASSERT(!d->m_viewContainer, return 0);
......@@ -526,7 +526,6 @@ void QmlProfilerTool::startRemoteTool()
sp.connParams = device->sshParameters();
sp.analyzerHost = device->qmlProfilerHost();
}
sp.sysroot = SysRootKitInformation::sysRoot(kit).toString();
sp.analyzerPort = port;
AnalyzerRunControl *rc = createRunControl(sp, 0);
......
......@@ -95,7 +95,7 @@ static DebuggerStartParameters createDebuggerStartParameters(QnxRunConfiguration
return params;
}
static AnalyzerStartParameters createAnalyzerStartParameters(const QnxRunConfiguration *runConfig, Core::Id mode)
static AnalyzerStartParameters createAnalyzerStartParameters(const QnxRunConfiguration *runConfig)
{
AnalyzerStartParameters params;
Target *target = runConfig->target();
......@@ -105,18 +105,12 @@ static AnalyzerStartParameters createAnalyzerStartParameters(const QnxRunConfigu
if (device.isNull())
return params;
params.runMode = mode;
params.debuggee = runConfig->remoteExecutableFilePath();
params.debuggeeArgs = runConfig->arguments().join(QLatin1Char(' '));
params.connParams = DeviceKitInformation::device(runConfig->target()->kit())->sshParameters();
params.displayName = runConfig->displayName();
params.sysroot = SysRootKitInformation::sysRoot(runConfig->target()->kit()).toString();
params.analyzerHost = params.connParams.host;
params.analyzerPort = params.connParams.port;
if (EnvironmentAspect *environment = runConfig->extraAspect<EnvironmentAspect>())
params.environment = environment->environment();
return params;
}
......@@ -170,10 +164,9 @@ RunControl *QnxRunControlFactory::create(RunConfiguration *runConfig, Core::Id m
return runControl;
}
if (mode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) {
const AnalyzerStartParameters params = createAnalyzerStartParameters(rc, mode);
AnalyzerRunControl *runControl = AnalyzerManager::createRunControl(params, runConfig);
const AnalyzerStartParameters params = createAnalyzerStartParameters(rc);
AnalyzerRunControl *runControl = AnalyzerManager::createRunControl(params, runConfig, mode);
QnxAnalyzeSupport * const analyzeSupport = new QnxAnalyzeSupport(rc, runControl);
connect(runControl, SIGNAL(finished()), analyzeSupport, SLOT(handleProfilingFinished()));
return runControl;
......
......@@ -76,34 +76,13 @@ public:
using namespace Internal;
AnalyzerStartParameters RemoteLinuxAnalyzeSupport::startParameters(const RunConfiguration *runConfig,
Core::Id runMode)
{
AnalyzerStartParameters params;
params.runMode = runMode;
params.connParams = DeviceKitInformation::device(runConfig->target()->kit())->sshParameters();
params.displayName = runConfig->displayName();
params.sysroot = SysRootKitInformation::sysRoot(runConfig->target()->kit()).toString();
params.analyzerHost = params.connParams.host;
auto rc = qobject_cast<const AbstractRemoteLinuxRunConfiguration *>(runConfig);
QTC_ASSERT(rc, return params);
params.debuggee = rc->remoteExecutableFilePath();
params.debuggeeArgs = Utils::QtcProcess::Arguments::createUnixArgs(rc->arguments()).toString();
params.workingDirectory = rc->workingDirectory();
params.environment = rc->environment();
return params;
}
RemoteLinuxAnalyzeSupport::RemoteLinuxAnalyzeSupport(AbstractRemoteLinuxRunConfiguration *runConfig,
AnalyzerRunControl *engine, Core::Id runMode)
: AbstractRemoteLinuxRunSupport(runConfig, engine),
d(new RemoteLinuxAnalyzeSupportPrivate(engine, runMode))
{
connect(d->runControl, SIGNAL(starting(const Analyzer::AnalyzerRunControl*)),
SLOT(handleRemoteSetupRequested()));
connect(d->runControl.data(), &AnalyzerRunControl::starting,
this, &RemoteLinuxAnalyzeSupport::handleRemoteSetupRequested);
connect(&d->outputParser, &QmlDebug::QmlOutputParser::waitingForConnectionOnPort,
this, &RemoteLinuxAnalyzeSupport::remoteIsRunning);
connect(engine, &RunControl::finished,
......
......@@ -52,9 +52,6 @@ class REMOTELINUX_EXPORT RemoteLinuxAnalyzeSupport : public AbstractRemoteLinuxR
{
Q_OBJECT
public:
static Analyzer::AnalyzerStartParameters startParameters(const ProjectExplorer::RunConfiguration *runConfig,
Core::Id runMode);
RemoteLinuxAnalyzeSupport(AbstractRemoteLinuxRunConfiguration *runConfig,
Analyzer::AnalyzerRunControl *engine, Core::Id runMode);
~RemoteLinuxAnalyzeSupport();
......
......@@ -116,10 +116,12 @@ RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Co
}
if (mode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) {
AnalyzerStartParameters params = RemoteLinuxAnalyzeSupport::startParameters(runConfig, mode);
AnalyzerStartParameters params;
params.connParams = DeviceKitInformation::device(runConfig->target()->kit())->sshParameters();
params.analyzerHost = params.connParams.host;
auto * const rc = qobject_cast<AbstractRemoteLinuxRunConfiguration *>(runConfig);
QTC_ASSERT(rc, return 0);
AnalyzerRunControl *runControl = AnalyzerManager::createRunControl(params, runConfig);
AnalyzerRunControl *runControl = AnalyzerManager::createRunControl(params, runConfig, mode);
(void) new RemoteLinuxAnalyzeSupport(rc, runControl, mode);
return runControl;
}
......
......@@ -46,7 +46,7 @@ using namespace Valgrind::Internal;
CallgrindRunControl::CallgrindRunControl(const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration)
: ValgrindRunControl(sp, runConfiguration)
: ValgrindRunControl(sp, runConfiguration, CALLGRIND_RUN_MODE)
, m_markAsPaused(false)
{
connect(&m_runner, &Callgrind::CallgrindRunner::finished,
......
......@@ -30,6 +30,7 @@
****************************************************************************/
#include "memcheckengine.h"
#include "memchecktool.h"
#include "valgrindprocess.h"
#include "valgrindsettings.h"
#include "xmlprotocol/error.h"
......@@ -56,8 +57,8 @@ namespace Valgrind {
namespace Internal {
MemcheckRunControl::MemcheckRunControl(const AnalyzerStartParameters &sp,
RunConfiguration *runConfiguration)
: ValgrindRunControl(sp, runConfiguration)
RunConfiguration *runConfiguration, Core::Id runMode)
: ValgrindRunControl(sp, runConfiguration, runMode)
{
connect(&m_parser, &XmlProtocol::ThreadedParser::error,
this, &MemcheckRunControl::parserError);
......@@ -135,7 +136,7 @@ QStringList MemcheckRunControl::suppressionFiles() const
MemcheckWithGdbRunControl::MemcheckWithGdbRunControl(const AnalyzerStartParameters &sp,
RunConfiguration *runConfiguration)
: MemcheckRunControl(sp, runConfiguration)
: MemcheckRunControl(sp, runConfiguration, MEMCHECK_WITH_GDB_RUN_MODE)
{
connect(&m_runner, &Memcheck::MemcheckRunner::started,
this, &MemcheckWithGdbRunControl::startDebugger);
......
......@@ -46,7 +46,8 @@ class MemcheckRunControl : public ValgrindRunControl
public:
MemcheckRunControl(const Analyzer::AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration);
ProjectExplorer::RunConfiguration *runConfiguration,
Core::Id runMode);
bool startEngine() override;
void stopEngine() override;
......
......@@ -429,13 +429,17 @@ QWidget *MemcheckTool::createWidgets()
}
MemcheckRunControl *MemcheckTool::createRunControl(const AnalyzerStartParameters &sp,
RunConfiguration *runConfiguration)
RunConfiguration *runConfiguration,
Core::Id runMode)
{
m_frameFinder->setFiles(runConfiguration ? runConfiguration->target()
->project()->files(Project::AllFiles) : QStringList());
MemcheckRunControl *engine = createMemcheckRunControl(sp, runConfiguration);
MemcheckRunControl *engine = 0;
if (runMode == MEMCHECK_RUN_MODE)
engine = new MemcheckRunControl(sp, runConfiguration, runMode);
else
engine = new MemcheckWithGdbRunControl(sp, runConfiguration);
connect(engine, &MemcheckRunControl::starting, this, &MemcheckTool::engineStarting);
connect(engine, &MemcheckRunControl::parserError, this, &MemcheckTool::parserError);
connect(engine, &MemcheckRunControl::internalParserError, this, &MemcheckTool::internalParserError);
......@@ -567,12 +571,6 @@ int MemcheckTool::updateUiAfterFinishedHelper()
return issuesFound;
}
MemcheckRunControl *MemcheckTool::createMemcheckRunControl(const AnalyzerStartParameters &sp,
RunConfiguration *runConfiguration)
{
return new MemcheckRunControl(sp, runConfiguration);
}
void MemcheckTool::engineFinished()
{
const int issuesFound = updateUiAfterFinishedHelper();
......@@ -595,17 +593,5 @@ void MemcheckTool::setBusyCursor(bool busy)
m_errorView->setCursor(cursor);
}
MemcheckWithGdbTool::MemcheckWithGdbTool(QObject *parent) :
MemcheckTool(parent)
{
setObjectName(QLatin1String("MemcheckWithGdbTool"));
}
MemcheckRunControl *MemcheckWithGdbTool::createMemcheckRunControl(const AnalyzerStartParameters &sp,
RunConfiguration *runConfiguration)
{
return new MemcheckWithGdbRunControl(sp, runConfiguration);
}
} // namespace Internal
} // namespace Valgrind
......@@ -91,7 +91,8 @@ public:
QWidget *createWidgets();
MemcheckRunControl *createRunControl(const Analyzer::AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration);
ProjectExplorer::RunConfiguration *runConfiguration,
Core::Id runMode);
private slots:
void settingsDestroyed(QObject *settings);
......@@ -115,11 +116,6 @@ private:
void updateFromSettings();
int updateUiAfterFinishedHelper();
protected:
virtual MemcheckRunControl *createMemcheckRunControl(
const Analyzer::AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration);
private:
ValgrindBaseSettings *m_settings;
QMenu *m_filterMenu;
......@@ -138,16 +134,6 @@ private:
QAction *m_goNext;
};
class MemcheckWithGdbTool : public MemcheckTool
{
public:
MemcheckWithGdbTool(QObject *parent);