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:
hjk
2016-01-27 13:27:06 +01:00
parent fa17e27b7f
commit 61709e9266
13 changed files with 39 additions and 57 deletions

View File

@@ -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);

View File

@@ -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)

View File

@@ -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);
});

View File

@@ -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();
}