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