Valgrind: Adapt to Analyzer base changes

Change-Id: I27ef2465591421378794c982b4df8d40cb9cb87c
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
hjk
2016-01-20 08:24:02 +01:00
parent 2053e77e38
commit d64f27f738
2 changed files with 26 additions and 36 deletions

View File

@@ -131,12 +131,9 @@ void ValgrindPlugin::extensionsInitialized()
auto mcWidgetCreator = [mcTool] { return mcTool->createWidgets(); };
auto cgTool = new CallgrindTool(this);
auto cgWidgetCreator = [cgTool] { return cgTool->createWidgets(); };
auto cgRunControlCreator = [cgTool](const AnalyzerStartParameters &sp,
auto cgRunControlCreator = [cgTool](const AnalyzerStartParameters &,
RunConfiguration *runConfiguration, Core::Id) {
auto runControl = cgTool->createRunControl(runConfiguration);
runControl->setRunnable(AnalyzerRunnable(sp));
runControl->setConnection(AnalyzerConnection(sp));
return runControl;
return cgTool->createRunControl(runConfiguration);
};
if (!Utils::HostOsInfo::isWindowsHost()) {
@@ -144,13 +141,9 @@ void ValgrindPlugin::extensionsInitialized()
action->setActionId("Memcheck.Local");
action->setToolId("Memcheck");
action->setWidgetCreator(mcWidgetCreator);
action->setRunControlCreator([mcTool](const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfig, Core::Id runMode)
{
auto runControl = mcTool->createRunControl(runConfig, runMode);
runControl->setRunnable(AnalyzerRunnable(sp));
runControl->setConnection(AnalyzerConnection(sp));
return runControl;
action->setRunControlCreator([mcTool](const AnalyzerStartParameters &,
ProjectExplorer::RunConfiguration *runConfig, Core::Id runMode) {
return mcTool->createRunControl(runConfig, runMode);
});
action->setToolMode(DebugMode);
action->setRunMode(MEMCHECK_RUN_MODE);
@@ -165,13 +158,9 @@ void ValgrindPlugin::extensionsInitialized()
action->setActionId("MemcheckWithGdb.Local");
action->setToolId("MemcheckWithGdb");
action->setWidgetCreator([mcgTool] { return mcgTool->createWidgets(); });
action->setRunControlCreator([mcgTool](const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfig, Core::Id runMode)
{
auto runControl = mcgTool->createRunControl(runConfig, runMode);
runControl->setRunnable(AnalyzerRunnable(sp));
runControl->setConnection(AnalyzerConnection(sp));
return runControl;
action->setRunControlCreator([mcgTool](const AnalyzerStartParameters &,
ProjectExplorer::RunConfiguration *runConfig, Core::Id runMode) {
return mcgTool->createRunControl(runConfig, runMode);
});
action->setToolMode(DebugMode);
action->setRunMode(MEMCHECK_WITH_GDB_RUN_MODE);

View File

@@ -71,18 +71,21 @@ 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));
QTC_ASSERT(runControl, return 0);
ApplicationLauncher::Mode localRunMode = ApplicationLauncher::Gui;
Utils::Environment environment;
AnalyzerStartParameters sp;
AnalyzerRunnable runnable;
AnalyzerConnection connection;
QString workingDirectory;
if (auto rc1 = qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) {
EnvironmentAspect *aspect = runConfiguration->extraAspect<EnvironmentAspect>();
if (aspect)
environment = aspect->environment();
workingDirectory = rc1->workingDirectory();
sp.debuggee = rc1->executable();
sp.debuggeeArgs = rc1->commandLineArguments();
runnable.debuggee = rc1->executable();
runnable.debuggeeArgs = rc1->commandLineArguments();
const IDevice::ConstPtr device =
DeviceKitInformation::device(runConfiguration->target()->kit());
QTC_ASSERT(device, return 0);
@@ -92,25 +95,23 @@ RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration
qWarning() << "Cannot open port on host for profiling.";
return 0;
}
sp.connParams.host = server.serverAddress().toString();
sp.connParams.port = server.serverPort();
connection.connParams.host = server.serverAddress().toString();
connection.connParams.port = server.serverPort();
localRunMode = rc1->runMode();
} else if (RemoteLinux::AbstractRemoteLinuxRunConfiguration *rc2 =
qobject_cast<RemoteLinux::AbstractRemoteLinuxRunConfiguration *>(runConfiguration)) {
sp.debuggee = rc2->remoteExecutableFilePath();
sp.connParams = DeviceKitInformation::device(rc2->target()->kit())->sshParameters();
sp.debuggeeArgs = rc2->arguments();
} else if (auto rc2 = qobject_cast<RemoteLinux::AbstractRemoteLinuxRunConfiguration *>(runConfiguration)) {
runnable.debuggee = rc2->remoteExecutableFilePath();
runnable.debuggeeArgs = rc2->arguments();
connection.connParams = DeviceKitInformation::device(rc2->target()->kit())->sshParameters();
} else {
QTC_ASSERT(false, return 0);
}
auto analyzerRunControl = AnalyzerManager::createRunControl(sp, runConfiguration, mode);
if (auto valgrindRunControl = qobject_cast<ValgrindRunControl *>(analyzerRunControl)) {
valgrindRunControl->setLocalRunMode(localRunMode);
valgrindRunControl->setEnvironment(environment);
valgrindRunControl->setWorkingDirectory(workingDirectory);
}
return analyzerRunControl;
runControl->setRunnable(runnable);
runControl->setConnection(connection);
runControl->setLocalRunMode(localRunMode);
runControl->setEnvironment(environment);
runControl->setWorkingDirectory(workingDirectory);
return runControl;
}