Analyzer: Remove explicit environment and runMode

Instead, use the one in its (Standard)Runnable.

Change-Id: I14dbe91c50d083d11e18d514ec391875c64e3851
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
hjk
2016-01-27 14:42:45 +01:00
parent 76ef8e3c75
commit a2732a347d
3 changed files with 3 additions and 38 deletions

View File

@@ -55,7 +55,6 @@ ValgrindRunControl::ValgrindRunControl(RunConfiguration *runConfiguration, Core:
m_isStopping(false)
{
m_isCustomStart = false;
m_localRunMode = ApplicationLauncher::Gui;
if (runConfiguration)
if (IRunConfigurationAspect *aspect = runConfiguration->extraAspect(ANALYZER_VALGRIND_SETTINGS))
@@ -83,17 +82,12 @@ bool ValgrindRunControl::startEngine()
emit outputReceived(tr("Command line arguments: %1").arg(runnable().debuggeeArgs), DebugFormat);
#endif
StandardRunnable debuggee = runnable();
// FIXME: Consolidate:
debuggee.environment = m_environment;
debuggee.runMode = m_localRunMode;
ValgrindRunner *run = runner();
run->setValgrindExecutable(m_settings->valgrindExecutable());
run->setValgrindArguments(genericToolArguments() + toolArguments());
run->setConnectionParameters(connection().connParams);
run->setUseStartupProject(!m_isCustomStart);
run->setDebuggee(debuggee);
run->setDebuggee(runnable());
connect(run, &ValgrindRunner::processOutputReceived,
this, &ValgrindRunControl::receiveProcessOutput);
@@ -120,16 +114,6 @@ QString ValgrindRunControl::executable() const
return runnable().executable;
}
void ValgrindRunControl::setEnvironment(const Utils::Environment &environment)
{
m_environment = environment;
}
void ValgrindRunControl::setLocalRunMode(ApplicationLauncher::Mode localRunMode)
{
m_localRunMode = localRunMode;
}
QStringList ValgrindRunControl::genericToolArguments() const
{
QTC_ASSERT(m_settings, return QStringList());

View File

@@ -52,8 +52,6 @@ public:
QString executable() const;
void setCustomStart() { m_isCustomStart = true; }
void setEnvironment(const Utils::Environment &environment);
void setLocalRunMode(ProjectExplorer::ApplicationLauncher::Mode localRunMode);
protected:
virtual QString progressTitle() const = 0;
@@ -63,8 +61,6 @@ protected:
ValgrindBaseSettings *m_settings;
QFutureInterface<void> m_progress;
bool m_isCustomStart;
Utils::Environment m_environment;
ProjectExplorer::ApplicationLauncher::Mode m_localRunMode;
private:
void handleProgressCanceled();

View File

@@ -70,21 +70,12 @@ bool ValgrindRunControlFactory::canRun(RunConfiguration *runConfiguration, Core:
RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration, Core::Id mode, QString *errorMessage)
{
Q_UNUSED(errorMessage);
auto runControl = qobject_cast<ValgrindRunControl *>(AnalyzerManager::createRunControl(runConfiguration, mode));
AnalyzerRunControl *runControl = AnalyzerManager::createRunControl(runConfiguration, mode);
QTC_ASSERT(runControl, return 0);
ApplicationLauncher::Mode localRunMode = ApplicationLauncher::Gui;
IDevice::ConstPtr device = DeviceKitInformation::device(runConfiguration->target()->kit());
Utils::Environment environment;
StandardRunnable runnable;
AnalyzerConnection connection;
Runnable rcRunnable = runConfiguration->runnable();
QTC_ASSERT(rcRunnable.is<StandardRunnable>(), return 0);
auto stdRunnable = runConfiguration->runnable().as<StandardRunnable>();
if (device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
environment = stdRunnable.environment;
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.";
@@ -92,21 +83,15 @@ RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration
}
connection.connParams.host = server.serverAddress().toString();
connection.connParams.port = server.serverPort();
localRunMode = stdRunnable.runMode;
} else {
runnable.executable = stdRunnable.executable;
runnable.commandLineArguments = stdRunnable.commandLineArguments;
connection.connParams = device->sshParameters();
}
runControl->setRunnable(runnable);
runControl->setRunnable(runConfiguration->runnable());
runControl->setConnection(connection);
runControl->setLocalRunMode(localRunMode);
runControl->setEnvironment(environment);
return runControl;
}
class ValgrindRunConfigurationAspect : public IRunConfigurationAspect
{
public: