BareMetal: Allow IDebugServerProvider to create own runner

It is more correct way, because only the server providers
know about own runners.

Change-Id: I645f4696a5d9738d9cd578d642389124a0b0de60
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Denis Shienkov
2019-11-24 11:53:49 +03:00
parent e2a9cd81dd
commit d94636f8f9
4 changed files with 11 additions and 12 deletions

View File

@@ -72,7 +72,8 @@ BareMetalDebugSupport::BareMetalDebugSupport(RunControl *runControl)
return; return;
} }
p->addTargetRunner(this, runControl); if (RunWorker *runner = p->targetRunner(runControl))
addStartDependency(runner);
} }
void BareMetalDebugSupport::start() void BareMetalDebugSupport::start()

View File

@@ -209,18 +209,16 @@ bool GdbServerProvider::aboutToRun(DebuggerRunTool *runTool,
return true; return true;
} }
void GdbServerProvider::addTargetRunner(Debugger::DebuggerRunTool *runTool, RunWorker *GdbServerProvider::targetRunner(RunControl *runControl) const
ProjectExplorer::RunControl *runControl) const
{ {
if (m_startupMode != GdbServerProvider::StartupOnNetwork) if (m_startupMode != GdbServerProvider::StartupOnNetwork)
return; return nullptr;
Runnable r; Runnable r;
r.setCommandLine(command()); r.setCommandLine(command());
// Command arguments are in host OS style as the bare metal's GDB servers are launched // Command arguments are in host OS style as the bare metal's GDB servers are launched
// on the host, not on that target. // on the host, not on that target.
const auto runner = new GdbServerProviderRunner(runControl, r); return new GdbServerProviderRunner(runControl, r);
runTool->addStartDependency(runner);
} }
void GdbServerProvider::updateDevice(ProjectExplorer::IDevice *dev) const void GdbServerProvider::updateDevice(ProjectExplorer::IDevice *dev) const

View File

@@ -66,7 +66,7 @@ public:
bool aboutToRun(Debugger::DebuggerRunTool *runTool, bool aboutToRun(Debugger::DebuggerRunTool *runTool,
QString &errorMessage) const final; QString &errorMessage) const final;
void addTargetRunner(Debugger::DebuggerRunTool *runTool, ProjectExplorer::RunWorker *targetRunner(
ProjectExplorer::RunControl *runControl) const final; ProjectExplorer::RunControl *runControl) const final;
void updateDevice(ProjectExplorer::IDevice *dev) const final; void updateDevice(ProjectExplorer::IDevice *dev) const final;

View File

@@ -45,12 +45,12 @@ class DebuggerRunTool;
} }
namespace ProjectExplorer { namespace ProjectExplorer {
class DeviceProcess;
class IDevice; class IDevice;
class RunControl; class RunControl;
class DeviceProcess; class RunWorker;
} }
namespace BareMetal { namespace BareMetal {
namespace Internal { namespace Internal {
@@ -81,7 +81,7 @@ public:
virtual bool aboutToRun(Debugger::DebuggerRunTool *runTool, virtual bool aboutToRun(Debugger::DebuggerRunTool *runTool,
QString &errorMessage) const = 0; QString &errorMessage) const = 0;
virtual void addTargetRunner(Debugger::DebuggerRunTool *runTool, virtual ProjectExplorer::RunWorker *targetRunner(
ProjectExplorer::RunControl *runControl) const = 0; ProjectExplorer::RunControl *runControl) const = 0;
virtual void updateDevice(ProjectExplorer::IDevice *dev) const = 0; virtual void updateDevice(ProjectExplorer::IDevice *dev) const = 0;