forked from qt-creator/qt-creator
Analyzer: Split AnalyzerStartParameters
... into AnalyzerRunnable and AnalyzerConnection and use the RunControl's storage instead of an own copy in AnalyzerRunControl. This is an intermediate step on the way to remove AnalyzerStartParameters. Change-Id: Iee7c38781b2fd6ef030dcdada1993684cbb34c74 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -60,7 +60,9 @@ AnalyzerRunControl::AnalyzerRunControl(const AnalyzerStartParameters &sp,
|
||||
if (m_workingDirectory.isEmpty())
|
||||
m_workingDirectory = runConfiguration->target()->project()->projectDirectory().toString();
|
||||
}
|
||||
m_sp = sp;
|
||||
|
||||
setRunnable(AnalyzerRunnable(sp));
|
||||
setConnection(AnalyzerConnection(sp));
|
||||
|
||||
connect(this, &AnalyzerRunControl::finished,
|
||||
this, &AnalyzerRunControl::runControlFinished);
|
||||
@@ -68,6 +70,16 @@ AnalyzerRunControl::AnalyzerRunControl(const AnalyzerStartParameters &sp,
|
||||
this, &AnalyzerRunControl::stopIt);
|
||||
}
|
||||
|
||||
const AnalyzerRunnable &AnalyzerRunControl::runnable() const
|
||||
{
|
||||
return RunControl::runnable().as<AnalyzerRunnable>();
|
||||
}
|
||||
|
||||
const AnalyzerConnection &AnalyzerRunControl::connection() const
|
||||
{
|
||||
return RunControl::connection().as<AnalyzerConnection>();
|
||||
}
|
||||
|
||||
void AnalyzerRunControl::stopIt()
|
||||
{
|
||||
if (stop() == RunControl::StoppedSynchronously)
|
||||
|
||||
@@ -50,6 +50,9 @@ public:
|
||||
ProjectExplorer::RunConfiguration *runConfiguration,
|
||||
Core::Id runMode);
|
||||
|
||||
AnalyzerRunControl(ProjectExplorer::RunConfiguration *runConfiguration,
|
||||
Core::Id runMode);
|
||||
|
||||
/// Start analyzation process.
|
||||
virtual bool startEngine() = 0;
|
||||
/// Trigger async stop of the analyzation process.
|
||||
@@ -60,8 +63,8 @@ public:
|
||||
virtual void pause() {}
|
||||
virtual void unpause() {}
|
||||
|
||||
/// The start parameters for this engine.
|
||||
const AnalyzerStartParameters &startParameters() const { return m_sp; }
|
||||
const AnalyzerRunnable &runnable() const;
|
||||
const AnalyzerConnection &connection() const;
|
||||
|
||||
virtual void notifyRemoteSetupDone(quint16) {}
|
||||
virtual void notifyRemoteFinished() {}
|
||||
@@ -96,7 +99,6 @@ protected:
|
||||
private:
|
||||
QString m_displayName; // Default to runConfig->displayName, unless overridden by setDisplayName
|
||||
QString m_workingDirectory;
|
||||
AnalyzerStartParameters m_sp;
|
||||
};
|
||||
} // namespace Analyzer
|
||||
|
||||
|
||||
@@ -38,17 +38,28 @@
|
||||
|
||||
namespace Analyzer {
|
||||
|
||||
class ANALYZER_EXPORT AnalyzerStartParameters
|
||||
class ANALYZER_EXPORT AnalyzerRunnable
|
||||
{
|
||||
public:
|
||||
QString debuggee;
|
||||
QString debuggeeArgs;
|
||||
};
|
||||
|
||||
class ANALYZER_EXPORT AnalyzerConnection
|
||||
{
|
||||
public:
|
||||
QSsh::SshConnectionParameters connParams;
|
||||
QString debuggee;
|
||||
QString debuggeeArgs;
|
||||
QString analyzerHost;
|
||||
QString analyzerSocket;
|
||||
quint16 analyzerPort = 0;
|
||||
};
|
||||
|
||||
class ANALYZER_EXPORT AnalyzerStartParameters
|
||||
: public AnalyzerRunnable, public AnalyzerConnection
|
||||
{
|
||||
public:
|
||||
};
|
||||
|
||||
} // namespace Analyzer
|
||||
|
||||
#endif // ANALYZERSTARTPARAMETERS_H
|
||||
|
||||
@@ -105,9 +105,9 @@ bool QmlProfilerRunControl::startEngine()
|
||||
{
|
||||
QTC_ASSERT(d->m_profilerState, return false);
|
||||
|
||||
if (startParameters().analyzerPort != 0)
|
||||
emit processRunning(startParameters().analyzerPort);
|
||||
else if (startParameters().analyzerSocket.isEmpty())
|
||||
if (connection().analyzerPort != 0)
|
||||
emit processRunning(connection().analyzerPort);
|
||||
else if (connection().analyzerSocket.isEmpty())
|
||||
d->m_noDebugOutputTimer.start();
|
||||
|
||||
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppRunning);
|
||||
@@ -229,7 +229,7 @@ void QmlProfilerRunControl::processIsRunning(quint16 port)
|
||||
d->m_noDebugOutputTimer.stop();
|
||||
|
||||
if (port == 0)
|
||||
port = startParameters().analyzerPort;
|
||||
port = connection().analyzerPort;
|
||||
if (port != 0)
|
||||
emit processRunning(port);
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ void QnxAnalyzeSupport::startExecution()
|
||||
setState(StartingRemoteProcess);
|
||||
|
||||
const QStringList args = QStringList()
|
||||
<< Utils::QtcProcess::splitArgs(m_runControl->startParameters().debuggeeArgs)
|
||||
<< Utils::QtcProcess::splitArgs(m_runControl->runnable().debuggeeArgs)
|
||||
<< QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, m_qmlPort);
|
||||
|
||||
appRunner()->setEnvironment(environment());
|
||||
|
||||
@@ -151,10 +151,9 @@ QStringList MemcheckWithGdbRunControl::toolArguments() const
|
||||
void MemcheckWithGdbRunControl::startDebugger()
|
||||
{
|
||||
const qint64 valgrindPid = runner()->valgrindProcess()->pid();
|
||||
const AnalyzerStartParameters &mySp = startParameters();
|
||||
|
||||
Debugger::DebuggerStartParameters sp;
|
||||
sp.executable = mySp.debuggee;
|
||||
sp.executable = runnable().debuggee;
|
||||
sp.startMode = Debugger::AttachToRemoteServer;
|
||||
sp.displayName = QString::fromLatin1("VGdb %1").arg(valgrindPid);
|
||||
sp.remoteChannel = QString::fromLatin1("| vgdb --pid=%1").arg(valgrindPid);
|
||||
|
||||
@@ -82,21 +82,20 @@ bool ValgrindRunControl::startEngine()
|
||||
this, &ValgrindRunControl::handleProgressFinished);
|
||||
m_progress.reportStarted();
|
||||
|
||||
const AnalyzerStartParameters &sp = startParameters();
|
||||
#if VALGRIND_DEBUG_OUTPUT
|
||||
emit outputReceived(tr("Valgrind options: %1").arg(toolArguments().join(QLatin1Char(' '))), DebugFormat);
|
||||
emit outputReceived(tr("Working directory: %1").arg(sp.workingDirectory), DebugFormat);
|
||||
emit outputReceived(tr("Command line arguments: %1").arg(sp.debuggeeArgs), DebugFormat);
|
||||
emit outputReceived(tr("Working directory: %1").arg(runnable().workingDirectory), DebugFormat);
|
||||
emit outputReceived(tr("Command line arguments: %1").arg(runnable().debuggeeArgs), DebugFormat);
|
||||
#endif
|
||||
|
||||
ValgrindRunner *run = runner();
|
||||
run->setWorkingDirectory(workingDirectory());
|
||||
run->setValgrindExecutable(m_settings->valgrindExecutable());
|
||||
run->setValgrindArguments(genericToolArguments() + toolArguments());
|
||||
run->setDebuggeeExecutable(sp.debuggee);
|
||||
run->setDebuggeeArguments(sp.debuggeeArgs);
|
||||
run->setDebuggeeExecutable(runnable().debuggee);
|
||||
run->setDebuggeeArguments(runnable().debuggeeArgs);
|
||||
run->setEnvironment(m_environment);
|
||||
run->setConnectionParameters(sp.connParams);
|
||||
run->setConnectionParameters(connection().connParams);
|
||||
run->setUseStartupProject(!m_isCustomStart);
|
||||
run->setLocalRunMode(m_localRunMode);
|
||||
|
||||
@@ -122,7 +121,7 @@ void ValgrindRunControl::stopEngine()
|
||||
|
||||
QString ValgrindRunControl::executable() const
|
||||
{
|
||||
return startParameters().debuggee;
|
||||
return runnable().debuggee;
|
||||
}
|
||||
|
||||
void ValgrindRunControl::setEnvironment(const Utils::Environment &environment)
|
||||
|
||||
Reference in New Issue
Block a user