Commit c2ebce68 authored by hjk's avatar hjk

Debugger: Reduce explicit DebuggerRunControl use

Aim is to replace it with its ProjectExplorer::RunControl base.

Change-Id: I30f837050e7c016887dc4b6cfef10b947f4f88ed
Reviewed-by: Christian Stenger's avatarChristian Stenger <christian.stenger@qt.io>
parent 0de18abb
......@@ -150,11 +150,11 @@ AndroidDebugSupport::AndroidDebugSupport(RunControl *runControl)
connect(runControl, &RunControl::finished,
m_runner, &AndroidRunner::stop);
connect(this->runControl(), &DebuggerRunControl::requestRemoteSetup,
connect(this->runControl()->toolRunner(), &DebuggerRunTool::requestRemoteSetup,
m_runner, &AndroidRunner::start);
// FIXME: Move signal to base class and generalize handling.
connect(this->runControl(), &DebuggerRunControl::aboutToNotifyInferiorSetupOk,
connect(this->runControl()->toolRunner(), &DebuggerRunTool::aboutToNotifyInferiorSetupOk,
m_runner, &AndroidRunner::remoteDebuggerRunning);
connect(m_runner, &AndroidRunner::remoteServerRunning,
......
......@@ -336,8 +336,8 @@ void TestRunner::debugTests()
sp.displayName = config->displayName();
QString errorMessage;
Debugger::DebuggerRunControl *runControl = Debugger::createDebuggerRunControl(
sp, config->runConfiguration(), &errorMessage);
auto runControl = Debugger::createDebuggerRunControl(sp, config->runConfiguration(),
&errorMessage);
if (!runControl) {
emit testResultReady(TestResultPtr(new FaultyTestResult(Result::MessageFatal,
......@@ -374,7 +374,7 @@ void TestRunner::debugTests()
outputreader, &QObject::deleteLater);
}
connect(this, &TestRunner::requestStopTestRun, runControl, &Debugger::DebuggerRunControl::stop);
connect(this, &TestRunner::requestStopTestRun, runControl, &ProjectExplorer::RunControl::stop);
connect(runControl, &Debugger::DebuggerRunControl::finished, this, &TestRunner::onFinished);
ProjectExplorer::ProjectExplorerPlugin::startRunControl(runControl);
}
......
......@@ -46,7 +46,7 @@ BareMetalDebugSupport::BareMetalDebugSupport(RunControl *runControl)
: ToolRunner(runControl)
, m_appLauncher(new ProjectExplorer::ApplicationLauncher(this))
{
connect(this->runControl(), &Debugger::DebuggerRunControl::requestRemoteSetup,
connect(this->runControl()->toolRunner(), &Debugger::DebuggerRunTool::requestRemoteSetup,
this, &BareMetalDebugSupport::remoteSetupRequested);
connect(runControl, &RunControl::finished,
this, &BareMetalDebugSupport::debuggingFinished);
......
......@@ -135,7 +135,7 @@ RunControl *BareMetalRunControlFactory::create(
if (p->startupMode() == GdbServerProvider::StartupOnNetwork)
sp.remoteSetupNeeded = true;
DebuggerRunControl *runControl = createDebuggerRunControl(sp, rc, errorMessage, mode);
auto runControl = createDebuggerRunControl(sp, rc, errorMessage, mode);
if (runControl && sp.remoteSetupNeeded)
new BareMetalDebugSupport(runControl);
......
......@@ -343,7 +343,7 @@ public:
bool isMasterEngine() const { return m_engine->isMasterEngine(); }
DebuggerRunTool *runTool() const
{ return m_masterEngine ? m_masterEngine->runTool() : m_runTool.data(); }
DebuggerRunControl *runControl() const { return runTool()->runControl(); }
RunControl *runControl() const { return runTool()->runControl(); }
void setRemoteSetupState(RemoteSetupState state);
DebuggerEngine *m_engine = nullptr; // Not owned.
......@@ -1518,7 +1518,7 @@ void DebuggerEngine::progressPing()
d->m_progress.setProgressValue(progress);
}
DebuggerRunControl *DebuggerEngine::runControl() const
RunControl *DebuggerEngine::runControl() const
{
return d->runControl();
}
......
......@@ -53,7 +53,6 @@ class ProcessHandle;
namespace Debugger {
class DebuggerRunControl;
class RemoteSetupResult;
class DebuggerRunTool;
......@@ -433,7 +432,7 @@ protected:
void setTargetState(DebuggerState state);
void setMasterEngine(DebuggerEngine *masterEngine);
DebuggerRunControl *runControl() const;
ProjectExplorer::RunControl *runControl() const;
Terminal *terminal() const;
static QString msgStopped(const QString &reason = QString());
......
......@@ -1914,7 +1914,7 @@ void DebuggerPluginPrivate::onCurrentProjectChanged(Project *project)
for (int i = 0, n = m_snapshotHandler->size(); i != n; ++i) {
// Run controls might be deleted during exit.
if (DebuggerEngine *engine = m_snapshotHandler->at(i)) {
if (DebuggerRunControl *runControl = engine->runControl()) {
if (RunControl *runControl = engine->runControl()) {
RunConfiguration *rc = runControl->runConfiguration();
if (rc == activeRc) {
m_snapshotHandler->setCurrentIndex(i);
......
......@@ -541,11 +541,11 @@ DebuggerRunTool::DebuggerRunTool(RunControl *runControl, const DebuggerRunParame
connect(runControl, &RunControl::finished,
this, &DebuggerRunTool::handleFinished);
connect(m_engine, &DebuggerEngine::requestRemoteSetup,
this->runControl(), &DebuggerRunControl::requestRemoteSetup);
this, &DebuggerRunTool::requestRemoteSetup);
connect(m_engine, &DebuggerEngine::stateChanged,
this->runControl(), &DebuggerRunControl::stateChanged);
this, &DebuggerRunTool::stateChanged);
connect(m_engine, &DebuggerEngine::aboutToNotifyInferiorSetupOk,
this->runControl(), &DebuggerRunControl::aboutToNotifyInferiorSetupOk);
this, &DebuggerRunTool::aboutToNotifyInferiorSetupOk);
}
DebuggerRunTool::~DebuggerRunTool()
......@@ -692,10 +692,10 @@ RunControl *createAndScheduleRun(const DebuggerRunParameters &rp, Kit *kit)
/**
* Main entry point for target plugins.
*/
DebuggerRunControl *createDebuggerRunControl(const DebuggerStartParameters &sp,
RunConfiguration *runConfig,
QString *errorMessage,
Core::Id runMode)
RunControl *createDebuggerRunControl(const DebuggerStartParameters &sp,
RunConfiguration *runConfig,
QString *errorMessage,
Core::Id runMode)
{
QTC_ASSERT(runConfig, return nullptr);
auto runControl = new DebuggerRunControl(runConfig, runMode);
......
......@@ -37,10 +37,11 @@ class RemoteSetupResult;
class DebuggerStartParameters;
class DebuggerRunControl;
DEBUGGER_EXPORT DebuggerRunControl *createDebuggerRunControl(const DebuggerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfig,
QString *errorMessage,
Core::Id runMode = ProjectExplorer::Constants::DEBUG_RUN_MODE);
DEBUGGER_EXPORT ProjectExplorer::RunControl *
createDebuggerRunControl(const DebuggerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfig,
QString *errorMessage,
Core::Id runMode = ProjectExplorer::Constants::DEBUG_RUN_MODE);
class DEBUGGER_EXPORT DebuggerRunTool : public ProjectExplorer::ToolRunner
{
......@@ -76,6 +77,11 @@ public:
DebuggerStartParameters &startParameters(); // Used in Boot2Qt.
signals:
void stateChanged(Debugger::DebuggerState state);
void aboutToNotifyInferiorSetupOk();
void requestRemoteSetup();
private:
Internal::DebuggerEngine *m_engine = nullptr; // Master engine
QStringList m_errors;
......@@ -94,11 +100,6 @@ public:
DebuggerRunTool *toolRunner() const;
signals:
void requestRemoteSetup();
void aboutToNotifyInferiorSetupOk();
void stateChanged(Debugger::DebuggerState state);
public:
DebuggerRunTool *m_debuggerTool = nullptr;
};
......
......@@ -166,7 +166,7 @@ IosDebugSupport::IosDebugSupport(RunControl *runControl, bool cppDebug, bool qml
m_runner(new IosRunner(this, runControl, cppDebug,
qmlDebug ? QmlDebug::QmlDebuggerServices : QmlDebug::NoQmlDebugServices))
{
connect(this->runControl(), &DebuggerRunControl::requestRemoteSetup,
connect(this->runControl()->toolRunner(), &DebuggerRunTool::requestRemoteSetup,
m_runner, &IosRunner::start);
connect(runControl, &RunControl::finished,
m_runner, &IosRunner::stop);
......
......@@ -134,7 +134,7 @@ void QnxAttachDebugSupport::attachToProcess()
sp.solibSearchPath = QnxUtils::searchPaths(qtVersion);
QString errorMessage;
Debugger::DebuggerRunControl *runControl = Debugger::createDebuggerRunControl(sp, 0, &errorMessage);
auto runControl = Debugger::createDebuggerRunControl(sp, 0, &errorMessage);
if (!errorMessage.isEmpty()) {
handleError(errorMessage);
stopPDebug();
......@@ -145,7 +145,8 @@ void QnxAttachDebugSupport::attachToProcess()
stopPDebug();
return;
}
connect(runControl, &Debugger::DebuggerRunControl::stateChanged,
connect(qobject_cast<Debugger::DebuggerRunTool *>(runControl->toolRunner()),
&Debugger::DebuggerRunTool::stateChanged,
this, &QnxAttachDebugSupport::handleDebuggerStateChanged);
ProjectExplorerPlugin::startRunControl(runControl);
}
......
......@@ -61,7 +61,7 @@ QnxDebugSupport::QnxDebugSupport(RunControl *runControl)
connect(runner, &ApplicationLauncher::remoteStdout, this, &QnxDebugSupport::handleRemoteOutput);
connect(runner, &ApplicationLauncher::remoteStderr, this, &QnxDebugSupport::handleRemoteOutput);
connect(this->runControl(), &Debugger::DebuggerRunControl::requestRemoteSetup,
connect(this->runControl()->toolRunner(), &Debugger::DebuggerRunTool::requestRemoteSetup,
this, &QnxDebugSupport::handleAdapterSetupRequested);
connect(runControl, &RunControl::finished,
this, &QnxDebugSupport::handleDebuggingFinished);
......
......@@ -132,7 +132,7 @@ RunControl *QnxRunControlFactory::create(RunConfiguration *runConfig, Core::Id m
if (mode == ProjectExplorer::Constants::DEBUG_RUN_MODE) {
const DebuggerStartParameters params = createDebuggerStartParameters(rc);
DebuggerRunControl *runControl = createDebuggerRunControl(params, runConfig, errorMessage);
auto runControl = createDebuggerRunControl(params, runConfig, errorMessage);
QTC_ASSERT(runControl, return 0);
(void) new QnxDebugSupport(runControl);
return runControl;
......
......@@ -79,7 +79,7 @@ LinuxDeviceDebugSupport::LinuxDeviceDebugSupport(RunControl *runControl,
: DebuggerRunTool(runControl, sp, errorMessage),
d(new LinuxDeviceDebugSupportPrivate(runControl->runConfiguration()))
{
connect(this->runControl(), &DebuggerRunControl::requestRemoteSetup,
connect(this, &DebuggerRunTool::requestRemoteSetup,
this, &LinuxDeviceDebugSupport::handleRemoteSetupRequested);
connect(runControl, &RunControl::finished,
this, &LinuxDeviceDebugSupport::handleDebuggingFinished);
......@@ -113,11 +113,6 @@ void LinuxDeviceDebugSupport::showMessage(const QString &msg, int channel)
runControl()->toolRunner()->showMessage(msg, channel);
}
DebuggerRunControl *LinuxDeviceDebugSupport::runControl() const
{
return qobject_cast<DebuggerRunControl *>(ToolRunner::runControl());
}
AbstractRemoteLinuxRunSupport *LinuxDeviceDebugSupport::targetRunner() const
{
return qobject_cast<AbstractRemoteLinuxRunSupport *>(runControl()->targetRunner());
......
......@@ -47,7 +47,6 @@ protected:
virtual ProjectExplorer::Runnable realRunnable() const;
bool isCppDebugging() const;
bool isQmlDebugging() const;
Debugger::DebuggerRunControl *runControl() const;
private:
void startExecution();
......
......@@ -144,7 +144,7 @@ RunControl *WinRtDebugSupport::createDebugRunControl(WinRtRunConfiguration *runC
return 0;
}
server.close();
Debugger::DebuggerRunControl *debugRunControl
auto debugRunControl
= createDebuggerRunControl(params, runConfig, errorMessage, mode);
runner->setDebugRunControl(debugRunControl);
new WinRtDebugSupport(debugRunControl, runner);
......
......@@ -146,9 +146,9 @@ bool WinRtRunnerHelper::waitForStarted(int msecs)
return m_process->waitForStarted(msecs);
}
void WinRtRunnerHelper::setDebugRunControl(Debugger::DebuggerRunControl *runControl)
void WinRtRunnerHelper::setDebugRunControl(ProjectExplorer::RunControl *runControl)
{
m_debugMessenger = runControl->toolRunner();
m_debugMessenger = qobject_cast<Debugger::DebuggerRunTool *>(runControl->toolRunner());
m_messenger = runControl;
}
......
......@@ -36,11 +36,7 @@
namespace Utils { class QtcProcess; }
namespace ProjectExplorer { class RunControl; }
namespace Debugger {
class DebuggerRunControl;
class DebuggerRunTool;
}
namespace Debugger { class DebuggerRunTool; }
namespace WinRt {
namespace Internal {
......@@ -60,7 +56,7 @@ public:
void stop();
bool waitForStarted(int msecs = 10000);
void setDebugRunControl(Debugger::DebuggerRunControl *runControl);
void setDebugRunControl(ProjectExplorer::RunControl *runControl);
signals:
void started();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment