BareMetal: Avoid use of otherwise unneeded requestRemoteSetup() signal

Note that this changes the startup timing in the StartupOnNetwork
case slightly, as the application launch is now triggered in
parallel with the gdb launch.

Change-Id: Iaa0b60b8c478eb47abb6e93fbd3b326e0acdd13b
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2017-06-15 09:07:36 +02:00
parent d1247d6796
commit c060571fcd
4 changed files with 28 additions and 47 deletions

View File

@@ -118,22 +118,38 @@ void BareMetalDebugSupport::start()
sp.remoteChannel = p->channel(); sp.remoteChannel = p->channel();
sp.useContinueInsteadOfRun = true; sp.useContinueInsteadOfRun = true;
if (p->startupMode() == GdbServerProvider::StartupOnNetwork)
sp.remoteSetupNeeded = true;
setStartParameters(sp); setStartParameters(sp);
connect(this, &Debugger::DebuggerRunTool::requestRemoteSetup,
this, &BareMetalDebugSupport::remoteSetupRequested);
connect(runControl(), &RunControl::finished, connect(runControl(), &RunControl::finished,
this, &BareMetalDebugSupport::debuggingFinished); this, &BareMetalDebugSupport::debuggingFinished);
DebuggerRunTool::start(); if (p->startupMode() == GdbServerProvider::StartupOnNetwork) {
} m_state = StartingRunner;
showMessage(tr("Starting GDB server...") + '\n', Debugger::LogStatus);
void BareMetalDebugSupport::remoteSetupRequested() connect(m_appLauncher, &ProjectExplorer::ApplicationLauncher::remoteStderr,
{ this, &BareMetalDebugSupport::remoteErrorOutputMessage);
QTC_ASSERT(m_state == Inactive, return); connect(m_appLauncher, &ProjectExplorer::ApplicationLauncher::remoteStdout,
startExecution(); 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() void BareMetalDebugSupport::debuggingFinished()
@@ -213,39 +229,6 @@ void BareMetalDebugSupport::adapterSetupFailed(const QString &error)
notifyEngineRemoteSetupFinished(result); notifyEngineRemoteSetupFinished(result);
} }
void BareMetalDebugSupport::startExecution()
{
auto dev = qSharedPointerCast<const BareMetalDevice>(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() void BareMetalDebugSupport::setFinished()
{ {
if (m_state == Inactive) if (m_state == Inactive)

View File

@@ -42,9 +42,9 @@ public:
private: private:
enum State { Inactive, StartingRunner, Running }; enum State { Inactive, StartingRunner, Running };
void start() override; void start() override;
void remoteSetupRequested();
void debuggingFinished(); void debuggingFinished();
void remoteOutputMessage(const QByteArray &output); void remoteOutputMessage(const QByteArray &output);
void remoteErrorOutputMessage(const QByteArray &output); void remoteErrorOutputMessage(const QByteArray &output);

View File

@@ -870,7 +870,7 @@ void DebuggerEngine::notifyEngineRequestRemoteSetup()
<< "remoteSetupState" << d->remoteSetupState()); << "remoteSetupState" << d->remoteSetupState());
d->setRemoteSetupState(RemoteSetupRequested); d->setRemoteSetupState(RemoteSetupRequested);
runTool()->doRemoteSetup(); QTC_CHECK(false);
} }
void DebuggerEngine::notifyEngineRemoteServerRunning(const QString &, int /*pid*/) void DebuggerEngine::notifyEngineRemoteServerRunning(const QString &, int /*pid*/)

View File

@@ -84,12 +84,10 @@ public:
bool isQmlDebugging() const { return m_isQmlDebugging; } bool isQmlDebugging() const { return m_isQmlDebugging; }
int portsUsedByDebugger() const; int portsUsedByDebugger() const;
virtual void doRemoteSetup() { emit requestRemoteSetup(); }
void appendSolibSearchPath(const QString &str); void appendSolibSearchPath(const QString &str);
signals: signals:
void aboutToNotifyInferiorSetupOk(); void aboutToNotifyInferiorSetupOk();
void requestRemoteSetup();
private: private:
Internal::DebuggerEngine *m_engine = nullptr; // Master engine Internal::DebuggerEngine *m_engine = nullptr; // Master engine