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;
}
p->addTargetRunner(this, runControl);
if (RunWorker *runner = p->targetRunner(runControl))
addStartDependency(runner);
}
void BareMetalDebugSupport::start()

View File

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

View File

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

View File

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