forked from qt-creator/qt-creator
BareMetal: Get rid of GdbServerProvider::NoStartup mode
This mode is useless, has not sense, and complicates a code handling. A more useful equivalent for this mode is "Debug->Start Debugging->Attach to Running Debug Server". Change-Id: I863dbc5c41ca82db52792a3ff2a1eae16f8e7afd Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -221,11 +221,6 @@ RunWorker *GdbServerProvider::targetRunner(RunControl *runControl) const
|
|||||||
return new GdbServerProviderRunner(runControl, r);
|
return new GdbServerProviderRunner(runControl, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GdbServerProvider::canStartupMode(StartupMode m) const
|
|
||||||
{
|
|
||||||
return m == NoStartup;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GdbServerProvider::fromMap(const QVariantMap &data)
|
bool GdbServerProvider::fromMap(const QVariantMap &data)
|
||||||
{
|
{
|
||||||
if (!IDebugServerProvider::fromMap(data))
|
if (!IDebugServerProvider::fromMap(data))
|
||||||
@@ -299,23 +294,24 @@ void GdbServerProviderConfigWidget::setStartupMode(GdbServerProvider::StartupMod
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QString startupModeName(GdbServerProvider::StartupMode m)
|
||||||
|
{
|
||||||
|
switch (m) {
|
||||||
|
case GdbServerProvider::StartupOnNetwork:
|
||||||
|
return GdbServerProviderConfigWidget::tr("Startup in TCP/IP Mode");
|
||||||
|
case GdbServerProvider::StartupOnPipe:
|
||||||
|
return GdbServerProviderConfigWidget::tr("Startup in Pipe Mode");
|
||||||
|
default:
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GdbServerProviderConfigWidget::populateStartupModes()
|
void GdbServerProviderConfigWidget::populateStartupModes()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < GdbServerProvider::StartupModesCount; ++i) {
|
const QSet<GdbServerProvider::StartupMode> modes = static_cast<GdbServerProvider *>(
|
||||||
const auto m = static_cast<GdbServerProvider::StartupMode>(i);
|
m_provider)->supportedStartupModes();
|
||||||
if (!static_cast<GdbServerProvider *>(m_provider)->canStartupMode(m))
|
for (const auto mode : modes)
|
||||||
continue;
|
m_startupModeComboBox->addItem(startupModeName(mode), mode);
|
||||||
|
|
||||||
const int idx = m_startupModeComboBox->count();
|
|
||||||
m_startupModeComboBox->insertItem(
|
|
||||||
idx,
|
|
||||||
(m == GdbServerProvider::NoStartup)
|
|
||||||
? tr("No Startup")
|
|
||||||
: ((m == GdbServerProvider::StartupOnNetwork)
|
|
||||||
? tr("Startup in TCP/IP Mode")
|
|
||||||
: tr("Startup in Pipe Mode")),
|
|
||||||
m);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbServerProviderConfigWidget::setFromProvider()
|
void GdbServerProviderConfigWidget::setFromProvider()
|
||||||
|
@@ -45,10 +45,8 @@ class GdbServerProvider : public IDebugServerProvider
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum StartupMode {
|
enum StartupMode {
|
||||||
NoStartup = 0,
|
|
||||||
StartupOnNetwork,
|
StartupOnNetwork,
|
||||||
StartupOnPipe,
|
StartupOnPipe
|
||||||
StartupModesCount
|
|
||||||
};
|
};
|
||||||
|
|
||||||
StartupMode startupMode() const;
|
StartupMode startupMode() const;
|
||||||
@@ -70,7 +68,7 @@ public:
|
|||||||
ProjectExplorer::RunControl *runControl) const final;
|
ProjectExplorer::RunControl *runControl) const final;
|
||||||
|
|
||||||
bool isValid() const override;
|
bool isValid() const override;
|
||||||
virtual bool canStartupMode(StartupMode) const;
|
virtual QSet<StartupMode> supportedStartupModes() const = 0;
|
||||||
|
|
||||||
QUrl channel() const;
|
QUrl channel() const;
|
||||||
void setChannel(const QUrl &channelString);
|
void setChannel(const QUrl &channelString);
|
||||||
@@ -90,7 +88,7 @@ protected:
|
|||||||
|
|
||||||
QString m_settingsBase;
|
QString m_settingsBase;
|
||||||
QUrl m_channel;
|
QUrl m_channel;
|
||||||
StartupMode m_startupMode = NoStartup;
|
StartupMode m_startupMode = StartupOnNetwork;
|
||||||
QString m_initCommands;
|
QString m_initCommands;
|
||||||
QString m_resetCommands;
|
QString m_resetCommands;
|
||||||
bool m_useExtendedRemote = false;
|
bool m_useExtendedRemote = false;
|
||||||
|
@@ -84,8 +84,6 @@ QString JLinkGdbServerProvider::defaultResetCommands()
|
|||||||
QString JLinkGdbServerProvider::channelString() const
|
QString JLinkGdbServerProvider::channelString() const
|
||||||
{
|
{
|
||||||
switch (startupMode()) {
|
switch (startupMode()) {
|
||||||
case NoStartup:
|
|
||||||
// fallback
|
|
||||||
case StartupOnNetwork:
|
case StartupOnNetwork:
|
||||||
// Just return as "host:port" form.
|
// Just return as "host:port" form.
|
||||||
return GdbServerProvider::channelString();
|
return GdbServerProvider::channelString();
|
||||||
@@ -122,9 +120,10 @@ CommandLine JLinkGdbServerProvider::command() const
|
|||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JLinkGdbServerProvider::canStartupMode(StartupMode m) const
|
QSet<GdbServerProvider::StartupMode>
|
||||||
|
JLinkGdbServerProvider::supportedStartupModes() const
|
||||||
{
|
{
|
||||||
return m == NoStartup || m == StartupOnNetwork;
|
return {StartupOnNetwork};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JLinkGdbServerProvider::isValid() const
|
bool JLinkGdbServerProvider::isValid() const
|
||||||
@@ -134,7 +133,7 @@ bool JLinkGdbServerProvider::isValid() const
|
|||||||
|
|
||||||
const StartupMode m = startupMode();
|
const StartupMode m = startupMode();
|
||||||
|
|
||||||
if (m == NoStartup || m == StartupOnNetwork) {
|
if (m == StartupOnNetwork) {
|
||||||
if (channel().host().isEmpty())
|
if (channel().host().isEmpty())
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -331,9 +330,6 @@ JLinkGdbServerProviderConfigWidget::JLinkGdbServerProviderConfigWidget(
|
|||||||
connect(m_targetInterfaceSpeedComboBox, &QComboBox::currentTextChanged,
|
connect(m_targetInterfaceSpeedComboBox, &QComboBox::currentTextChanged,
|
||||||
this, &GdbServerProviderConfigWidget::dirty);
|
this, &GdbServerProviderConfigWidget::dirty);
|
||||||
|
|
||||||
|
|
||||||
connect(m_startupModeComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
|
||||||
this, &JLinkGdbServerProviderConfigWidget::startupModeChanged);
|
|
||||||
connect(m_hostInterfaceComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
connect(m_hostInterfaceComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||||
this, &JLinkGdbServerProviderConfigWidget::hostInterfaceChanged);
|
this, &JLinkGdbServerProviderConfigWidget::hostInterfaceChanged);
|
||||||
connect(m_targetInterfaceComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
connect(m_targetInterfaceComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||||
@@ -364,22 +360,6 @@ void JLinkGdbServerProviderConfigWidget::discard()
|
|||||||
GdbServerProviderConfigWidget::discard();
|
GdbServerProviderConfigWidget::discard();
|
||||||
}
|
}
|
||||||
|
|
||||||
void JLinkGdbServerProviderConfigWidget::startupModeChanged()
|
|
||||||
{
|
|
||||||
const GdbServerProvider::StartupMode m = startupMode();
|
|
||||||
const bool isStartup = m != GdbServerProvider::NoStartup;
|
|
||||||
m_executableFileChooser->setVisible(isStartup);
|
|
||||||
m_mainLayout->labelForField(m_executableFileChooser)->setVisible(isStartup);
|
|
||||||
m_hostInterfaceWidget->setVisible(isStartup);
|
|
||||||
m_mainLayout->labelForField(m_hostInterfaceWidget)->setVisible(isStartup);
|
|
||||||
m_targetInterfaceWidget->setVisible(isStartup);
|
|
||||||
m_mainLayout->labelForField(m_targetInterfaceWidget)->setVisible(isStartup);
|
|
||||||
m_jlinkDeviceLineEdit->setVisible(isStartup);
|
|
||||||
m_mainLayout->labelForField(m_jlinkDeviceLineEdit)->setVisible(isStartup);
|
|
||||||
m_additionalArgumentsTextEdit->setVisible(isStartup);
|
|
||||||
m_mainLayout->labelForField(m_additionalArgumentsTextEdit)->setVisible(isStartup);
|
|
||||||
}
|
|
||||||
|
|
||||||
void JLinkGdbServerProviderConfigWidget::hostInterfaceChanged()
|
void JLinkGdbServerProviderConfigWidget::hostInterfaceChanged()
|
||||||
{
|
{
|
||||||
const HostInterface selectedInterface = static_cast<HostInterface>(
|
const HostInterface selectedInterface = static_cast<HostInterface>(
|
||||||
@@ -405,7 +385,6 @@ void JLinkGdbServerProviderConfigWidget::setFromProvider()
|
|||||||
Q_ASSERT(p);
|
Q_ASSERT(p);
|
||||||
|
|
||||||
const QSignalBlocker blocker(this);
|
const QSignalBlocker blocker(this);
|
||||||
startupModeChanged();
|
|
||||||
m_hostWidget->setChannel(p->channel());
|
m_hostWidget->setChannel(p->channel());
|
||||||
m_executableFileChooser->setFileName(p->m_executableFile);
|
m_executableFileChooser->setFileName(p->m_executableFile);
|
||||||
m_jlinkDeviceLineEdit->setText(p->m_jlinkDevice);
|
m_jlinkDeviceLineEdit->setText(p->m_jlinkDevice);
|
||||||
@@ -422,4 +401,4 @@ void JLinkGdbServerProviderConfigWidget::setFromProvider()
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace ProjectExplorer
|
} // namespace BareMetal
|
||||||
|
@@ -52,7 +52,7 @@ public:
|
|||||||
QString channelString() const final;
|
QString channelString() const final;
|
||||||
Utils::CommandLine command() const final;
|
Utils::CommandLine command() const final;
|
||||||
|
|
||||||
bool canStartupMode(StartupMode mode) const final;
|
QSet<StartupMode> supportedStartupModes() const final;
|
||||||
bool isValid() const final;
|
bool isValid() const final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -118,7 +118,6 @@ private:
|
|||||||
void apply() final;
|
void apply() final;
|
||||||
void discard() final;
|
void discard() final;
|
||||||
|
|
||||||
void startupModeChanged();
|
|
||||||
void hostInterfaceChanged();
|
void hostInterfaceChanged();
|
||||||
void targetInterfaceChanged();
|
void targetInterfaceChanged();
|
||||||
void setFromProvider();
|
void setFromProvider();
|
||||||
|
@@ -79,8 +79,6 @@ QString OpenOcdGdbServerProvider::defaultResetCommands()
|
|||||||
QString OpenOcdGdbServerProvider::channelString() const
|
QString OpenOcdGdbServerProvider::channelString() const
|
||||||
{
|
{
|
||||||
switch (startupMode()) {
|
switch (startupMode()) {
|
||||||
case NoStartup:
|
|
||||||
// fallback
|
|
||||||
case StartupOnNetwork:
|
case StartupOnNetwork:
|
||||||
// Just return as "host:port" form.
|
// Just return as "host:port" form.
|
||||||
return GdbServerProvider::channelString();
|
return GdbServerProvider::channelString();
|
||||||
@@ -124,9 +122,10 @@ CommandLine OpenOcdGdbServerProvider::command() const
|
|||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OpenOcdGdbServerProvider::canStartupMode(StartupMode m) const
|
QSet<GdbServerProvider::StartupMode>
|
||||||
|
OpenOcdGdbServerProvider::supportedStartupModes() const
|
||||||
{
|
{
|
||||||
return m == NoStartup || m == StartupOnNetwork || m == StartupOnPipe;
|
return {StartupOnNetwork, StartupOnPipe};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OpenOcdGdbServerProvider::isValid() const
|
bool OpenOcdGdbServerProvider::isValid() const
|
||||||
@@ -136,7 +135,7 @@ bool OpenOcdGdbServerProvider::isValid() const
|
|||||||
|
|
||||||
const StartupMode m = startupMode();
|
const StartupMode m = startupMode();
|
||||||
|
|
||||||
if (m == NoStartup || m == StartupOnNetwork) {
|
if (m == StartupOnNetwork) {
|
||||||
if (channel().host().isEmpty())
|
if (channel().host().isEmpty())
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -307,15 +306,6 @@ void OpenOcdGdbServerProviderConfigWidget::discard()
|
|||||||
void OpenOcdGdbServerProviderConfigWidget::startupModeChanged()
|
void OpenOcdGdbServerProviderConfigWidget::startupModeChanged()
|
||||||
{
|
{
|
||||||
const GdbServerProvider::StartupMode m = startupMode();
|
const GdbServerProvider::StartupMode m = startupMode();
|
||||||
const bool isStartup = m != GdbServerProvider::NoStartup;
|
|
||||||
m_executableFileChooser->setVisible(isStartup);
|
|
||||||
m_mainLayout->labelForField(m_executableFileChooser)->setVisible(isStartup);
|
|
||||||
m_rootScriptsDirChooser->setVisible(isStartup);
|
|
||||||
m_mainLayout->labelForField(m_rootScriptsDirChooser)->setVisible(isStartup);
|
|
||||||
m_configurationFileChooser->setVisible(isStartup);
|
|
||||||
m_mainLayout->labelForField(m_configurationFileChooser)->setVisible(isStartup);
|
|
||||||
m_additionalArgumentsLineEdit->setVisible(isStartup);
|
|
||||||
m_mainLayout->labelForField(m_additionalArgumentsLineEdit)->setVisible(isStartup);
|
|
||||||
const bool isNetwork = m != GdbServerProvider::StartupOnPipe;
|
const bool isNetwork = m != GdbServerProvider::StartupOnPipe;
|
||||||
m_hostWidget->setVisible(isNetwork);
|
m_hostWidget->setVisible(isNetwork);
|
||||||
m_mainLayout->labelForField(m_hostWidget)->setVisible(isNetwork);
|
m_mainLayout->labelForField(m_hostWidget)->setVisible(isNetwork);
|
||||||
|
@@ -52,7 +52,7 @@ public:
|
|||||||
QString channelString() const final;
|
QString channelString() const final;
|
||||||
Utils::CommandLine command() const final;
|
Utils::CommandLine command() const final;
|
||||||
|
|
||||||
bool canStartupMode(StartupMode mode) const final;
|
QSet<StartupMode> supportedStartupModes() const final;
|
||||||
bool isValid() const final;
|
bool isValid() const final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -87,8 +87,6 @@ QString StLinkUtilGdbServerProvider::defaultResetCommands()
|
|||||||
QString StLinkUtilGdbServerProvider::channelString() const
|
QString StLinkUtilGdbServerProvider::channelString() const
|
||||||
{
|
{
|
||||||
switch (startupMode()) {
|
switch (startupMode()) {
|
||||||
case NoStartup:
|
|
||||||
// fallback
|
|
||||||
case StartupOnNetwork:
|
case StartupOnNetwork:
|
||||||
// Just return as "host:port" form.
|
// Just return as "host:port" form.
|
||||||
return GdbServerProvider::channelString();
|
return GdbServerProvider::channelString();
|
||||||
@@ -117,9 +115,10 @@ CommandLine StLinkUtilGdbServerProvider::command() const
|
|||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StLinkUtilGdbServerProvider::canStartupMode(StartupMode m) const
|
QSet<GdbServerProvider::StartupMode>
|
||||||
|
StLinkUtilGdbServerProvider::supportedStartupModes() const
|
||||||
{
|
{
|
||||||
return m == NoStartup || m == StartupOnNetwork;
|
return {StartupOnNetwork};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StLinkUtilGdbServerProvider::isValid() const
|
bool StLinkUtilGdbServerProvider::isValid() const
|
||||||
@@ -129,7 +128,7 @@ bool StLinkUtilGdbServerProvider::isValid() const
|
|||||||
|
|
||||||
const StartupMode m = startupMode();
|
const StartupMode m = startupMode();
|
||||||
|
|
||||||
if (m == NoStartup || m == StartupOnNetwork) {
|
if (m == StartupOnNetwork) {
|
||||||
if (channel().host().isEmpty())
|
if (channel().host().isEmpty())
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -287,10 +286,6 @@ StLinkUtilGdbServerProviderConfigWidget::StLinkUtilGdbServerProviderConfigWidget
|
|||||||
this, &GdbServerProviderConfigWidget::dirty);
|
this, &GdbServerProviderConfigWidget::dirty);
|
||||||
connect(m_resetCommandsTextEdit, &QPlainTextEdit::textChanged,
|
connect(m_resetCommandsTextEdit, &QPlainTextEdit::textChanged,
|
||||||
this, &GdbServerProviderConfigWidget::dirty);
|
this, &GdbServerProviderConfigWidget::dirty);
|
||||||
|
|
||||||
connect(m_startupModeComboBox,
|
|
||||||
QOverload<int>::of(&QComboBox::currentIndexChanged),
|
|
||||||
this, &StLinkUtilGdbServerProviderConfigWidget::startupModeChanged);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StLinkUtilGdbServerProviderConfigWidget::apply()
|
void StLinkUtilGdbServerProviderConfigWidget::apply()
|
||||||
@@ -340,22 +335,6 @@ void StLinkUtilGdbServerProviderConfigWidget::setTransportLayer(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StLinkUtilGdbServerProviderConfigWidget::startupModeChanged()
|
|
||||||
{
|
|
||||||
const GdbServerProvider::StartupMode m = startupMode();
|
|
||||||
const bool isStartup = m != GdbServerProvider::NoStartup;
|
|
||||||
m_executableFileChooser->setVisible(isStartup);
|
|
||||||
m_mainLayout->labelForField(m_executableFileChooser)->setVisible(isStartup);
|
|
||||||
m_verboseLevelSpinBox->setVisible(isStartup);
|
|
||||||
m_mainLayout->labelForField(m_verboseLevelSpinBox)->setVisible(isStartup);
|
|
||||||
m_extendedModeCheckBox->setVisible(isStartup);
|
|
||||||
m_mainLayout->labelForField(m_extendedModeCheckBox)->setVisible(isStartup);
|
|
||||||
m_resetBoardCheckBox->setVisible(isStartup);
|
|
||||||
m_mainLayout->labelForField(m_resetBoardCheckBox)->setVisible(isStartup);
|
|
||||||
m_transportLayerComboBox->setVisible(isStartup);
|
|
||||||
m_mainLayout->labelForField(m_transportLayerComboBox)->setVisible(isStartup);
|
|
||||||
}
|
|
||||||
|
|
||||||
void StLinkUtilGdbServerProviderConfigWidget::populateTransportLayers()
|
void StLinkUtilGdbServerProviderConfigWidget::populateTransportLayers()
|
||||||
{
|
{
|
||||||
m_transportLayerComboBox->insertItem(
|
m_transportLayerComboBox->insertItem(
|
||||||
@@ -372,7 +351,6 @@ void StLinkUtilGdbServerProviderConfigWidget::setFromProvider()
|
|||||||
Q_ASSERT(p);
|
Q_ASSERT(p);
|
||||||
|
|
||||||
const QSignalBlocker blocker(this);
|
const QSignalBlocker blocker(this);
|
||||||
startupModeChanged();
|
|
||||||
m_hostWidget->setChannel(p->channel());
|
m_hostWidget->setChannel(p->channel());
|
||||||
m_executableFileChooser->setFileName(p->m_executableFile);
|
m_executableFileChooser->setFileName(p->m_executableFile);
|
||||||
m_verboseLevelSpinBox->setValue(p->m_verboseLevel);
|
m_verboseLevelSpinBox->setValue(p->m_verboseLevel);
|
||||||
|
@@ -55,7 +55,7 @@ public:
|
|||||||
QString channelString() const final;
|
QString channelString() const final;
|
||||||
Utils::CommandLine command() const final;
|
Utils::CommandLine command() const final;
|
||||||
|
|
||||||
bool canStartupMode(StartupMode mode) const final;
|
QSet<StartupMode> supportedStartupModes() const final;
|
||||||
bool isValid() const final;
|
bool isValid() const final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -110,7 +110,6 @@ private:
|
|||||||
StLinkUtilGdbServerProvider::TransportLayer transportLayer() const;
|
StLinkUtilGdbServerProvider::TransportLayer transportLayer() const;
|
||||||
void setTransportLayer(StLinkUtilGdbServerProvider::TransportLayer);
|
void setTransportLayer(StLinkUtilGdbServerProvider::TransportLayer);
|
||||||
|
|
||||||
void startupModeChanged();
|
|
||||||
void populateTransportLayers();
|
void populateTransportLayers();
|
||||||
void setFromProvider();
|
void setFromProvider();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user