diff options
Diffstat (limited to 'src')
27 files changed, 136 insertions, 229 deletions
diff --git a/src/plugins/android/androiddebugsupport.cpp b/src/plugins/android/androiddebugsupport.cpp index 07f58653e5..4ad13b47d5 100644 --- a/src/plugins/android/androiddebugsupport.cpp +++ b/src/plugins/android/androiddebugsupport.cpp @@ -138,28 +138,30 @@ RunControl *AndroidDebugSupport::createDebugRunControl(RunConfiguration *runConf } } - RunControl *runControl = createDebuggerRunControl(params, runConfig, errorMessage); - new AndroidDebugSupport(runControl); + auto runControl = new ProjectExplorer::RunControl(runConfig, ProjectExplorer::Constants::DEBUG_RUN_MODE); + (void) new AndroidDebugSupport(runControl, params, errorMessage); return runControl; } -AndroidDebugSupport::AndroidDebugSupport(RunControl *runControl) - : ToolRunner(runControl), +AndroidDebugSupport::AndroidDebugSupport(RunControl *runControl, + const Debugger::DebuggerStartParameters &sp, + QString *errorMessage) + : DebuggerRunTool(runControl, sp, errorMessage), m_runner(new AndroidRunner(this, runControl->runConfiguration(), runControl->runMode())) { connect(runControl, &RunControl::finished, m_runner, &AndroidRunner::stop); - connect(this->runControl()->toolRunner(), &DebuggerRunTool::requestRemoteSetup, + connect(this, &DebuggerRunTool::requestRemoteSetup, m_runner, &AndroidRunner::start); // FIXME: Move signal to base class and generalize handling. - connect(this->runControl()->toolRunner(), &DebuggerRunTool::aboutToNotifyInferiorSetupOk, + connect(this, &DebuggerRunTool::aboutToNotifyInferiorSetupOk, m_runner, &AndroidRunner::remoteDebuggerRunning); connect(m_runner, &AndroidRunner::remoteServerRunning, [this](const QByteArray &serverChannel, int pid) { - this->runControl()->toolRunner()->notifyEngineRemoteServerRunning(serverChannel, pid); + notifyEngineRemoteServerRunning(serverChannel, pid); }); connect(m_runner, &AndroidRunner::remoteProcessStarted, @@ -173,12 +175,12 @@ AndroidDebugSupport::AndroidDebugSupport(RunControl *runControl) connect(m_runner, &AndroidRunner::remoteErrorOutput, [this](const QString &output) { - this->runControl()->toolRunner()->showMessage(output, AppError); + showMessage(output, AppError); }); connect(m_runner, &AndroidRunner::remoteOutput, [this](const QString &output) { - this->runControl()->toolRunner()->showMessage(output, AppOutput); + showMessage(output, AppOutput); }); QTC_ASSERT(runControl, return); @@ -200,12 +202,7 @@ void AndroidDebugSupport::handleRemoteProcessStarted(Utils::Port gdbServerPort, result.success = true; result.gdbServerPort = gdbServerPort; result.qmlServerPort = qmlPort; - runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result); -} - -DebuggerRunControl *AndroidDebugSupport::runControl() -{ - return qobject_cast<DebuggerRunControl *>(ToolRunner::runControl()); + notifyEngineRemoteSetupFinished(result); } } // namespace Internal diff --git a/src/plugins/android/androiddebugsupport.h b/src/plugins/android/androiddebugsupport.h index 1dba6e7d70..8e07216901 100644 --- a/src/plugins/android/androiddebugsupport.h +++ b/src/plugins/android/androiddebugsupport.h @@ -25,30 +25,29 @@ #pragma once -#include <projectexplorer/runconfiguration.h> +#include <debugger/debuggerruncontrol.h> #include "androidrunconfiguration.h" -namespace Debugger { class DebuggerRunControl; } - namespace Android { namespace Internal { class AndroidRunner; -class AndroidDebugSupport : public ProjectExplorer::ToolRunner +class AndroidDebugSupport : public Debugger::DebuggerRunTool { Q_OBJECT public: - explicit AndroidDebugSupport(ProjectExplorer::RunControl *runControl); + AndroidDebugSupport(ProjectExplorer::RunControl *runControl, + const Debugger::DebuggerStartParameters &sp, + QString *errorMessage); static ProjectExplorer::RunControl *createDebugRunControl(ProjectExplorer::RunConfiguration *runConfig, QString *errorMessage); private: void handleRemoteProcessStarted(Utils::Port gdbServerPort, Utils::Port qmlPort); - Debugger::DebuggerRunControl *runControl(); AndroidRunner * const m_runner; }; diff --git a/src/plugins/autotest/testrunner.cpp b/src/plugins/autotest/testrunner.cpp index 68c997bcf9..947ad90247 100644 --- a/src/plugins/autotest/testrunner.cpp +++ b/src/plugins/autotest/testrunner.cpp @@ -336,8 +336,9 @@ void TestRunner::debugTests() sp.displayName = config->displayName(); QString errorMessage; - auto runControl = Debugger::createDebuggerRunControl(sp, config->runConfiguration(), - &errorMessage); + auto runControl = new ProjectExplorer::RunControl(config->runConfiguration(), + ProjectExplorer::Constants::DEBUG_RUN_MODE); + (void) new Debugger::DebuggerRunTool(runControl, sp, &errorMessage); if (!runControl) { emit testResultReady(TestResultPtr(new FaultyTestResult(Result::MessageFatal, @@ -364,18 +365,18 @@ void TestRunner::debugTests() if (useOutputProcessor) { TestOutputReader *outputreader = config->outputReader(*futureInterface, 0); - connect(runControl, &Debugger::DebuggerRunControl::appendMessageRequested, + connect(runControl, &ProjectExplorer::RunControl::appendMessageRequested, this, [this, outputreader] (ProjectExplorer::RunControl *, const QString &msg, Utils::OutputFormat format) { processOutput(outputreader, msg, format); }); - connect(runControl, &Debugger::DebuggerRunControl::finished, + connect(runControl, &ProjectExplorer::RunControl::finished, outputreader, &QObject::deleteLater); } connect(this, &TestRunner::requestStopTestRun, runControl, &ProjectExplorer::RunControl::stop); - connect(runControl, &Debugger::DebuggerRunControl::finished, this, &TestRunner::onFinished); + connect(runControl, &ProjectExplorer::RunControl::finished, this, &TestRunner::onFinished); ProjectExplorer::ProjectExplorerPlugin::startRunControl(runControl); } diff --git a/src/plugins/baremetal/baremetaldebugsupport.cpp b/src/plugins/baremetal/baremetaldebugsupport.cpp index 27c72a6d78..8fea7dc399 100644 --- a/src/plugins/baremetal/baremetaldebugsupport.cpp +++ b/src/plugins/baremetal/baremetaldebugsupport.cpp @@ -42,11 +42,11 @@ using namespace ProjectExplorer; namespace BareMetal { namespace Internal { -BareMetalDebugSupport::BareMetalDebugSupport(RunControl *runControl) - : ToolRunner(runControl) +BareMetalDebugSupport::BareMetalDebugSupport(RunControl *runControl, const Debugger::DebuggerStartParameters &sp) + : Debugger::DebuggerRunTool(runControl, sp) , m_appLauncher(new ProjectExplorer::ApplicationLauncher(this)) { - connect(this->runControl()->toolRunner(), &Debugger::DebuggerRunTool::requestRemoteSetup, + connect(this, &Debugger::DebuggerRunTool::requestRemoteSetup, this, &BareMetalDebugSupport::remoteSetupRequested); connect(runControl, &RunControl::finished, this, &BareMetalDebugSupport::debuggingFinished); @@ -96,12 +96,12 @@ void BareMetalDebugSupport::appRunnerFinished(bool success) if (m_state == Running) { if (!success) - runControl()->toolRunner()->notifyInferiorIll(); + notifyInferiorIll(); } else if (m_state == StartingRunner) { Debugger::RemoteSetupResult result; result.success = false; result.reason = tr("Debugging failed."); - runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result); + notifyEngineRemoteSetupFinished(result); } reset(); @@ -116,7 +116,7 @@ void BareMetalDebugSupport::appRunnerError(const QString &error) { if (m_state == Running) { showMessage(error, Debugger::AppError); - runControl()->toolRunner()->notifyInferiorIll(); + notifyInferiorIll(); } else if (m_state != Inactive) { adapterSetupFailed(error); } @@ -127,7 +127,7 @@ void BareMetalDebugSupport::adapterSetupDone() m_state = Running; Debugger::RemoteSetupResult result; result.success = true; - runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result); + notifyEngineRemoteSetupFinished(result); } void BareMetalDebugSupport::adapterSetupFailed(const QString &error) @@ -137,7 +137,7 @@ void BareMetalDebugSupport::adapterSetupFailed(const QString &error) Debugger::RemoteSetupResult result; result.success = false; result.reason = tr("Initial setup failed: %1").arg(error); - runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result); + notifyEngineRemoteSetupFinished(result); } void BareMetalDebugSupport::startExecution() @@ -188,16 +188,5 @@ void BareMetalDebugSupport::reset() m_state = Inactive; } -void BareMetalDebugSupport::showMessage(const QString &msg, int channel) -{ - if (m_state != Inactive) - runControl()->toolRunner()->showMessage(msg, channel); -} - -Debugger::DebuggerRunControl *BareMetalDebugSupport::runControl() -{ - return qobject_cast<Debugger::DebuggerRunControl *>(ToolRunner::runControl()); -} - } // namespace Internal } // namespace BareMetal diff --git a/src/plugins/baremetal/baremetaldebugsupport.h b/src/plugins/baremetal/baremetaldebugsupport.h index feb90479e4..3baef0f9ab 100644 --- a/src/plugins/baremetal/baremetaldebugsupport.h +++ b/src/plugins/baremetal/baremetaldebugsupport.h @@ -25,21 +25,20 @@ #pragma once -#include <projectexplorer/runconfiguration.h> - -namespace Debugger { class DebuggerRunControl; } +#include <debugger/debuggerruncontrol.h> namespace ProjectExplorer { class ApplicationLauncher; } namespace BareMetal { namespace Internal { -class BareMetalDebugSupport : public ProjectExplorer::ToolRunner +class BareMetalDebugSupport : public Debugger::DebuggerRunTool { Q_OBJECT public: - explicit BareMetalDebugSupport(ProjectExplorer::RunControl *runControl); + BareMetalDebugSupport(ProjectExplorer::RunControl *runControl, + const Debugger::DebuggerStartParameters &sp); ~BareMetalDebugSupport(); private: @@ -60,9 +59,6 @@ private: void startExecution(); void setFinished(); void reset(); - void showMessage(const QString &msg, int channel); - - Debugger::DebuggerRunControl *runControl(); ProjectExplorer::ApplicationLauncher *m_appLauncher; State m_state = Inactive; diff --git a/src/plugins/baremetal/baremetalruncontrolfactory.cpp b/src/plugins/baremetal/baremetalruncontrolfactory.cpp index af493efcee..5cbe0948d7 100644 --- a/src/plugins/baremetal/baremetalruncontrolfactory.cpp +++ b/src/plugins/baremetal/baremetalruncontrolfactory.cpp @@ -135,9 +135,8 @@ RunControl *BareMetalRunControlFactory::create( if (p->startupMode() == GdbServerProvider::StartupOnNetwork) sp.remoteSetupNeeded = true; - auto runControl = createDebuggerRunControl(sp, rc, errorMessage, mode); - if (runControl && sp.remoteSetupNeeded) - new BareMetalDebugSupport(runControl); + auto runControl = new RunControl(rc, mode); + new BareMetalDebugSupport(runControl, sp); return runControl; } diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index 9bbcf0c684..67aa099227 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -199,7 +199,7 @@ public: const DebuggerRunParameters &runParameters() const; DebuggerRunParameters &runParameters(); - void setRunTool(DebuggerRunTool *runTool); + virtual void setRunTool(DebuggerRunTool *runTool); DebuggerRunTool *runTool() const; void startDebugger(); diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index af252e5fd7..318e75160d 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -2127,7 +2127,7 @@ void DebuggerPlugin::attachExternalApplication(RunControl *rc) rp.closeMode = DetachAtClose; rp.toolChainAbi = rc->abi(); if (RunConfiguration *runConfig = rc->runConfiguration()) { - auto runControl = new DebuggerRunControl(runConfig, ProjectExplorer::Constants::DEBUG_RUN_MODE); + auto runControl = new RunControl(runConfig, ProjectExplorer::Constants::DEBUG_RUN_MODE); (void) new DebuggerRunTool(runControl, rp); ProjectExplorerPlugin::startRunControl(runControl); } else { @@ -3687,7 +3687,7 @@ void DebuggerUnitTests::testStateMachine() rp.inferior = rc->runnable().as<StandardRunnable>(); rp.testCase = TestNoBoundsOfCurrentFunction; - auto runControl = new DebuggerRunControl(rc, ProjectExplorer::Constants::DEBUG_RUN_MODE); + auto runControl = new RunControl(rc, ProjectExplorer::Constants::DEBUG_RUN_MODE); (void) new DebuggerRunTool(runControl, rp); ProjectExplorerPlugin::startRunControl(runControl); diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index 48ee74dc9b..1f24ee16ed 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -107,36 +107,7 @@ static QLatin1String engineTypeName(DebuggerEngineType et) return QLatin1String("No engine"); } - -/// DebuggerRunControl - -DebuggerRunControl::DebuggerRunControl(RunConfiguration *runConfig, Core::Id runMode) - : RunControl(runConfig, runMode) -{ - setIcon(ProjectExplorer::Icons::DEBUG_START_SMALL_TOOLBAR); - setPromptToStop([&](bool *optionalPrompt) { - const QString question = tr("A debugging session is still in progress. " - "Terminating the session in the current" - " state can leave the target in an inconsistent state." - " Would you still like to terminate it?"); - bool result = showPromptToStopDialog(tr("Close Debugging Session"), question, - QString(), QString(), optionalPrompt); - if (result) - disconnect(this); - return result; - }); -} - -DebuggerRunControl::~DebuggerRunControl() -{ -} - -void DebuggerRunControl::start() -{ - toolRunner()->startIt(); -} - -void DebuggerRunTool::startIt() +void DebuggerRunTool::start() { Debugger::Internal::saveModeToRestore(); Debugger::selectPerspective(Debugger::Constants::CppPerspectiveId); @@ -209,22 +180,11 @@ void DebuggerRunTool::notifyEngineRemoteSetupFinished(const RemoteSetupResult &r m_engine->notifyEngineRemoteSetupFinished(result); } -void DebuggerRunControl::stop() -{ - m_debuggerTool->stopIt(); -} - -void DebuggerRunTool::stopIt() +void DebuggerRunTool::stop() { m_engine->quitDebugger(); } -DebuggerRunTool *DebuggerRunControl::toolRunner() const -{ -// return qobject_cast<DebuggerRunTool *>(RunControl::toolRunner()); - return m_debuggerTool; -} - void DebuggerRunTool::debuggingFinished() { runControl()->reportApplicationStop(); @@ -519,13 +479,25 @@ DebuggerRunTool::DebuggerRunTool(RunControl *runControl, const DebuggerStartPara DebuggerRunTool::DebuggerRunTool(RunControl *runControl, const DebuggerRunParameters &rp, QString *errorMessage) : ToolRunner(runControl) { - this->runControl()->m_debuggerTool = this; // FIXME: Remove. DebuggerRunParameters m_rp = rp; runControl->setDisplayName(m_rp.displayName); // QML and/or mixed are not prepared for it. runControl->setSupportsReRunning(!(m_rp.languages & QmlLanguage)); + runControl->setIcon(ProjectExplorer::Icons::DEBUG_START_SMALL_TOOLBAR); + runControl->setPromptToStop([&](bool *optionalPrompt) { + const QString question = tr("A debugging session is still in progress. " + "Terminating the session in the current" + " state can leave the target in an inconsistent state." + " Would you still like to terminate it?"); + bool result = runControl->showPromptToStopDialog(tr("Close Debugging Session"), + question, QString(), QString(), optionalPrompt); + if (result) + disconnect(this); + return result; + }); + if (Internal::fixupParameters(m_rp, runControl, m_errors)) { m_engine = createEngine(m_rp.masterEngineType, m_rp, &m_errors); if (!m_engine) { @@ -567,11 +539,6 @@ void DebuggerRunTool::handleFinished() runControlFinished(m_engine); } -DebuggerRunControl *DebuggerRunTool::runControl() const -{ - return static_cast<DebuggerRunControl *>(ToolRunner::runControl()); -} - void DebuggerRunTool::showMessage(const QString &msg, int channel, int timeout) { if (channel == ConsoleOutput) @@ -610,7 +577,7 @@ public: QTC_ASSERT(runConfig, return 0); QTC_ASSERT(mode == DebugRunMode || mode == DebugRunModeWithBreakOnMain, return 0); - auto runControl = new DebuggerRunControl(runConfig, mode); + auto runControl = new RunControl(runConfig, mode); (void) new DebuggerRunTool(runControl, DebuggerStartParameters(), errorMessage); return runControl; } @@ -679,7 +646,7 @@ RunControl *createAndScheduleRun(const DebuggerRunParameters &rp, Kit *kit) { RunConfiguration *runConfig = dummyRunConfigForKit(kit); QTC_ASSERT(runConfig, return nullptr); - auto runControl = new DebuggerRunControl(runConfig, DebugRunMode); + auto runControl = new RunControl(runConfig, DebugRunMode); (void) new DebuggerRunTool(runControl, rp); QTC_ASSERT(runControl, return nullptr); ProjectExplorerPlugin::startRunControl(runControl); @@ -687,20 +654,4 @@ RunControl *createAndScheduleRun(const DebuggerRunParameters &rp, Kit *kit) } } // Internal - - -/** - * Main entry point for target plugins. - */ -RunControl *createDebuggerRunControl(const DebuggerStartParameters &sp, - RunConfiguration *runConfig, - QString *errorMessage, - Core::Id runMode) -{ - QTC_ASSERT(runConfig, return nullptr); - auto runControl = new DebuggerRunControl(runConfig, runMode); - (void) new DebuggerRunTool(runControl, sp, errorMessage); - return runControl; -} - } // namespace Debugger diff --git a/src/plugins/debugger/debuggerruncontrol.h b/src/plugins/debugger/debuggerruncontrol.h index 8e84b0bdcd..6a11d0648c 100644 --- a/src/plugins/debugger/debuggerruncontrol.h +++ b/src/plugins/debugger/debuggerruncontrol.h @@ -35,13 +35,6 @@ namespace Debugger { class RemoteSetupResult; class DebuggerStartParameters; -class DebuggerRunControl; - -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 { @@ -57,12 +50,11 @@ public: ~DebuggerRunTool(); Internal::DebuggerEngine *engine() const { return m_engine; } - DebuggerRunControl *runControl() const; void showMessage(const QString &msg, int channel = LogDebug, int timeout = -1); - void startIt(); - void stopIt(); + void start() override; + void stop() override; void handleFinished(); @@ -87,21 +79,4 @@ private: QStringList m_errors; }; -class DEBUGGER_EXPORT DebuggerRunControl : public ProjectExplorer::RunControl -{ - Q_OBJECT - -public: - DebuggerRunControl(ProjectExplorer::RunConfiguration *runConfig, Core::Id runMode); - ~DebuggerRunControl() override; - - void start() override; - void stop() override; // Called from SnapshotWindow. - - DebuggerRunTool *toolRunner() const; - -public: - DebuggerRunTool *m_debuggerTool = nullptr; -}; - } // namespace Debugger diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index bfe2732644..f249782341 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -3331,7 +3331,7 @@ void GdbEngine::handleMakeSnapshot(const DebuggerResponse &response, const QStri } rp.displayName = function + ": " + QDateTime::currentDateTime().toString(); rp.isSnapshot = true; - auto rc = new DebuggerRunControl(runControl()->runConfiguration(), ProjectExplorer::Constants::DEBUG_RUN_MODE); + auto rc = new RunControl(runControl()->runConfiguration(), ProjectExplorer::Constants::DEBUG_RUN_MODE); (void) new DebuggerRunTool(rc, rp); ProjectExplorerPlugin::startRunControl(rc); } else { diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp index c8326bec9e..e659a3dcc8 100644 --- a/src/plugins/debugger/qml/qmlengine.cpp +++ b/src/plugins/debugger/qml/qmlengine.cpp @@ -335,10 +335,6 @@ QmlEngine::QmlEngine(const DebuggerRunParameters &startParameters, DebuggerEngin connect(d->msgClient, &QDebugMessageClient::message, this, &appendDebugOutput); - - d->startupMessageFilterConnection = connect( - runControl(), &RunControl::appendMessageRequested, - d, &QmlEnginePrivate::filterApplicationMessage); } QmlEngine::~QmlEngine() @@ -356,6 +352,15 @@ QmlEngine::~QmlEngine() delete d; } +void QmlEngine::setRunTool(DebuggerRunTool *runTool) +{ + DebuggerEngine::setRunTool(runTool); + + d->startupMessageFilterConnection = connect( + runTool->runControl(), &RunControl::appendMessageRequested, + d, &QmlEnginePrivate::filterApplicationMessage); +} + void QmlEngine::setupInferior() { QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); diff --git a/src/plugins/debugger/qml/qmlengine.h b/src/plugins/debugger/qml/qmlengine.h index fcbf0a2eef..728383e78c 100644 --- a/src/plugins/debugger/qml/qmlengine.h +++ b/src/plugins/debugger/qml/qmlengine.h @@ -47,6 +47,8 @@ public: DebuggerEngine *masterEngine = nullptr); ~QmlEngine() override; + void setRunTool(DebuggerRunTool *runTool) override; + void logServiceStateChange(const QString &service, float version, QmlDebug::QmlDebugClient::State newState); void logServiceActivity(const QString &service, const QString &logMessage); diff --git a/src/plugins/ios/iosdebugsupport.cpp b/src/plugins/ios/iosdebugsupport.cpp index 1d392e0c01..55e87cccad 100644 --- a/src/plugins/ios/iosdebugsupport.cpp +++ b/src/plugins/ios/iosdebugsupport.cpp @@ -155,18 +155,18 @@ RunControl *IosDebugSupport::createDebugRunControl(RunConfiguration *runConfig, params.startMode = AttachToRemoteServer; } - RunControl *runControl = createDebuggerRunControl(params, runConfig, errorMessage); - if (runControl) - new IosDebugSupport(runControl, cppDebug, qmlDebug); + Q_UNUSED(errorMessage); // FIXME + auto runControl = new RunControl(runConfig, ProjectExplorer::Constants::DEBUG_RUN_MODE); + (void) new IosDebugSupport(runControl, params, cppDebug, qmlDebug); return runControl; } -IosDebugSupport::IosDebugSupport(RunControl *runControl, bool cppDebug, bool qmlDebug) - : ToolRunner(runControl), +IosDebugSupport::IosDebugSupport(RunControl *runControl, const DebuggerStartParameters &sp, bool cppDebug, bool qmlDebug) + : Debugger::DebuggerRunTool(runControl, sp), m_runner(new IosRunner(this, runControl, cppDebug, qmlDebug ? QmlDebug::QmlDebuggerServices : QmlDebug::NoQmlDebugServices)) { - connect(this->runControl()->toolRunner(), &DebuggerRunTool::requestRemoteSetup, + connect(this, &Debugger::DebuggerRunTool::requestRemoteSetup, m_runner, &IosRunner::start); connect(runControl, &RunControl::finished, m_runner, &IosRunner::stop); @@ -193,7 +193,7 @@ void IosDebugSupport::handleServerPorts(Utils::Port gdbServerPort, Utils::Port q || (m_runner && !m_runner->cppDebug() && qmlPort.isValid()); if (!result.success) result.reason = tr("Could not get debug server file descriptor."); - runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result); + notifyEngineRemoteSetupFinished(result); } void IosDebugSupport::handleGotInferiorPid(qint64 pid, Utils::Port qmlPort) @@ -204,7 +204,7 @@ void IosDebugSupport::handleGotInferiorPid(qint64 pid, Utils::Port qmlPort) result.success = pid > 0; if (!result.success) result.reason = tr("Got an invalid process id."); - runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result); + notifyEngineRemoteSetupFinished(result); } void IosDebugSupport::handleRemoteProcessFinished(bool cleanEnd) @@ -213,22 +213,17 @@ void IosDebugSupport::handleRemoteProcessFinished(bool cleanEnd) appendMessage(tr("Run ended with error."), Utils::DebugFormat); else appendMessage(tr("Run ended."), Utils::DebugFormat); - runControl()->toolRunner()->abortDebugger(); + abortDebugger(); } void IosDebugSupport::handleRemoteOutput(const QString &output) { - runControl()->toolRunner()->showMessage(output, AppOutput); + showMessage(output, AppOutput); } void IosDebugSupport::handleRemoteErrorOutput(const QString &output) { - runControl()->toolRunner()->showMessage(output, AppError); -} - -DebuggerRunControl *IosDebugSupport::runControl() -{ - return qobject_cast<DebuggerRunControl *>(ToolRunner::runControl()) ; + showMessage(output, AppError); } } // namespace Internal diff --git a/src/plugins/ios/iosdebugsupport.h b/src/plugins/ios/iosdebugsupport.h index 24648cf4e5..5e791fb7bc 100644 --- a/src/plugins/ios/iosdebugsupport.h +++ b/src/plugins/ios/iosdebugsupport.h @@ -27,10 +27,7 @@ #include "iosrunconfiguration.h" -#include <projectexplorer/runconfiguration.h> - -namespace Debugger { class DebuggerRunControl; } -namespace ProjectExplorer { class RunControl; } +#include <debugger/debuggerruncontrol.h> namespace Ios { namespace Internal { @@ -38,7 +35,7 @@ namespace Internal { class IosRunConfiguration; class IosRunner; -class IosDebugSupport : public ProjectExplorer::ToolRunner +class IosDebugSupport : public Debugger::DebuggerRunTool { Q_OBJECT @@ -46,7 +43,9 @@ public: static ProjectExplorer::RunControl *createDebugRunControl(ProjectExplorer::RunConfiguration *runConfig, QString *errorMessage); - IosDebugSupport(ProjectExplorer::RunControl *runControl, bool cppDebug, bool qmlDebug); + IosDebugSupport(ProjectExplorer::RunControl *runControl, + const Debugger::DebuggerStartParameters &sp, + bool cppDebug, bool qmlDebug); private: void handleServerPorts(Utils::Port gdbServerPort, Utils::Port qmlPort); @@ -56,8 +55,6 @@ private: void handleRemoteOutput(const QString &output); void handleRemoteErrorOutput(const QString &output); - Debugger::DebuggerRunControl *runControl(); - IosRunner * const m_runner; const QString m_dumperLib; }; diff --git a/src/plugins/qnx/qnxattachdebugsupport.cpp b/src/plugins/qnx/qnxattachdebugsupport.cpp index e9002036c5..2a0d57531d 100644 --- a/src/plugins/qnx/qnxattachdebugsupport.cpp +++ b/src/plugins/qnx/qnxattachdebugsupport.cpp @@ -134,7 +134,8 @@ void QnxAttachDebugSupport::attachToProcess() sp.solibSearchPath = QnxUtils::searchPaths(qtVersion); QString errorMessage; - auto runControl = Debugger::createDebuggerRunControl(sp, 0, &errorMessage); + auto runControl = new RunControl(nullptr, ProjectExplorer::Constants::DEBUG_RUN_MODE); + (void) new Debugger::DebuggerRunTool(runControl, sp, &errorMessage); if (!errorMessage.isEmpty()) { handleError(errorMessage); stopPDebug(); @@ -159,20 +160,20 @@ void QnxAttachDebugSupport::handleDebuggerStateChanged(Debugger::DebuggerState s void QnxAttachDebugSupport::handleError(const QString &message) { - if (m_runControl) - m_runControl->toolRunner()->showMessage(message, Debugger::AppError); + if (m_runTool) + m_runTool->showMessage(message, Debugger::AppError); } void QnxAttachDebugSupport::handleProgressReport(const QString &message) { - if (m_runControl) - m_runControl->toolRunner()->showMessage(message + QLatin1Char('\n'), Debugger::AppStuff); + if (m_runTool) + m_runTool->showMessage(message + QLatin1Char('\n'), Debugger::AppStuff); } void QnxAttachDebugSupport::handleRemoteOutput(const QByteArray &output) { - if (m_runControl) - m_runControl->toolRunner()->showMessage(QString::fromUtf8(output), Debugger::AppOutput); + if (m_runTool) + m_runTool->showMessage(QString::fromUtf8(output), Debugger::AppOutput); } void QnxAttachDebugSupport::stopPDebug() diff --git a/src/plugins/qnx/qnxattachdebugsupport.h b/src/plugins/qnx/qnxattachdebugsupport.h index 744bec6c93..8d970e8248 100644 --- a/src/plugins/qnx/qnxattachdebugsupport.h +++ b/src/plugins/qnx/qnxattachdebugsupport.h @@ -32,7 +32,7 @@ #include <QObject> -namespace Debugger { class DebuggerRunControl; } +namespace Debugger { class DebuggerRunTool; } namespace ProjectExplorer { class ApplicationLauncher; @@ -70,7 +70,7 @@ private: ProjectExplorer::ApplicationLauncher *m_launcher; ProjectExplorer::DeviceUsedPortsGatherer *m_portsGatherer; - Debugger::DebuggerRunControl *m_runControl = 0; + Debugger::DebuggerRunTool *m_runTool = 0; Utils::Port m_pdebugPort; QString m_projectSourceDirectory; diff --git a/src/plugins/qnx/qnxdebugsupport.cpp b/src/plugins/qnx/qnxdebugsupport.cpp index a9a1c73793..5099c2224f 100644 --- a/src/plugins/qnx/qnxdebugsupport.cpp +++ b/src/plugins/qnx/qnxdebugsupport.cpp @@ -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()->toolRunner(), &Debugger::DebuggerRunTool::requestRemoteSetup, + connect(toolRunner(), &Debugger::DebuggerRunTool::requestRemoteSetup, this, &QnxDebugSupport::handleAdapterSetupRequested); connect(runControl, &RunControl::finished, this, &QnxDebugSupport::handleDebuggingFinished); @@ -82,7 +82,7 @@ void QnxDebugSupport::handleAdapterSetupRequested() { QTC_ASSERT(state() == Inactive, return); - runControl()->toolRunner()->showMessage(tr("Preparing remote side...") + '\n', Debugger::AppStuff); + toolRunner()->showMessage(tr("Preparing remote side...") + '\n', Debugger::AppStuff); QnxAbstractRunSupport::handleAdapterSetupRequested(); } @@ -124,7 +124,7 @@ void QnxDebugSupport::handleRemoteProcessStarted() result.success = true; result.gdbServerPort = m_pdebugPort; result.qmlServerPort = m_qmlPort; - runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result); + toolRunner()->notifyEngineRemoteSetupFinished(result); } void QnxDebugSupport::handleRemoteProcessFinished(bool success) @@ -134,13 +134,13 @@ void QnxDebugSupport::handleRemoteProcessFinished(bool success) if (state() == Running) { if (!success) - runControl()->toolRunner()->notifyInferiorIll(); + toolRunner()->notifyInferiorIll(); } else { Debugger::RemoteSetupResult result; result.success = false; result.reason = tr("The %1 process closed unexpectedly.").arg(processExecutable()); - runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result); + toolRunner()->notifyEngineRemoteSetupFinished(result); } } @@ -166,44 +166,44 @@ void QnxDebugSupport::killInferiorProcess() void QnxDebugSupport::handleProgressReport(const QString &progressOutput) { - runControl()->toolRunner()->showMessage(progressOutput + QLatin1Char('\n'), Debugger::AppStuff); + toolRunner()->showMessage(progressOutput + QLatin1Char('\n'), Debugger::AppStuff); } void QnxDebugSupport::handleRemoteOutput(const QByteArray &output) { QTC_ASSERT(state() == Inactive || state() == Running, return); - runControl()->toolRunner()->showMessage(QString::fromUtf8(output), Debugger::AppOutput); + toolRunner()->showMessage(QString::fromUtf8(output), Debugger::AppOutput); } void QnxDebugSupport::handleError(const QString &error) { if (state() == Running) { - runControl()->toolRunner()->showMessage(error, Debugger::AppError); - runControl()->toolRunner()->notifyInferiorIll(); + toolRunner()->showMessage(error, Debugger::AppError); + toolRunner()->notifyInferiorIll(); } else if (state() != Inactive) { setFinished(); Debugger::RemoteSetupResult result; result.success = false; result.reason = tr("Initial setup failed: %1").arg(error); - runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result); + toolRunner()->notifyEngineRemoteSetupFinished(result); } } void QnxDebugSupport::printMissingWarning() { - runControl()->toolRunner()->showMessage(tr("Warning: \"slog2info\" is not found " + toolRunner()->showMessage(tr("Warning: \"slog2info\" is not found " "on the device, debug output not available."), Debugger::AppError); } void QnxDebugSupport::handleApplicationOutput(const QString &msg, Utils::OutputFormat outputFormat) { Q_UNUSED(outputFormat); - runControl()->toolRunner()->showMessage(msg, Debugger::AppOutput); + toolRunner()->showMessage(msg, Debugger::AppOutput); } -Debugger::DebuggerRunControl *QnxDebugSupport::runControl() +Debugger::DebuggerRunTool *QnxDebugSupport::toolRunner() { - return qobject_cast<Debugger::DebuggerRunControl *>(QnxAbstractRunSupport::runControl()); + return qobject_cast<Debugger::DebuggerRunTool *>(runControl()->toolRunner()); } } // namespace Internal diff --git a/src/plugins/qnx/qnxdebugsupport.h b/src/plugins/qnx/qnxdebugsupport.h index 04349b069e..5e198a2469 100644 --- a/src/plugins/qnx/qnxdebugsupport.h +++ b/src/plugins/qnx/qnxdebugsupport.h @@ -31,7 +31,7 @@ #include <utils/outputformat.h> -namespace Debugger { class DebuggerRunControl; } +namespace Debugger { class DebuggerRunTool; } namespace Qnx { namespace Internal { @@ -61,7 +61,7 @@ private: void startExecution() override; - Debugger::DebuggerRunControl *runControl(); + Debugger::DebuggerRunTool *toolRunner(); QString processExecutable() const; void killInferiorProcess(); diff --git a/src/plugins/qnx/qnxruncontrolfactory.cpp b/src/plugins/qnx/qnxruncontrolfactory.cpp index 9d0d84cef7..475dccc1ef 100644 --- a/src/plugins/qnx/qnxruncontrolfactory.cpp +++ b/src/plugins/qnx/qnxruncontrolfactory.cpp @@ -132,8 +132,8 @@ RunControl *QnxRunControlFactory::create(RunConfiguration *runConfig, Core::Id m if (mode == ProjectExplorer::Constants::DEBUG_RUN_MODE) { const DebuggerStartParameters params = createDebuggerStartParameters(rc); - auto runControl = createDebuggerRunControl(params, runConfig, errorMessage); - QTC_ASSERT(runControl, return 0); + auto runControl = new RunControl(runConfig, mode); + // (void) new DebuggerRunTool(runControl, params, errorMessage); FIXME (void) new QnxDebugSupport(runControl); return runControl; } diff --git a/src/plugins/remotelinux/abstractremotelinuxrunsupport.cpp b/src/plugins/remotelinux/abstractremotelinuxrunsupport.cpp index af8e3d3222..dd410d505a 100644 --- a/src/plugins/remotelinux/abstractremotelinuxrunsupport.cpp +++ b/src/plugins/remotelinux/abstractremotelinuxrunsupport.cpp @@ -41,6 +41,7 @@ namespace Internal { class AbstractRemoteLinuxRunSupportPrivate { public: + ApplicationLauncher launcher; AbstractRemoteLinuxRunSupport::State state = AbstractRemoteLinuxRunSupport::Inactive; DeviceUsedPortsGatherer portsGatherer; ApplicationLauncher fifoCreator; @@ -53,7 +54,7 @@ public: using namespace Internal; AbstractRemoteLinuxRunSupport::AbstractRemoteLinuxRunSupport(RunControl *runControl) - : SimpleTargetRunner(runControl), + : TargetRunner(runControl), d(new AbstractRemoteLinuxRunSupportPrivate) { } @@ -64,6 +65,11 @@ AbstractRemoteLinuxRunSupport::~AbstractRemoteLinuxRunSupport() delete d; } +ApplicationLauncher *AbstractRemoteLinuxRunSupport::applicationLauncher() +{ + return &d->launcher; +} + void AbstractRemoteLinuxRunSupport::setState(AbstractRemoteLinuxRunSupport::State state) { d->state = state; diff --git a/src/plugins/remotelinux/abstractremotelinuxrunsupport.h b/src/plugins/remotelinux/abstractremotelinuxrunsupport.h index fee49fae72..9502972dfa 100644 --- a/src/plugins/remotelinux/abstractremotelinuxrunsupport.h +++ b/src/plugins/remotelinux/abstractremotelinuxrunsupport.h @@ -36,7 +36,7 @@ namespace RemoteLinux { namespace Internal { class AbstractRemoteLinuxRunSupportPrivate; } -class REMOTELINUX_EXPORT AbstractRemoteLinuxRunSupport : public ProjectExplorer::SimpleTargetRunner +class REMOTELINUX_EXPORT AbstractRemoteLinuxRunSupport : public ProjectExplorer::TargetRunner { Q_OBJECT @@ -52,6 +52,8 @@ public: explicit AbstractRemoteLinuxRunSupport(ProjectExplorer::RunControl *runControl); ~AbstractRemoteLinuxRunSupport(); + ProjectExplorer::ApplicationLauncher *applicationLauncher(); + void setState(State state); State state() const; diff --git a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp index 5293634918..c0f925c9d9 100644 --- a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp +++ b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp @@ -107,12 +107,6 @@ bool LinuxDeviceDebugSupport::isQmlDebugging() const return d->qmlDebugging; } -void LinuxDeviceDebugSupport::showMessage(const QString &msg, int channel) -{ - if (state() != AbstractRemoteLinuxRunSupport::Inactive) - runControl()->toolRunner()->showMessage(msg, channel); -} - AbstractRemoteLinuxRunSupport *LinuxDeviceDebugSupport::targetRunner() const { return qobject_cast<AbstractRemoteLinuxRunSupport *>(runControl()->targetRunner()); @@ -200,7 +194,7 @@ void LinuxDeviceDebugSupport::handleAppRunnerError(const QString &error) { if (state() == AbstractRemoteLinuxRunSupport::Running) { showMessage(error, AppError); - runControl()->toolRunner()->notifyInferiorIll(); + notifyInferiorIll(); } else if (state() != AbstractRemoteLinuxRunSupport::Inactive) { handleAdapterSetupFailed(error); } @@ -214,15 +208,15 @@ void LinuxDeviceDebugSupport::handleAppRunnerFinished(bool success) if (state() == AbstractRemoteLinuxRunSupport::Running) { // The QML engine does not realize on its own that the application has finished. if (d->qmlDebugging && !d->cppDebugging) - runControl()->toolRunner()->quitDebugger(); + quitDebugger(); else if (!success) - runControl()->toolRunner()->notifyInferiorIll(); + notifyInferiorIll(); } else if (state() == AbstractRemoteLinuxRunSupport::StartingRunner) { RemoteSetupResult result; result.success = false; result.reason = tr("Debugging failed."); - runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result); + notifyEngineRemoteSetupFinished(result); } targetRunner()->reset(); } @@ -265,7 +259,7 @@ void LinuxDeviceDebugSupport::handleAdapterSetupFailed(const QString &error) RemoteSetupResult result; result.success = false; result.reason = tr("Initial setup failed: %1").arg(error); - runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result); + notifyEngineRemoteSetupFinished(result); } void LinuxDeviceDebugSupport::handleAdapterSetupDone() @@ -276,7 +270,7 @@ void LinuxDeviceDebugSupport::handleAdapterSetupDone() result.success = true; result.gdbServerPort = d->gdbServerPort; result.qmlServerPort = d->qmlPort; - runControl()->toolRunner()->notifyEngineRemoteSetupFinished(result); + notifyEngineRemoteSetupFinished(result); } void LinuxDeviceDebugSupport::handleRemoteProcessStarted() diff --git a/src/plugins/remotelinux/remotelinuxdebugsupport.h b/src/plugins/remotelinux/remotelinuxdebugsupport.h index 59cccabb0b..cf63906032 100644 --- a/src/plugins/remotelinux/remotelinuxdebugsupport.h +++ b/src/plugins/remotelinux/remotelinuxdebugsupport.h @@ -63,8 +63,6 @@ private: void handleAdapterSetupDone(); void handleDebuggingFinished(); - void showMessage(const QString &msg, int channel); - AbstractRemoteLinuxRunSupport *targetRunner() const; AbstractRemoteLinuxRunSupport::State state() const; diff --git a/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp b/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp index b2cfd6cff2..af07e1828f 100644 --- a/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp +++ b/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp @@ -137,7 +137,7 @@ RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Co params.symbolFile = symbolFile; } - auto runControl = new DebuggerRunControl(runConfig, mode); + auto runControl = new RunControl(runConfig, mode); (void) new AbstractRemoteLinuxRunSupport(runControl); (void) new LinuxDeviceDebugSupport(runControl, params, errorMessage); return runControl; diff --git a/src/plugins/valgrind/memcheckengine.cpp b/src/plugins/valgrind/memcheckengine.cpp index c463b2be6a..12bae14f67 100644 --- a/src/plugins/valgrind/memcheckengine.cpp +++ b/src/plugins/valgrind/memcheckengine.cpp @@ -159,8 +159,8 @@ void MemcheckWithGdbRunControl::startDebugger() sp.expectedSignals.append("SIGTRAP"); QString errorMessage; - RunControl *gdbRunControl = Debugger::createDebuggerRunControl(sp, runConfiguration(), &errorMessage); - QTC_ASSERT(gdbRunControl, return); + auto *gdbRunControl = new RunControl(nullptr, ProjectExplorer::Constants::DEBUG_RUN_MODE); + (void) new Debugger::DebuggerRunTool(gdbRunControl, sp, &errorMessage); connect(gdbRunControl, &RunControl::finished, gdbRunControl, &RunControl::deleteLater); gdbRunControl->initiateStart(); diff --git a/src/plugins/winrt/winrtdebugsupport.cpp b/src/plugins/winrt/winrtdebugsupport.cpp index aa17bca0c8..a3f31072a1 100644 --- a/src/plugins/winrt/winrtdebugsupport.cpp +++ b/src/plugins/winrt/winrtdebugsupport.cpp @@ -144,8 +144,8 @@ RunControl *WinRtDebugSupport::createDebugRunControl(WinRtRunConfiguration *runC return 0; } server.close(); - auto debugRunControl - = createDebuggerRunControl(params, runConfig, errorMessage, mode); + auto debugRunControl = new RunControl(runConfig, mode); + (void) new Debugger::DebuggerRunTool(debugRunControl, params, errorMessage); runner->setDebugRunControl(debugRunControl); new WinRtDebugSupport(debugRunControl, runner); return debugRunControl; |