BareMetal: Get rid of DefaultGdbServerProvider

This provider was added thoughtlessly and has not any
useful functionality. A most useful analogy it is
"Debug->Start Debugging->Attach to Running Debug Server"
which completelly replaces of this provider.

Change-Id: Ib4d8db5b20cd08821c5f3e005c6b8ae5816f2096
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Denis Shienkov
2019-11-26 16:46:17 +03:00
parent 5dd0e745ee
commit 46afac5687
6 changed files with 1 additions and 261 deletions

View File

@@ -15,7 +15,6 @@ add_qtc_plugin(BareMetal
debugserverproviderchooser.cpp debugserverproviderchooser.h debugserverproviderchooser.cpp debugserverproviderchooser.h
debugserverprovidermanager.cpp debugserverprovidermanager.h debugserverprovidermanager.cpp debugserverprovidermanager.h
debugserverproviderssettingspage.cpp debugserverproviderssettingspage.h debugserverproviderssettingspage.cpp debugserverproviderssettingspage.h
debugservers/gdb/defaultgdbserverprovider.cpp debugservers/gdb/defaultgdbserverprovider.h
debugservers/gdb/gdbserverprovider.cpp debugservers/gdb/gdbserverprovider.h debugservers/gdb/gdbserverprovider.cpp debugservers/gdb/gdbserverprovider.h
debugservers/gdb/openocdgdbserverprovider.cpp debugservers/gdb/openocdgdbserverprovider.h debugservers/gdb/openocdgdbserverprovider.cpp debugservers/gdb/openocdgdbserverprovider.h
debugservers/gdb/stlinkutilgdbserverprovider.cpp debugservers/gdb/stlinkutilgdbserverprovider.h debugservers/gdb/stlinkutilgdbserverprovider.cpp debugservers/gdb/stlinkutilgdbserverprovider.h

View File

@@ -42,7 +42,6 @@ QtcPlugin {
name: "GDB Servers" name: "GDB Servers"
prefix: "debugservers/gdb/" prefix: "debugservers/gdb/"
files: [ files: [
"defaultgdbserverprovider.cpp", "defaultgdbserverprovider.h",
"gdbserverprovider.cpp", "gdbserverprovider.h", "gdbserverprovider.cpp", "gdbserverprovider.h",
"openocdgdbserverprovider.cpp", "openocdgdbserverprovider.h", "openocdgdbserverprovider.cpp", "openocdgdbserverprovider.h",
"stlinkutilgdbserverprovider.cpp", "stlinkutilgdbserverprovider.h", "stlinkutilgdbserverprovider.cpp", "stlinkutilgdbserverprovider.h",

View File

@@ -27,7 +27,6 @@
#include "idebugserverprovider.h" #include "idebugserverprovider.h"
// GDB debug servers. // GDB debug servers.
#include "debugservers/gdb/defaultgdbserverprovider.h"
#include "debugservers/gdb/openocdgdbserverprovider.h" #include "debugservers/gdb/openocdgdbserverprovider.h"
#include "debugservers/gdb/stlinkutilgdbserverprovider.h" #include "debugservers/gdb/stlinkutilgdbserverprovider.h"
#include "debugservers/gdb/jlinkgdbserverprovider.h" #include "debugservers/gdb/jlinkgdbserverprovider.h"
@@ -56,8 +55,7 @@ static DebugServerProviderManager *m_instance = nullptr;
DebugServerProviderManager::DebugServerProviderManager() DebugServerProviderManager::DebugServerProviderManager()
: m_configFile(Utils::FilePath::fromString(Core::ICore::userResourcePath() + fileNameKeyC)) : m_configFile(Utils::FilePath::fromString(Core::ICore::userResourcePath() + fileNameKeyC))
, m_factories({new DefaultGdbServerProviderFactory, , m_factories({new JLinkGdbServerProviderFactory,
new JLinkGdbServerProviderFactory,
new OpenOcdGdbServerProviderFactory, new OpenOcdGdbServerProviderFactory,
new StLinkUtilGdbServerProviderFactory}) new StLinkUtilGdbServerProviderFactory})
{ {

View File

@@ -1,160 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 Denis Shienkov <denis.shienkov@gmail.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "defaultgdbserverprovider.h"
#include <baremetal/baremetalconstants.h>
#include <baremetal/debugserverprovidermanager.h>
#include <coreplugin/variablechooser.h>
#include <utils/qtcassert.h>
#include <QCheckBox>
#include <QFormLayout>
#include <QPlainTextEdit>
namespace BareMetal {
namespace Internal {
// DefaultGdbServerProvider
DefaultGdbServerProvider::DefaultGdbServerProvider()
: GdbServerProvider(Constants::DEFAULT_PROVIDER_ID)
{
setDefaultChannel("localhost", 3333);
setSettingsKeyBase("BareMetal.DefaultGdbServerProvider");
setTypeDisplayName(DefaultGdbServerProviderFactory::tr("Default"));
}
GdbServerProvider *DefaultGdbServerProvider::clone() const
{
return new DefaultGdbServerProvider(*this);
}
GdbServerProviderConfigWidget *DefaultGdbServerProvider::configurationWidget()
{
return new DefaultGdbServerProviderConfigWidget(this);
}
// DefaultGdbServerProviderFactory
DefaultGdbServerProviderFactory::DefaultGdbServerProviderFactory()
{
setId(Constants::DEFAULT_PROVIDER_ID);
setDisplayName(tr("Default"));
}
GdbServerProvider *DefaultGdbServerProviderFactory::create()
{
return new DefaultGdbServerProvider;
}
bool DefaultGdbServerProviderFactory::canRestore(const QVariantMap &data) const
{
const auto id = idFromMap(data);
return id.startsWith(Constants::DEFAULT_PROVIDER_ID + QLatin1Char(':'));
}
GdbServerProvider *DefaultGdbServerProviderFactory::restore(const QVariantMap &data)
{
const auto p = new DefaultGdbServerProvider;
const auto updated = data;
if (p->fromMap(updated))
return p;
delete p;
return nullptr;
}
// GdbServerProviderConfigWidget
DefaultGdbServerProviderConfigWidget::DefaultGdbServerProviderConfigWidget(
DefaultGdbServerProvider *provider)
: GdbServerProviderConfigWidget(provider)
{
Q_ASSERT(provider);
m_hostWidget = new HostWidget(this);
m_mainLayout->addRow(tr("Host:"), m_hostWidget);
m_useExtendedRemoteCheckBox = new QCheckBox(this);
m_useExtendedRemoteCheckBox->setToolTip("Use GDB target extended-remote");
m_mainLayout->addRow(tr("Extended mode:"), m_useExtendedRemoteCheckBox);
m_initCommandsTextEdit = new QPlainTextEdit(this);
m_initCommandsTextEdit->setToolTip(defaultInitCommandsTooltip());
m_mainLayout->addRow(tr("Init commands:"), m_initCommandsTextEdit);
m_resetCommandsTextEdit = new QPlainTextEdit(this);
m_resetCommandsTextEdit->setToolTip(defaultResetCommandsTooltip());
m_mainLayout->addRow(tr("Reset commands:"), m_resetCommandsTextEdit);
addErrorLabel();
setFromProvider();
const auto chooser = new Core::VariableChooser(this);
chooser->addSupportedWidget(m_initCommandsTextEdit);
chooser->addSupportedWidget(m_resetCommandsTextEdit);
connect(m_hostWidget, &HostWidget::dataChanged,
this, &GdbServerProviderConfigWidget::dirty);
connect(m_useExtendedRemoteCheckBox, &QCheckBox::stateChanged,
this, &GdbServerProviderConfigWidget::dirty);
connect(m_initCommandsTextEdit, &QPlainTextEdit::textChanged,
this, &GdbServerProviderConfigWidget::dirty);
connect(m_resetCommandsTextEdit, &QPlainTextEdit::textChanged,
this, &GdbServerProviderConfigWidget::dirty);
}
void DefaultGdbServerProviderConfigWidget::apply()
{
const auto p = static_cast<DefaultGdbServerProvider *>(m_provider);
Q_ASSERT(p);
p->setChannel(m_hostWidget->channel());
p->setUseExtendedRemote(m_useExtendedRemoteCheckBox->isChecked());
p->setInitCommands(m_initCommandsTextEdit->toPlainText());
p->setResetCommands(m_resetCommandsTextEdit->toPlainText());
IDebugServerProviderConfigWidget::apply();
}
void DefaultGdbServerProviderConfigWidget::discard()
{
setFromProvider();
IDebugServerProviderConfigWidget::discard();
}
void DefaultGdbServerProviderConfigWidget::setFromProvider()
{
const auto p = static_cast<DefaultGdbServerProvider *>(m_provider);
Q_ASSERT(p);
const QSignalBlocker blocker(this);
m_hostWidget->setChannel(p->channel());
m_useExtendedRemoteCheckBox->setChecked(p->useExtendedRemote());
m_initCommandsTextEdit->setPlainText(p->initCommands());
m_resetCommandsTextEdit->setPlainText(p->resetCommands());
}
} // namespace Internal
} // namespace ProjectExplorer

View File

@@ -1,94 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 Denis Shienkov <denis.shienkov@gmail.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include "gdbserverprovider.h"
QT_BEGIN_NAMESPACE
class QCheckBox;
class QPlainTextEdit;
QT_END_NAMESPACE
namespace BareMetal {
namespace Internal {
// DefaultGdbServerProvider
class DefaultGdbServerProvider final : public GdbServerProvider
{
public:
GdbServerProviderConfigWidget *configurationWidget() final;
GdbServerProvider *clone() const final;
private:
explicit DefaultGdbServerProvider();
friend class DefaultGdbServerProviderConfigWidget;
friend class DefaultGdbServerProviderFactory;
friend class BareMetalDevice;
};
// DefaultGdbServerProviderFactory
class DefaultGdbServerProviderFactory final
: public IDebugServerProviderFactory
{
Q_OBJECT
public:
explicit DefaultGdbServerProviderFactory();
GdbServerProvider *create() final;
bool canRestore(const QVariantMap &data) const final;
GdbServerProvider *restore(const QVariantMap &data) final;
};
// DefaultGdbServerProviderConfigWidget
class DefaultGdbServerProviderConfigWidget final
: public GdbServerProviderConfigWidget
{
Q_OBJECT
public:
explicit DefaultGdbServerProviderConfigWidget(
DefaultGdbServerProvider *provider);
private:
void apply() final;
void discard() final;
void setFromProvider();
HostWidget *m_hostWidget = nullptr;
QCheckBox *m_useExtendedRemoteCheckBox = nullptr;
QPlainTextEdit *m_initCommandsTextEdit = nullptr;
QPlainTextEdit *m_resetCommandsTextEdit = nullptr;
};
} // namespace Internal
} // namespace BareMetal

View File

@@ -1,12 +1,10 @@
HEADERS += \ HEADERS += \
$$PWD/defaultgdbserverprovider.h \
$$PWD/gdbserverprovider.h \ $$PWD/gdbserverprovider.h \
$$PWD/openocdgdbserverprovider.h \ $$PWD/openocdgdbserverprovider.h \
$$PWD/stlinkutilgdbserverprovider.h \ $$PWD/stlinkutilgdbserverprovider.h \
$$PWD/jlinkgdbserverprovider.h \ $$PWD/jlinkgdbserverprovider.h \
SOURCES += \ SOURCES += \
$$PWD/defaultgdbserverprovider.cpp \
$$PWD/gdbserverprovider.cpp \ $$PWD/gdbserverprovider.cpp \
$$PWD/openocdgdbserverprovider.cpp \ $$PWD/openocdgdbserverprovider.cpp \
$$PWD/stlinkutilgdbserverprovider.cpp \ $$PWD/stlinkutilgdbserverprovider.cpp \