forked from qt-creator/qt-creator
BareMetal: Simplify RunControl setup
The device is now accessible through the run control pointer, no need to pass it around explicitly. Change-Id: Ife27aaae83679b235b4b066fc54baada2eae01a4 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com> Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
@@ -43,13 +43,10 @@ using namespace ProjectExplorer;
|
||||
namespace BareMetal {
|
||||
namespace Internal {
|
||||
|
||||
BareMetalDebugSupport::BareMetalDebugSupport(
|
||||
const ProjectExplorer::IDevice::ConstPtr device,
|
||||
Debugger::DebuggerRunControl *runControl)
|
||||
BareMetalDebugSupport::BareMetalDebugSupport(Debugger::DebuggerRunControl *runControl)
|
||||
: QObject(runControl)
|
||||
, m_appRunner(new ProjectExplorer::DeviceApplicationRunner(this))
|
||||
, m_runControl(runControl)
|
||||
, m_device(device)
|
||||
, m_state(BareMetalDebugSupport::Inactive)
|
||||
{
|
||||
Q_ASSERT(runControl);
|
||||
@@ -149,7 +146,7 @@ void BareMetalDebugSupport::adapterSetupFailed(const QString &error)
|
||||
|
||||
void BareMetalDebugSupport::startExecution()
|
||||
{
|
||||
auto dev = qSharedPointerCast<const BareMetalDevice>(m_device);
|
||||
auto dev = qSharedPointerCast<const BareMetalDevice>(m_runControl->device());
|
||||
QTC_ASSERT(dev, return);
|
||||
|
||||
const GdbServerProvider *p = GdbServerProviderManager::instance()->findProvider(
|
||||
@@ -175,7 +172,7 @@ void BareMetalDebugSupport::startExecution()
|
||||
StandardRunnable r;
|
||||
r.executable = p->executable();
|
||||
r.commandLineArguments = Utils::QtcProcess::joinArgs(p->arguments(), Utils::OsTypeLinux);
|
||||
m_appRunner->start(m_device, r);
|
||||
m_appRunner->start(dev, r);
|
||||
}
|
||||
|
||||
void BareMetalDebugSupport::setFinished()
|
||||
|
@@ -28,28 +28,19 @@
|
||||
#include <QObject>
|
||||
#include <QPointer>
|
||||
|
||||
#include <projectexplorer/devicesupport/idevice.h>
|
||||
|
||||
namespace Debugger { class DebuggerRunControl; }
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class DeviceApplicationRunner;
|
||||
class IDevice;
|
||||
}
|
||||
namespace ProjectExplorer { class DeviceApplicationRunner; }
|
||||
|
||||
namespace BareMetal {
|
||||
namespace Internal {
|
||||
|
||||
class GdbServerProvider;
|
||||
class BareMetalRunConfiguration;
|
||||
|
||||
class BareMetalDebugSupport : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BareMetalDebugSupport(const ProjectExplorer::IDevice::ConstPtr device,
|
||||
Debugger::DebuggerRunControl *runControl);
|
||||
explicit BareMetalDebugSupport(Debugger::DebuggerRunControl *runControl);
|
||||
~BareMetalDebugSupport();
|
||||
|
||||
private slots:
|
||||
@@ -75,7 +66,6 @@ private:
|
||||
|
||||
ProjectExplorer::DeviceApplicationRunner *m_appRunner;
|
||||
const QPointer<Debugger::DebuggerRunControl> m_runControl;
|
||||
const ProjectExplorer::IDevice::ConstPtr m_device;
|
||||
BareMetalDebugSupport::State m_state;
|
||||
};
|
||||
|
||||
|
@@ -137,8 +137,7 @@ RunControl *BareMetalRunControlFactory::create(
|
||||
|
||||
DebuggerRunControl *runControl = createDebuggerRunControl(sp, rc, errorMessage, mode);
|
||||
if (runControl && sp.remoteSetupNeeded) {
|
||||
const auto debugSupport = new BareMetalDebugSupport(dev, runControl);
|
||||
Q_UNUSED(debugSupport);
|
||||
(void) BareMetalDebugSupport(runControl);
|
||||
}
|
||||
|
||||
return runControl;
|
||||
|
Reference in New Issue
Block a user