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 BareMetal {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
BareMetalDebugSupport::BareMetalDebugSupport(
|
BareMetalDebugSupport::BareMetalDebugSupport(Debugger::DebuggerRunControl *runControl)
|
||||||
const ProjectExplorer::IDevice::ConstPtr device,
|
|
||||||
Debugger::DebuggerRunControl *runControl)
|
|
||||||
: QObject(runControl)
|
: QObject(runControl)
|
||||||
, m_appRunner(new ProjectExplorer::DeviceApplicationRunner(this))
|
, m_appRunner(new ProjectExplorer::DeviceApplicationRunner(this))
|
||||||
, m_runControl(runControl)
|
, m_runControl(runControl)
|
||||||
, m_device(device)
|
|
||||||
, m_state(BareMetalDebugSupport::Inactive)
|
, m_state(BareMetalDebugSupport::Inactive)
|
||||||
{
|
{
|
||||||
Q_ASSERT(runControl);
|
Q_ASSERT(runControl);
|
||||||
@@ -149,7 +146,7 @@ void BareMetalDebugSupport::adapterSetupFailed(const QString &error)
|
|||||||
|
|
||||||
void BareMetalDebugSupport::startExecution()
|
void BareMetalDebugSupport::startExecution()
|
||||||
{
|
{
|
||||||
auto dev = qSharedPointerCast<const BareMetalDevice>(m_device);
|
auto dev = qSharedPointerCast<const BareMetalDevice>(m_runControl->device());
|
||||||
QTC_ASSERT(dev, return);
|
QTC_ASSERT(dev, return);
|
||||||
|
|
||||||
const GdbServerProvider *p = GdbServerProviderManager::instance()->findProvider(
|
const GdbServerProvider *p = GdbServerProviderManager::instance()->findProvider(
|
||||||
@@ -175,7 +172,7 @@ void BareMetalDebugSupport::startExecution()
|
|||||||
StandardRunnable r;
|
StandardRunnable r;
|
||||||
r.executable = p->executable();
|
r.executable = p->executable();
|
||||||
r.commandLineArguments = Utils::QtcProcess::joinArgs(p->arguments(), Utils::OsTypeLinux);
|
r.commandLineArguments = Utils::QtcProcess::joinArgs(p->arguments(), Utils::OsTypeLinux);
|
||||||
m_appRunner->start(m_device, r);
|
m_appRunner->start(dev, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BareMetalDebugSupport::setFinished()
|
void BareMetalDebugSupport::setFinished()
|
||||||
|
@@ -28,28 +28,19 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
#include <projectexplorer/devicesupport/idevice.h>
|
|
||||||
|
|
||||||
namespace Debugger { class DebuggerRunControl; }
|
namespace Debugger { class DebuggerRunControl; }
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer { class DeviceApplicationRunner; }
|
||||||
class DeviceApplicationRunner;
|
|
||||||
class IDevice;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace BareMetal {
|
namespace BareMetal {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class GdbServerProvider;
|
|
||||||
class BareMetalRunConfiguration;
|
|
||||||
|
|
||||||
class BareMetalDebugSupport : public QObject
|
class BareMetalDebugSupport : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BareMetalDebugSupport(const ProjectExplorer::IDevice::ConstPtr device,
|
explicit BareMetalDebugSupport(Debugger::DebuggerRunControl *runControl);
|
||||||
Debugger::DebuggerRunControl *runControl);
|
|
||||||
~BareMetalDebugSupport();
|
~BareMetalDebugSupport();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
@@ -75,7 +66,6 @@ private:
|
|||||||
|
|
||||||
ProjectExplorer::DeviceApplicationRunner *m_appRunner;
|
ProjectExplorer::DeviceApplicationRunner *m_appRunner;
|
||||||
const QPointer<Debugger::DebuggerRunControl> m_runControl;
|
const QPointer<Debugger::DebuggerRunControl> m_runControl;
|
||||||
const ProjectExplorer::IDevice::ConstPtr m_device;
|
|
||||||
BareMetalDebugSupport::State m_state;
|
BareMetalDebugSupport::State m_state;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -137,8 +137,7 @@ RunControl *BareMetalRunControlFactory::create(
|
|||||||
|
|
||||||
DebuggerRunControl *runControl = createDebuggerRunControl(sp, rc, errorMessage, mode);
|
DebuggerRunControl *runControl = createDebuggerRunControl(sp, rc, errorMessage, mode);
|
||||||
if (runControl && sp.remoteSetupNeeded) {
|
if (runControl && sp.remoteSetupNeeded) {
|
||||||
const auto debugSupport = new BareMetalDebugSupport(dev, runControl);
|
(void) BareMetalDebugSupport(runControl);
|
||||||
Q_UNUSED(debugSupport);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return runControl;
|
return runControl;
|
||||||
|
Reference in New Issue
Block a user