forked from qt-creator/qt-creator
Analyzer: Replace StartMode with a useStartupProject boolean
This is what it is on the top level. The change makes it obvious that in the valgrind(-derived) plugins the value is later wrongly used to make a decision on whether to run the valgrind process locally or remotely. But that's isolated in valgrind now and can be fixed there. Change-Id: I6fa5e669dec1f9e2cdebe42a1591d15144082a21 Reviewed-by: Anton Kreuzkamp <anton.kreuzkamp@kdab.com> Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com> Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
This commit is contained in:
@@ -101,7 +101,9 @@ bool MemcheckRunner::start()
|
||||
QTC_ASSERT(d->parser, return false);
|
||||
|
||||
// The remote case is handled in localHostAddressRetrieved().
|
||||
if (startMode() == Analyzer::StartLocal) {
|
||||
// FIXME: We start confusing "use startup project" with a "local/remote"
|
||||
// decision here.
|
||||
if (useStartupProject()) {
|
||||
startServers(QHostAddress(QHostAddress::LocalHost));
|
||||
setValgrindArguments(memcheckLogArguments() + valgrindArguments());
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ bool ValgrindRunControl::startEngine()
|
||||
run->setDebuggeeArguments(sp.debuggeeArgs);
|
||||
run->setEnvironment(sp.environment);
|
||||
run->setConnectionParameters(sp.connParams);
|
||||
run->setStartMode(sp.startMode);
|
||||
run->setUseStartupProject(sp.useStartupProject);
|
||||
run->setLocalRunMode(sp.localRunMode);
|
||||
|
||||
connect(run, &ValgrindRunner::processOutputReceived,
|
||||
|
||||
@@ -156,7 +156,6 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
||||
action->setText(tr("Valgrind Memory Analyzer"));
|
||||
action->setToolTip(memcheckToolTip);
|
||||
action->setMenuGroup(Constants::G_ANALYZER_TOOLS);
|
||||
action->setStartMode(StartLocal);
|
||||
action->setEnabled(false);
|
||||
AnalyzerManager::addAction(action);
|
||||
|
||||
@@ -170,7 +169,6 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
||||
action->setText(tr("Valgrind Memory Analyzer with GDB"));
|
||||
action->setToolTip(memcheckWithGdbToolTip);
|
||||
action->setMenuGroup(Constants::G_ANALYZER_TOOLS);
|
||||
action->setStartMode(StartLocal);
|
||||
action->setEnabled(false);
|
||||
AnalyzerManager::addAction(action);
|
||||
|
||||
@@ -184,7 +182,6 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
||||
action->setText(tr("Valgrind Function Profiler"));
|
||||
action->setToolTip(callgrindToolTip);
|
||||
action->setMenuGroup(Constants::G_ANALYZER_TOOLS);
|
||||
action->setStartMode(StartLocal);
|
||||
action->setEnabled(false);
|
||||
AnalyzerManager::addAction(action);
|
||||
}
|
||||
@@ -199,7 +196,7 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
||||
action->setText(tr("Valgrind Memory Analyzer (External Remote Application)"));
|
||||
action->setToolTip(memcheckToolTip);
|
||||
action->setMenuGroup(Constants::G_ANALYZER_REMOTE_TOOLS);
|
||||
action->setStartMode(StartRemote);
|
||||
action->setUseSpecialStart();
|
||||
AnalyzerManager::addAction(action);
|
||||
|
||||
action = new AnalyzerAction(this);
|
||||
@@ -212,7 +209,7 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
||||
action->setText(tr("Valgrind Function Profiler (External Remote Application)"));
|
||||
action->setToolTip(callgrindToolTip);
|
||||
action->setMenuGroup(Constants::G_ANALYZER_REMOTE_TOOLS);
|
||||
action->setStartMode(StartRemote);
|
||||
action->setUseSpecialStart();
|
||||
AnalyzerManager::addAction(action);
|
||||
|
||||
addAutoReleasedObject(new ValgrindRunControlFactory());
|
||||
|
||||
@@ -94,11 +94,10 @@ RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration
|
||||
}
|
||||
sp.connParams.host = server.serverAddress().toString();
|
||||
sp.connParams.port = server.serverPort();
|
||||
sp.startMode = StartLocal;
|
||||
sp.localRunMode = static_cast<ApplicationLauncher::Mode>(rc1->runMode());
|
||||
} else if (RemoteLinux::AbstractRemoteLinuxRunConfiguration *rc2 =
|
||||
qobject_cast<RemoteLinux::AbstractRemoteLinuxRunConfiguration *>(runConfiguration)) {
|
||||
sp.startMode = StartRemote;
|
||||
sp.useStartupProject = false; // FIXME: This is wrong.
|
||||
sp.debuggee = rc2->remoteExecutableFilePath();
|
||||
sp.connParams = DeviceKitInformation::device(rc2->target()->kit())->sshParameters();
|
||||
sp.debuggeeArgs = rc2->arguments().join(QLatin1Char(' '));
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
process(0),
|
||||
channelMode(QProcess::SeparateChannels),
|
||||
finished(false),
|
||||
startMode(Analyzer::StartLocal),
|
||||
useStartupProject(true),
|
||||
localRunMode(ProjectExplorer::ApplicationLauncher::Gui)
|
||||
{
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
QString debuggeeExecutable;
|
||||
QString debuggeeArguments;
|
||||
QString workingdir;
|
||||
Analyzer::StartMode startMode;
|
||||
bool useStartupProject;
|
||||
ProjectExplorer::ApplicationLauncher::Mode localRunMode;
|
||||
QSsh::SshConnectionParameters connParams;
|
||||
};
|
||||
@@ -178,11 +178,6 @@ void ValgrindRunner::setDebuggeeArguments(const QString &arguments)
|
||||
d->debuggeeArguments = arguments;
|
||||
}
|
||||
|
||||
Analyzer::StartMode ValgrindRunner::startMode() const
|
||||
{
|
||||
return d->startMode;
|
||||
}
|
||||
|
||||
void ValgrindRunner::setLocalRunMode(ProjectExplorer::ApplicationLauncher::Mode localRunMode)
|
||||
{
|
||||
d->localRunMode = localRunMode;
|
||||
@@ -193,11 +188,6 @@ ProjectExplorer::ApplicationLauncher::Mode ValgrindRunner::localRunMode() const
|
||||
return d->localRunMode;
|
||||
}
|
||||
|
||||
void ValgrindRunner::setStartMode(Analyzer::StartMode startMode)
|
||||
{
|
||||
d->startMode = startMode;
|
||||
}
|
||||
|
||||
const QSsh::SshConnectionParameters &ValgrindRunner::connectionParameters() const
|
||||
{
|
||||
return d->connParams;
|
||||
@@ -228,6 +218,16 @@ void ValgrindRunner::setProcessChannelMode(QProcess::ProcessChannelMode mode)
|
||||
d->channelMode = mode;
|
||||
}
|
||||
|
||||
void ValgrindRunner::setUseStartupProject(bool useStartupProject)
|
||||
{
|
||||
d->useStartupProject = useStartupProject;
|
||||
}
|
||||
|
||||
bool ValgrindRunner::useStartupProject() const
|
||||
{
|
||||
return d->useStartupProject;
|
||||
}
|
||||
|
||||
void ValgrindRunner::waitForFinished() const
|
||||
{
|
||||
if (d->finished || !d->process)
|
||||
@@ -240,7 +240,8 @@ void ValgrindRunner::waitForFinished() const
|
||||
|
||||
bool ValgrindRunner::start()
|
||||
{
|
||||
d->run(new ValgrindProcess(d->startMode == Analyzer::StartLocal, d->connParams, 0, this));
|
||||
// FIXME: This wrongly uses "useStartupProject" for a Local/Remote decision.
|
||||
d->run(new ValgrindProcess(d->useStartupProject, d->connParams, 0, this));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,8 +72,8 @@ public:
|
||||
void setEnvironment(const Utils::Environment &environment);
|
||||
void setProcessChannelMode(QProcess::ProcessChannelMode mode);
|
||||
|
||||
void setStartMode(Analyzer::StartMode startMode);
|
||||
Analyzer::StartMode startMode() const;
|
||||
void setUseStartupProject(bool useStartupProject);
|
||||
bool useStartupProject() const;
|
||||
|
||||
void setLocalRunMode(ProjectExplorer::ApplicationLauncher::Mode localRunMode);
|
||||
ProjectExplorer::ApplicationLauncher::Mode localRunMode() const;
|
||||
|
||||
Reference in New Issue
Block a user