diff --git a/src/plugins/baremetal/baremetaldebugsupport.cpp b/src/plugins/baremetal/baremetaldebugsupport.cpp index 9ad7cb91050..d5d058b2448 100644 --- a/src/plugins/baremetal/baremetaldebugsupport.cpp +++ b/src/plugins/baremetal/baremetaldebugsupport.cpp @@ -118,22 +118,38 @@ void BareMetalDebugSupport::start() sp.remoteChannel = p->channel(); sp.useContinueInsteadOfRun = true; - if (p->startupMode() == GdbServerProvider::StartupOnNetwork) - sp.remoteSetupNeeded = true; setStartParameters(sp); - connect(this, &Debugger::DebuggerRunTool::requestRemoteSetup, - this, &BareMetalDebugSupport::remoteSetupRequested); connect(runControl(), &RunControl::finished, this, &BareMetalDebugSupport::debuggingFinished); - DebuggerRunTool::start(); -} + if (p->startupMode() == GdbServerProvider::StartupOnNetwork) { + m_state = StartingRunner; + showMessage(tr("Starting GDB server...") + '\n', Debugger::LogStatus); -void BareMetalDebugSupport::remoteSetupRequested() -{ - QTC_ASSERT(m_state == Inactive, return); - startExecution(); + connect(m_appLauncher, &ProjectExplorer::ApplicationLauncher::remoteStderr, + this, &BareMetalDebugSupport::remoteErrorOutputMessage); + connect(m_appLauncher, &ProjectExplorer::ApplicationLauncher::remoteStdout, + this, &BareMetalDebugSupport::remoteOutputMessage); + connect(m_appLauncher, &ProjectExplorer::ApplicationLauncher::remoteProcessStarted, + this, &BareMetalDebugSupport::remoteProcessStarted); + connect(m_appLauncher, &ProjectExplorer::ApplicationLauncher::finished, + this, &BareMetalDebugSupport::appRunnerFinished); + connect(m_appLauncher, &ProjectExplorer::ApplicationLauncher::reportProgress, + this, &BareMetalDebugSupport::progressReport); + connect(m_appLauncher, &ProjectExplorer::ApplicationLauncher::reportError, + this, &BareMetalDebugSupport::appRunnerError); + + StandardRunnable r; + r.executable = p->executable(); + // We need to wrap the command arguments depending on a host OS, + // as the bare metal's GDB servers are launched on a host, + // but not on a target. + r.commandLineArguments = Utils::QtcProcess::joinArgs(p->arguments(), Utils::HostOsInfo::hostOs()); + m_appLauncher->start(r, dev); + } + + DebuggerRunTool::start(); } void BareMetalDebugSupport::debuggingFinished() @@ -213,39 +229,6 @@ void BareMetalDebugSupport::adapterSetupFailed(const QString &error) notifyEngineRemoteSetupFinished(result); } -void BareMetalDebugSupport::startExecution() -{ - auto dev = qSharedPointerCast(runControl()->device()); - QTC_ASSERT(dev, return); - - const GdbServerProvider *p = GdbServerProviderManager::findProvider(dev->gdbServerProviderId()); - QTC_ASSERT(p, return); - - m_state = StartingRunner; - showMessage(tr("Starting GDB server...") + QLatin1Char('\n'), Debugger::LogStatus); - - connect(m_appLauncher, &ProjectExplorer::ApplicationLauncher::remoteStderr, - this, &BareMetalDebugSupport::remoteErrorOutputMessage); - connect(m_appLauncher, &ProjectExplorer::ApplicationLauncher::remoteStdout, - this, &BareMetalDebugSupport::remoteOutputMessage); - connect(m_appLauncher, &ProjectExplorer::ApplicationLauncher::remoteProcessStarted, - this, &BareMetalDebugSupport::remoteProcessStarted); - connect(m_appLauncher, &ProjectExplorer::ApplicationLauncher::finished, - this, &BareMetalDebugSupport::appRunnerFinished); - connect(m_appLauncher, &ProjectExplorer::ApplicationLauncher::reportProgress, - this, &BareMetalDebugSupport::progressReport); - connect(m_appLauncher, &ProjectExplorer::ApplicationLauncher::reportError, - this, &BareMetalDebugSupport::appRunnerError); - - StandardRunnable r; - r.executable = p->executable(); - // We need to wrap the command arguments depending on a host OS, - // as the bare metal's GDB servers are launched on a host, - // but not on a target. - r.commandLineArguments = Utils::QtcProcess::joinArgs(p->arguments(), Utils::HostOsInfo::hostOs()); - m_appLauncher->start(r, dev); -} - void BareMetalDebugSupport::setFinished() { if (m_state == Inactive) diff --git a/src/plugins/baremetal/baremetaldebugsupport.h b/src/plugins/baremetal/baremetaldebugsupport.h index 1a7da3645d8..7b4a43e32f8 100644 --- a/src/plugins/baremetal/baremetaldebugsupport.h +++ b/src/plugins/baremetal/baremetaldebugsupport.h @@ -42,9 +42,9 @@ public: private: enum State { Inactive, StartingRunner, Running }; + void start() override; - void remoteSetupRequested(); void debuggingFinished(); void remoteOutputMessage(const QByteArray &output); void remoteErrorOutputMessage(const QByteArray &output); diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index 0afe74bbf27..80116f3dc34 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -870,7 +870,7 @@ void DebuggerEngine::notifyEngineRequestRemoteSetup() << "remoteSetupState" << d->remoteSetupState()); d->setRemoteSetupState(RemoteSetupRequested); - runTool()->doRemoteSetup(); + QTC_CHECK(false); } void DebuggerEngine::notifyEngineRemoteServerRunning(const QString &, int /*pid*/) diff --git a/src/plugins/debugger/debuggerruncontrol.h b/src/plugins/debugger/debuggerruncontrol.h index 7968238a08f..e47763af51c 100644 --- a/src/plugins/debugger/debuggerruncontrol.h +++ b/src/plugins/debugger/debuggerruncontrol.h @@ -84,12 +84,10 @@ public: bool isQmlDebugging() const { return m_isQmlDebugging; } int portsUsedByDebugger() const; - virtual void doRemoteSetup() { emit requestRemoteSetup(); } void appendSolibSearchPath(const QString &str); signals: void aboutToNotifyInferiorSetupOk(); - void requestRemoteSetup(); private: Internal::DebuggerEngine *m_engine = nullptr; // Master engine