forked from qt-creator/qt-creator
Valgrind: Adapt to Analyzer base changes
Change-Id: I27ef2465591421378794c982b4df8d40cb9cb87c Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
@@ -131,12 +131,9 @@ void ValgrindPlugin::extensionsInitialized()
|
|||||||
auto mcWidgetCreator = [mcTool] { return mcTool->createWidgets(); };
|
auto mcWidgetCreator = [mcTool] { return mcTool->createWidgets(); };
|
||||||
auto cgTool = new CallgrindTool(this);
|
auto cgTool = new CallgrindTool(this);
|
||||||
auto cgWidgetCreator = [cgTool] { return cgTool->createWidgets(); };
|
auto cgWidgetCreator = [cgTool] { return cgTool->createWidgets(); };
|
||||||
auto cgRunControlCreator = [cgTool](const AnalyzerStartParameters &sp,
|
auto cgRunControlCreator = [cgTool](const AnalyzerStartParameters &,
|
||||||
RunConfiguration *runConfiguration, Core::Id) {
|
RunConfiguration *runConfiguration, Core::Id) {
|
||||||
auto runControl = cgTool->createRunControl(runConfiguration);
|
return cgTool->createRunControl(runConfiguration);
|
||||||
runControl->setRunnable(AnalyzerRunnable(sp));
|
|
||||||
runControl->setConnection(AnalyzerConnection(sp));
|
|
||||||
return runControl;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!Utils::HostOsInfo::isWindowsHost()) {
|
if (!Utils::HostOsInfo::isWindowsHost()) {
|
||||||
@@ -144,13 +141,9 @@ void ValgrindPlugin::extensionsInitialized()
|
|||||||
action->setActionId("Memcheck.Local");
|
action->setActionId("Memcheck.Local");
|
||||||
action->setToolId("Memcheck");
|
action->setToolId("Memcheck");
|
||||||
action->setWidgetCreator(mcWidgetCreator);
|
action->setWidgetCreator(mcWidgetCreator);
|
||||||
action->setRunControlCreator([mcTool](const AnalyzerStartParameters &sp,
|
action->setRunControlCreator([mcTool](const AnalyzerStartParameters &,
|
||||||
ProjectExplorer::RunConfiguration *runConfig, Core::Id runMode)
|
ProjectExplorer::RunConfiguration *runConfig, Core::Id runMode) {
|
||||||
{
|
return mcTool->createRunControl(runConfig, runMode);
|
||||||
auto runControl = mcTool->createRunControl(runConfig, runMode);
|
|
||||||
runControl->setRunnable(AnalyzerRunnable(sp));
|
|
||||||
runControl->setConnection(AnalyzerConnection(sp));
|
|
||||||
return runControl;
|
|
||||||
});
|
});
|
||||||
action->setToolMode(DebugMode);
|
action->setToolMode(DebugMode);
|
||||||
action->setRunMode(MEMCHECK_RUN_MODE);
|
action->setRunMode(MEMCHECK_RUN_MODE);
|
||||||
@@ -165,13 +158,9 @@ void ValgrindPlugin::extensionsInitialized()
|
|||||||
action->setActionId("MemcheckWithGdb.Local");
|
action->setActionId("MemcheckWithGdb.Local");
|
||||||
action->setToolId("MemcheckWithGdb");
|
action->setToolId("MemcheckWithGdb");
|
||||||
action->setWidgetCreator([mcgTool] { return mcgTool->createWidgets(); });
|
action->setWidgetCreator([mcgTool] { return mcgTool->createWidgets(); });
|
||||||
action->setRunControlCreator([mcgTool](const AnalyzerStartParameters &sp,
|
action->setRunControlCreator([mcgTool](const AnalyzerStartParameters &,
|
||||||
ProjectExplorer::RunConfiguration *runConfig, Core::Id runMode)
|
ProjectExplorer::RunConfiguration *runConfig, Core::Id runMode) {
|
||||||
{
|
return mcgTool->createRunControl(runConfig, runMode);
|
||||||
auto runControl = mcgTool->createRunControl(runConfig, runMode);
|
|
||||||
runControl->setRunnable(AnalyzerRunnable(sp));
|
|
||||||
runControl->setConnection(AnalyzerConnection(sp));
|
|
||||||
return runControl;
|
|
||||||
});
|
});
|
||||||
action->setToolMode(DebugMode);
|
action->setToolMode(DebugMode);
|
||||||
action->setRunMode(MEMCHECK_WITH_GDB_RUN_MODE);
|
action->setRunMode(MEMCHECK_WITH_GDB_RUN_MODE);
|
||||||
|
|||||||
@@ -71,18 +71,21 @@ bool ValgrindRunControlFactory::canRun(RunConfiguration *runConfiguration, Core:
|
|||||||
RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration, Core::Id mode, QString *errorMessage)
|
RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration, Core::Id mode, QString *errorMessage)
|
||||||
{
|
{
|
||||||
Q_UNUSED(errorMessage);
|
Q_UNUSED(errorMessage);
|
||||||
|
auto runControl = qobject_cast<ValgrindRunControl *>(AnalyzerManager::createRunControl(runConfiguration, mode));
|
||||||
|
QTC_ASSERT(runControl, return 0);
|
||||||
|
|
||||||
ApplicationLauncher::Mode localRunMode = ApplicationLauncher::Gui;
|
ApplicationLauncher::Mode localRunMode = ApplicationLauncher::Gui;
|
||||||
Utils::Environment environment;
|
Utils::Environment environment;
|
||||||
AnalyzerStartParameters sp;
|
AnalyzerRunnable runnable;
|
||||||
|
AnalyzerConnection connection;
|
||||||
QString workingDirectory;
|
QString workingDirectory;
|
||||||
if (auto rc1 = qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) {
|
if (auto rc1 = qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) {
|
||||||
EnvironmentAspect *aspect = runConfiguration->extraAspect<EnvironmentAspect>();
|
EnvironmentAspect *aspect = runConfiguration->extraAspect<EnvironmentAspect>();
|
||||||
if (aspect)
|
if (aspect)
|
||||||
environment = aspect->environment();
|
environment = aspect->environment();
|
||||||
workingDirectory = rc1->workingDirectory();
|
workingDirectory = rc1->workingDirectory();
|
||||||
sp.debuggee = rc1->executable();
|
runnable.debuggee = rc1->executable();
|
||||||
sp.debuggeeArgs = rc1->commandLineArguments();
|
runnable.debuggeeArgs = rc1->commandLineArguments();
|
||||||
const IDevice::ConstPtr device =
|
const IDevice::ConstPtr device =
|
||||||
DeviceKitInformation::device(runConfiguration->target()->kit());
|
DeviceKitInformation::device(runConfiguration->target()->kit());
|
||||||
QTC_ASSERT(device, return 0);
|
QTC_ASSERT(device, return 0);
|
||||||
@@ -92,25 +95,23 @@ RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration
|
|||||||
qWarning() << "Cannot open port on host for profiling.";
|
qWarning() << "Cannot open port on host for profiling.";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
sp.connParams.host = server.serverAddress().toString();
|
connection.connParams.host = server.serverAddress().toString();
|
||||||
sp.connParams.port = server.serverPort();
|
connection.connParams.port = server.serverPort();
|
||||||
localRunMode = rc1->runMode();
|
localRunMode = rc1->runMode();
|
||||||
} else if (RemoteLinux::AbstractRemoteLinuxRunConfiguration *rc2 =
|
} else if (auto rc2 = qobject_cast<RemoteLinux::AbstractRemoteLinuxRunConfiguration *>(runConfiguration)) {
|
||||||
qobject_cast<RemoteLinux::AbstractRemoteLinuxRunConfiguration *>(runConfiguration)) {
|
runnable.debuggee = rc2->remoteExecutableFilePath();
|
||||||
sp.debuggee = rc2->remoteExecutableFilePath();
|
runnable.debuggeeArgs = rc2->arguments();
|
||||||
sp.connParams = DeviceKitInformation::device(rc2->target()->kit())->sshParameters();
|
connection.connParams = DeviceKitInformation::device(rc2->target()->kit())->sshParameters();
|
||||||
sp.debuggeeArgs = rc2->arguments();
|
|
||||||
} else {
|
} else {
|
||||||
QTC_ASSERT(false, return 0);
|
QTC_ASSERT(false, return 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto analyzerRunControl = AnalyzerManager::createRunControl(sp, runConfiguration, mode);
|
runControl->setRunnable(runnable);
|
||||||
if (auto valgrindRunControl = qobject_cast<ValgrindRunControl *>(analyzerRunControl)) {
|
runControl->setConnection(connection);
|
||||||
valgrindRunControl->setLocalRunMode(localRunMode);
|
runControl->setLocalRunMode(localRunMode);
|
||||||
valgrindRunControl->setEnvironment(environment);
|
runControl->setEnvironment(environment);
|
||||||
valgrindRunControl->setWorkingDirectory(workingDirectory);
|
runControl->setWorkingDirectory(workingDirectory);
|
||||||
}
|
return runControl;
|
||||||
return analyzerRunControl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user