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