Commit 61709e92 authored by hjk's avatar hjk

Analyzer: Use a StandardRunnable instead of an AnalyzerRunnable

... with a lot potential to code consolidation.

Change-Id: I4d3a7fcc1cc6ae8763799f18cf9701695f387791
Reviewed-by: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
parent fa17e27b
......@@ -66,9 +66,9 @@ AnalyzerRunControl::AnalyzerRunControl(RunConfiguration *runConfiguration, Core:
this, &AnalyzerRunControl::stopIt);
}
const AnalyzerRunnable &AnalyzerRunControl::runnable() const
const StandardRunnable &AnalyzerRunControl::runnable() const
{
return RunControl::runnable().as<AnalyzerRunnable>();
return RunControl::runnable().as<StandardRunnable>();
}
const AnalyzerConnection &AnalyzerRunControl::connection() const
......
......@@ -30,6 +30,7 @@
#include "analyzerstartparameters.h"
#include <projectexplorer/runconfiguration.h>
#include <projectexplorer/runnables.h>
#include <utils/outputformat.h>
......@@ -58,7 +59,7 @@ public:
virtual void pause() {}
virtual void unpause() {}
const AnalyzerRunnable &runnable() const;
const ProjectExplorer::StandardRunnable &runnable() const;
const AnalyzerConnection &connection() const;
virtual void notifyRemoteSetupDone(quint16) {}
......
......@@ -27,24 +27,14 @@
#define ANALYZERSTARTPARAMETERS_H
#include "analyzerbase_global.h"
#include "analyzerconstants.h"
#include <coreplugin/id.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/runnables.h>
#include <ssh/sshconnection.h>
#include <utils/environment.h>
#include <QMetaType>
namespace Analyzer {
class ANALYZER_EXPORT AnalyzerRunnable
{
public:
QString debuggee;
QString debuggeeArgs;
};
class ANALYZER_EXPORT AnalyzerConnection
{
public:
......
......@@ -30,6 +30,7 @@
#include <coreplugin/icore.h>
#include <projectexplorer/kitchooser.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/runnables.h>
#include <ssh/sshconnection.h>
#include <QDialogButtonBox>
......@@ -136,17 +137,13 @@ QSsh::SshConnectionParameters StartRemoteDialog::sshParams() const
return device->sshParameters();
}
AnalyzerRunnable StartRemoteDialog::runnable() const
StandardRunnable StartRemoteDialog::runnable() const
{
AnalyzerRunnable r;
r.debuggee = d->executable->text();
r.debuggeeArgs = d->arguments->text();
StandardRunnable r;
r.executable = d->executable->text();
r.commandLineArguments = d->arguments->text();
r.workingDirectory = d->workingDirectory->text();
return r;
}
QString StartRemoteDialog::workingDirectory() const
{
return d->workingDirectory->text();
}
} // namespace Analyzer
......@@ -32,12 +32,12 @@
namespace QSsh { class SshConnectionParameters; }
namespace ProjectExplorer { class StandardRunnable; }
namespace Analyzer {
namespace Internal { class StartRemoteDialogPrivate; }
class AnalyzerRunnable;
class ANALYZER_EXPORT StartRemoteDialog : public QDialog
{
Q_OBJECT
......@@ -47,8 +47,7 @@ public:
~StartRemoteDialog();
QSsh::SshConnectionParameters sshParams() const;
AnalyzerRunnable runnable() const;
QString workingDirectory() const;
ProjectExplorer::StandardRunnable runnable() const;
private slots:
void validate();
......
......@@ -194,9 +194,9 @@ RunControl *IosRunControlFactory::create(RunConfiguration *runConfig,
if (device.isNull())
return 0;
auto iosRunConfig = qobject_cast<IosRunConfiguration *>(runConfig);
AnalyzerRunnable runnable;
runnable.debuggee = iosRunConfig->localExecutable().toUserOutput();
runnable.debuggeeArgs = iosRunConfig->commandLineArguments();
StandardRunnable runnable;
runnable.executable = iosRunConfig->localExecutable().toUserOutput();
runnable.commandLineArguments = iosRunConfig->commandLineArguments();
AnalyzerConnection connection;
connection.analyzerHost = QLatin1String("localhost");
runControl->setRunnable(runnable);
......
......@@ -73,10 +73,7 @@ RunControl *QmlProfilerRunControlFactory::create(RunConfiguration *runConfigurat
{
QTC_ASSERT(canRun(runConfiguration, mode), return 0);
QTC_ASSERT(runConfiguration->runnable().is<StandardRunnable>(), return 0);
auto &rcRunnable = runConfiguration->runnable().as<StandardRunnable>();
AnalyzerRunnable runnable;
runnable.debuggee = rcRunnable.executable;
runnable.debuggeeArgs = rcRunnable.commandLineArguments;
auto runnable = runConfiguration->runnable().as<StandardRunnable>();
Kit *kit = runConfiguration->target()->kit();
AnalyzerConnection connection;
......@@ -104,8 +101,8 @@ RunControl *QmlProfilerRunControlFactory::create(RunConfiguration *runConfigurat
runControl->setConnection(connection);
LocalQmlProfilerRunner::Configuration conf;
conf.executable = runnable.debuggee;
conf.executableArguments = runnable.debuggeeArgs;
conf.executable = runnable.executable;
conf.executableArguments = runnable.commandLineArguments;
conf.workingDirectory = runControl->workingDirectory();
conf.socket = connection.analyzerSocket;
if (EnvironmentAspect *environment = runConfiguration->extraAspect<EnvironmentAspect>())
......
......@@ -103,7 +103,7 @@ void QnxAnalyzeSupport::startExecution()
setState(StartingRemoteProcess);
const QStringList args = QStringList()
<< QtcProcess::splitArgs(m_runControl->runnable().debuggeeArgs)
<< QtcProcess::splitArgs(m_runControl->runnable().commandLineArguments)
<< QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, m_qmlPort);
appRunner()->setEnvironment(m_runnable.environment);
......
......@@ -145,10 +145,7 @@ RunControl *QnxRunControlFactory::create(RunConfiguration *runConfig, Core::Id m
return 0;
AnalyzerRunControl *runControl = AnalyzerManager::createRunControl(runConfig, mode);
QTC_ASSERT(runControl, return 0);
AnalyzerRunnable runnable;
runnable.debuggee = rc->remoteExecutableFilePath();
runnable.debuggeeArgs = rc->arguments();
runControl->setRunnable(runnable);
runControl->setRunnable(runConfig->runnable());
AnalyzerConnection connection;
connection.connParams = device->sshParameters();
connection.analyzerHost = connection.connParams.host;
......
......@@ -151,7 +151,7 @@ void MemcheckWithGdbRunControl::startDebugger()
const qint64 valgrindPid = runner()->valgrindProcess()->pid();
Debugger::DebuggerStartParameters sp;
sp.executable = runnable().debuggee;
sp.executable = runnable().executable;
sp.startMode = Debugger::AttachToRemoteServer;
sp.displayName = QString::fromLatin1("VGdb %1").arg(valgrindPid);
sp.remoteChannel = QString::fromLatin1("| vgdb --pid=%1").arg(valgrindPid);
......
......@@ -83,10 +83,9 @@ bool ValgrindRunControl::startEngine()
emit outputReceived(tr("Command line arguments: %1").arg(runnable().debuggeeArgs), DebugFormat);
#endif
StandardRunnable debuggee;
StandardRunnable debuggee = runnable();
// FIXME: Consolidate:
debuggee.workingDirectory = workingDirectory();
debuggee.executable = runnable().debuggee;
debuggee.commandLineArguments = runnable().debuggeeArgs;
debuggee.environment = m_environment;
debuggee.runMode = m_localRunMode;
......@@ -119,7 +118,7 @@ void ValgrindRunControl::stopEngine()
QString ValgrindRunControl::executable() const
{
return runnable().debuggee;
return runnable().executable;
}
void ValgrindRunControl::setEnvironment(const Utils::Environment &environment)
......
......@@ -193,12 +193,13 @@ void ValgrindPlugin::extensionsInitialized()
return;
ValgrindRunControl *rc = mcTool->createRunControl(runConfig, MEMCHECK_RUN_MODE);
QTC_ASSERT(rc, return);
rc->setRunnable(dlg.runnable());
const auto runnable = dlg.runnable();
rc->setRunnable(runnable);
AnalyzerConnection connection;
connection.connParams = dlg.sshParams();
rc->setConnection(connection);
rc->setDisplayName(dlg.runnable().debuggee);
rc->setWorkingDirectory(dlg.workingDirectory());
rc->setDisplayName(runnable.executable);
rc->setWorkingDirectory(runnable.workingDirectory);
rc->setCustomStart();
ProjectExplorerPlugin::startRunControl(rc, MEMCHECK_RUN_MODE);
});
......@@ -217,12 +218,13 @@ void ValgrindPlugin::extensionsInitialized()
return;
ValgrindRunControl *rc = cgTool->createRunControl(runConfig);
QTC_ASSERT(rc, return);
rc->setRunnable(dlg.runnable());
const auto runnable = dlg.runnable();
rc->setRunnable(runnable);
AnalyzerConnection connection;
connection.connParams = dlg.sshParams();
rc->setConnection(connection);
rc->setDisplayName(dlg.runnable().debuggee);
rc->setWorkingDirectory(dlg.workingDirectory());
rc->setDisplayName(runnable.executable);
rc->setWorkingDirectory(runnable.workingDirectory);
rc->setCustomStart();
ProjectExplorerPlugin::startRunControl(rc, CALLGRIND_RUN_MODE);
});
......
......@@ -76,7 +76,7 @@ RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration
ApplicationLauncher::Mode localRunMode = ApplicationLauncher::Gui;
IDevice::ConstPtr device = DeviceKitInformation::device(runConfiguration->target()->kit());
Utils::Environment environment;
AnalyzerRunnable runnable;
StandardRunnable runnable;
AnalyzerConnection connection;
QString workingDirectory;
Runnable rcRunnable = runConfiguration->runnable();
......@@ -85,8 +85,8 @@ RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration
if (device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
environment = stdRunnable.environment;
workingDirectory = stdRunnable.workingDirectory;
runnable.debuggee = stdRunnable.executable;
runnable.debuggeeArgs = stdRunnable.commandLineArguments;
runnable.executable = stdRunnable.executable;
runnable.commandLineArguments = stdRunnable.commandLineArguments;
QTcpServer server;
if (!server.listen(QHostAddress::LocalHost) && !server.listen(QHostAddress::LocalHostIPv6)) {
qWarning() << "Cannot open port on host for profiling.";
......@@ -96,8 +96,8 @@ RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration
connection.connParams.port = server.serverPort();
localRunMode = stdRunnable.runMode;
} else {
runnable.debuggee = stdRunnable.executable;
runnable.debuggeeArgs = stdRunnable.commandLineArguments;
runnable.executable = stdRunnable.executable;
runnable.commandLineArguments = stdRunnable.commandLineArguments;
connection.connParams = device->sshParameters();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment