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