ProjectExplorer/Debugger/RL: Make run control state transitions more uniform

Forward all tool and target activities to run control, and initiate
further state transitions (only) from there. Also, make sure
tool/target's on finished() triggered on all finishing code paths.

After that, the base state handling is sufficient to handle remote linux
running and debugging.

Change-Id: I0150ef249c9ad0b7b8ac7192be6dc860c9ca8fc5
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2017-05-04 12:12:27 +02:00
parent ac59e2be40
commit 2a46b1521d
14 changed files with 385 additions and 500 deletions

View File

@@ -52,8 +52,10 @@
#include <utils/checkablemessagebox.h>
#include <utils/fileutils.h>
#include <utils/portlist.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h>
#include <qmldebug/qmldebugcommandlinearguments.h>
@@ -126,9 +128,7 @@ void DebuggerRunTool::start()
if (rp.startMode == StartInternal
&& rp.inferior.executable.isEmpty()
&& rp.interpreter.isEmpty()) {
appendMessage(tr("No executable specified.") + QLatin1Char('\n'), ErrorMessageFormat);
runControl()->reportApplicationStart();
runControl()->reportApplicationStop();
reportFailure(tr("No executable specified.") + '\n');
return;
}
@@ -177,6 +177,11 @@ void DebuggerRunTool::notifyEngineRemoteSetupFinished(const RemoteSetupResult &r
m_engine->notifyEngineRemoteSetupFinished(result);
}
void DebuggerRunTool::setRemoteParameters(const RemoteSetupResult &result)
{
m_engine->setRemoteParameters(result);
}
void DebuggerRunTool::stop()
{
m_engine->quitDebugger();
@@ -202,6 +207,11 @@ DebuggerStartParameters &DebuggerRunTool::startParameters()
return m_engine->runParameters();
}
int DebuggerRunTool::portsUsedByDebugger() const
{
return isCppDebugging() + isQmlDebugging();
}
void DebuggerRunTool::notifyInferiorIll()
{
m_engine->notifyInferiorIll();
@@ -510,6 +520,12 @@ void DebuggerRunTool::setStartParameters(const DebuggerStartParameters &sp, QStr
void DebuggerRunTool::setRunParameters(const DebuggerRunParameters &rp, QString *errorMessage)
{
int portsUsed = portsUsedByDebugger();
if (portsUsed > device()->freePorts().count()) {
*errorMessage = tr("Cannot debug: Not enough free ports available.");
return;
}
DebuggerRunParameters m_rp = rp;
runControl()->setDisplayName(m_rp.displayName);
@@ -540,6 +556,14 @@ void DebuggerRunTool::setRunParameters(const DebuggerRunParameters &rp, QString
m_engine->setRunTool(this);
}
void DebuggerRunTool::appendSolibSearchPath(const QString &str)
{
QString path = str;
DebuggerStartParameters &sp = startParameters();
path.replace("%{sysroot}", sp.sysRoot);
sp.solibSearchPath.append(path);
}
DebuggerRunTool::~DebuggerRunTool()
{
disconnect();