forked from qt-creator/qt-creator
BareMetal: Use a derived class for debug support factory
Change-Id: I58ef72b6b7b74a0d83d8e6fbe5bd7538b5363f99 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -14,6 +14,10 @@ const char MENU_ID[] = "BareMetal.Menu";
|
||||
|
||||
const char DEBUG_SERVER_PROVIDERS_SETTINGS_ID[] = "EE.BareMetal.DebugServerProvidersOptions";
|
||||
|
||||
//FIXME: The values were wrong after c654677bf729369e, but we keep them for now.
|
||||
const char BAREMETAL_CUSTOMRUNCONFIG_ID[] = "BareMetal"; // Sic!
|
||||
const char BAREMETAL_RUNCONFIG_ID[] = "BareMetalCustom"; // Sic!
|
||||
|
||||
// GDB Debugger Server Provider Ids.
|
||||
const char GDBSERVER_OPENOCD_PROVIDER_ID[] = "BareMetal.GdbServerProvider.OpenOcd";
|
||||
const char GDBSERVER_JLINK_PROVIDER_ID[] = "BareMetal.GdbServerProvider.JLink";
|
||||
|
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "baremetaldebugsupport.h"
|
||||
|
||||
#include "baremetalconstants.h"
|
||||
#include "baremetaldevice.h"
|
||||
#include "baremetaltr.h"
|
||||
|
||||
@@ -15,6 +16,7 @@
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
#include <projectexplorer/runconfigurationaspects.h>
|
||||
#include <projectexplorer/target.h>
|
||||
@@ -30,9 +32,12 @@ using namespace Utils;
|
||||
|
||||
namespace BareMetal::Internal {
|
||||
|
||||
BareMetalDebugSupport::BareMetalDebugSupport(RunControl *runControl)
|
||||
: Debugger::DebuggerRunTool(runControl)
|
||||
class BareMetalDebugSupport final : public Debugger::DebuggerRunTool
|
||||
{
|
||||
public:
|
||||
explicit BareMetalDebugSupport(ProjectExplorer::RunControl *runControl)
|
||||
: Debugger::DebuggerRunTool(runControl)
|
||||
{
|
||||
const auto dev = qSharedPointerCast<const BareMetalDevice>(device());
|
||||
if (!dev) {
|
||||
reportFailure(Tr::tr("Cannot debug: Kit has no device."));
|
||||
@@ -48,10 +53,11 @@ BareMetalDebugSupport::BareMetalDebugSupport(RunControl *runControl)
|
||||
|
||||
if (RunWorker *runner = p->targetRunner(runControl))
|
||||
addStartDependency(runner);
|
||||
}
|
||||
}
|
||||
|
||||
void BareMetalDebugSupport::start()
|
||||
{
|
||||
private:
|
||||
void start() final
|
||||
{
|
||||
const auto dev = qSharedPointerCast<const BareMetalDevice>(device());
|
||||
QTC_ASSERT(dev, reportFailure(); return);
|
||||
IDebugServerProvider *p = DebugServerProviderManager::findProvider(
|
||||
@@ -63,6 +69,16 @@ void BareMetalDebugSupport::start()
|
||||
reportFailure(errorMessage);
|
||||
else
|
||||
DebuggerRunTool::start();
|
||||
}
|
||||
};
|
||||
|
||||
BareMetalDebugSupportFactory::BareMetalDebugSupportFactory()
|
||||
{
|
||||
setProduct<BareMetalDebugSupport>();
|
||||
addSupportedRunMode(ProjectExplorer::Constants::NORMAL_RUN_MODE);
|
||||
addSupportedRunMode(ProjectExplorer::Constants::DEBUG_RUN_MODE);
|
||||
addSupportedRunConfig(BareMetal::Constants::BAREMETAL_RUNCONFIG_ID);
|
||||
addSupportedRunConfig(BareMetal::Constants::BAREMETAL_CUSTOMRUNCONFIG_ID);
|
||||
}
|
||||
|
||||
} // BareMetal::Internal
|
||||
|
@@ -7,13 +7,11 @@
|
||||
|
||||
namespace BareMetal::Internal {
|
||||
|
||||
class BareMetalDebugSupport final : public Debugger::DebuggerRunTool
|
||||
class BareMetalDebugSupportFactory final
|
||||
: public ProjectExplorer::RunWorkerFactory
|
||||
{
|
||||
public:
|
||||
explicit BareMetalDebugSupport(ProjectExplorer::RunControl *runControl);
|
||||
|
||||
private:
|
||||
void start() final;
|
||||
BareMetalDebugSupportFactory();
|
||||
};
|
||||
|
||||
} // BareMetal::Internal
|
||||
|
@@ -42,7 +42,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// BareMetalPluginPrivate
|
||||
|
||||
class BareMetalPluginPrivate
|
||||
@@ -57,13 +56,7 @@ public:
|
||||
DebugServerProvidersSettingsPage debugServerProviderSettinsPage;
|
||||
DebugServerProviderManager debugServerProviderManager;
|
||||
BareMetalDeployConfigurationFactory deployConfigurationFactory;
|
||||
|
||||
RunWorkerFactory runWorkerFactory{
|
||||
RunWorkerFactory::make<BareMetalDebugSupport>(),
|
||||
{ProjectExplorer::Constants::NORMAL_RUN_MODE, ProjectExplorer::Constants::DEBUG_RUN_MODE},
|
||||
{runConfigurationFactory.runConfigurationId(),
|
||||
customRunConfigurationFactory.runConfigurationId()}
|
||||
};
|
||||
BareMetalDebugSupportFactory runWorkerFactory;
|
||||
};
|
||||
|
||||
// BareMetalPlugin
|
||||
|
@@ -79,7 +79,7 @@ Tasks BareMetalCustomRunConfiguration::checkForIssues() const
|
||||
|
||||
BareMetalRunConfigurationFactory::BareMetalRunConfigurationFactory()
|
||||
{
|
||||
registerRunConfiguration<BareMetalRunConfiguration>("BareMetalCustom");
|
||||
registerRunConfiguration<BareMetalRunConfiguration>(Constants::BAREMETAL_RUNCONFIG_ID);
|
||||
setDecorateDisplayNames(true);
|
||||
addSupportedTargetDeviceType(BareMetal::Constants::BareMetalOsType);
|
||||
}
|
||||
@@ -89,7 +89,7 @@ BareMetalRunConfigurationFactory::BareMetalRunConfigurationFactory()
|
||||
BareMetalCustomRunConfigurationFactory::BareMetalCustomRunConfigurationFactory()
|
||||
: FixedRunConfigurationFactory(Tr::tr("Custom Executable"), true)
|
||||
{
|
||||
registerRunConfiguration<BareMetalCustomRunConfiguration>("BareMetal");
|
||||
registerRunConfiguration<BareMetalCustomRunConfiguration>(Constants::BAREMETAL_CUSTOMRUNCONFIG_ID);
|
||||
addSupportedTargetDeviceType(BareMetal::Constants::BareMetalOsType);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user