forked from qt-creator/qt-creator
Revert "BareMetal: Get rid of DefaultGdbServerProvider"
And rename it "Generic".
It *is* useful for pre-configuring a device with address, then simply
debugging with F5 instead of going through the Attach to Running Debug
Server dialog and manually choosing the address, port and ELF file.
This reverts commit 46afac5687.
Change-Id: If1e2115e38f38431d70dc8745ffe11ac1a13a7fa
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
091fb1fc7d
commit
0a4a1693ec
@@ -14,6 +14,7 @@ add_qtc_plugin(BareMetal
|
||||
debugserverprovidermanager.cpp debugserverprovidermanager.h
|
||||
debugserverproviderssettingspage.cpp debugserverproviderssettingspage.h
|
||||
debugservers/gdb/gdbserverprovider.cpp debugservers/gdb/gdbserverprovider.h
|
||||
debugservers/gdb/genericgdbserverprovider.cpp debugservers/gdb/genericgdbserverprovider.h
|
||||
debugservers/gdb/openocdgdbserverprovider.cpp debugservers/gdb/openocdgdbserverprovider.h
|
||||
debugservers/gdb/stlinkutilgdbserverprovider.cpp debugservers/gdb/stlinkutilgdbserverprovider.h
|
||||
debugservers/gdb/jlinkgdbserverprovider.cpp debugservers/gdb/jlinkgdbserverprovider.h
|
||||
|
||||
@@ -42,6 +42,7 @@ QtcPlugin {
|
||||
prefix: "debugservers/gdb/"
|
||||
files: [
|
||||
"gdbserverprovider.cpp", "gdbserverprovider.h",
|
||||
"genericgdbserverprovider.cpp", "genericgdbserverprovider.h",
|
||||
"openocdgdbserverprovider.cpp", "openocdgdbserverprovider.h",
|
||||
"stlinkutilgdbserverprovider.cpp", "stlinkutilgdbserverprovider.h",
|
||||
"jlinkgdbserverprovider.cpp", "jlinkgdbserverprovider.h",
|
||||
|
||||
@@ -39,6 +39,7 @@ const char DEBUG_SERVER_PROVIDERS_SETTINGS_ID[] = "EE.BareMetal.DebugServerProvi
|
||||
// GDB Debugger Server Provider Ids.
|
||||
const char GDBSERVER_OPENOCD_PROVIDER_ID[] = "BareMetal.GdbServerProvider.OpenOcd";
|
||||
const char GDBSERVER_JLINK_PROVIDER_ID[] = "BareMetal.GdbServerProvider.JLink";
|
||||
const char GDBSERVER_GENERIC_PROVIDER_ID[] = "BareMetal.GdbServerProvider.Generic";
|
||||
const char GDBSERVER_STLINK_UTIL_PROVIDER_ID[] = "BareMetal.GdbServerProvider.STLinkUtil";
|
||||
const char GDBSERVER_EBLINK_PROVIDER_ID[] = "BareMetal.GdbServerProvider.EBlink";
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "idebugserverprovider.h"
|
||||
|
||||
// GDB debug servers.
|
||||
#include "debugservers/gdb/genericgdbserverprovider.h"
|
||||
#include "debugservers/gdb/openocdgdbserverprovider.h"
|
||||
#include "debugservers/gdb/stlinkutilgdbserverprovider.h"
|
||||
#include "debugservers/gdb/jlinkgdbserverprovider.h"
|
||||
@@ -61,7 +62,8 @@ static DebugServerProviderManager *m_instance = nullptr;
|
||||
|
||||
DebugServerProviderManager::DebugServerProviderManager()
|
||||
: m_configFile(Utils::FilePath::fromString(Core::ICore::userResourcePath() + fileNameKeyC))
|
||||
, m_factories({new JLinkGdbServerProviderFactory,
|
||||
, m_factories({new GenericGdbServerProviderFactory,
|
||||
new JLinkGdbServerProviderFactory,
|
||||
new OpenOcdGdbServerProviderFactory,
|
||||
new StLinkUtilGdbServerProviderFactory,
|
||||
new EBlinkGdbServerProviderFactory,
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
HEADERS += \
|
||||
$$PWD/eblinkgdbserverprovider.h \
|
||||
$$PWD/gdbserverprovider.h \
|
||||
$$PWD/genericgdbserverprovider.h \
|
||||
$$PWD/jlinkgdbserverprovider.h \
|
||||
$$PWD/openocdgdbserverprovider.h \
|
||||
$$PWD/stlinkutilgdbserverprovider.h \
|
||||
$$PWD/jlinkgdbserverprovider.h \
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/eblinkgdbserverprovider.cpp \
|
||||
$$PWD/gdbserverprovider.cpp \
|
||||
$$PWD/genericgdbserverprovider.cpp \
|
||||
$$PWD/jlinkgdbserverprovider.cpp \
|
||||
$$PWD/openocdgdbserverprovider.cpp \
|
||||
$$PWD/stlinkutilgdbserverprovider.cpp \
|
||||
$$PWD/jlinkgdbserverprovider.cpp \
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2020 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 "genericgdbserverprovider.h"
|
||||
|
||||
#include <baremetal/baremetalconstants.h>
|
||||
#include <baremetal/debugserverprovidermanager.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/variablechooser.h>
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QFormLayout>
|
||||
#include <QPlainTextEdit>
|
||||
|
||||
namespace BareMetal {
|
||||
namespace Internal {
|
||||
|
||||
// GenericGdbServerProvider
|
||||
|
||||
GenericGdbServerProvider::GenericGdbServerProvider()
|
||||
: GdbServerProvider(Constants::GDBSERVER_GENERIC_PROVIDER_ID)
|
||||
{
|
||||
setChannel("localhost", 3333);
|
||||
setSettingsKeyBase("BareMetal.GenericGdbServerProvider");
|
||||
setTypeDisplayName(GdbServerProvider::tr("Generic"));
|
||||
setConfigurationWidgetCreator([this] { return new GenericGdbServerProviderConfigWidget(this); });
|
||||
}
|
||||
|
||||
QSet<GdbServerProvider::StartupMode> GenericGdbServerProvider::supportedStartupModes() const
|
||||
{
|
||||
return {StartupOnNetwork};
|
||||
}
|
||||
|
||||
// GenericGdbServerProviderFactory
|
||||
|
||||
GenericGdbServerProviderFactory::GenericGdbServerProviderFactory()
|
||||
{
|
||||
setId(Constants::GDBSERVER_GENERIC_PROVIDER_ID);
|
||||
setDisplayName(GdbServerProvider::tr("Generic"));
|
||||
setCreator([] { return new GenericGdbServerProvider; });
|
||||
}
|
||||
|
||||
// GdbServerProviderConfigWidget
|
||||
|
||||
GenericGdbServerProviderConfigWidget::GenericGdbServerProviderConfigWidget(
|
||||
GenericGdbServerProvider *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 Utils::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 GenericGdbServerProviderConfigWidget::apply()
|
||||
{
|
||||
const auto p = static_cast<GenericGdbServerProvider *>(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 GenericGdbServerProviderConfigWidget::discard()
|
||||
{
|
||||
setFromProvider();
|
||||
IDebugServerProviderConfigWidget::discard();
|
||||
}
|
||||
|
||||
void GenericGdbServerProviderConfigWidget::setFromProvider()
|
||||
{
|
||||
const auto p = static_cast<GenericGdbServerProvider *>(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
|
||||
@@ -0,0 +1,83 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2020 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 {
|
||||
|
||||
// GenericGdbServerProvider
|
||||
|
||||
class GenericGdbServerProvider final : public GdbServerProvider
|
||||
{
|
||||
private:
|
||||
GenericGdbServerProvider();
|
||||
QSet<StartupMode> supportedStartupModes() const final;
|
||||
|
||||
friend class GenericGdbServerProviderConfigWidget;
|
||||
friend class GenericGdbServerProviderFactory;
|
||||
friend class BareMetalDevice;
|
||||
};
|
||||
|
||||
// GenericGdbServerProviderFactory
|
||||
|
||||
class GenericGdbServerProviderFactory final : public IDebugServerProviderFactory
|
||||
{
|
||||
public:
|
||||
GenericGdbServerProviderFactory();
|
||||
};
|
||||
|
||||
// GenericGdbServerProviderConfigWidget
|
||||
|
||||
class GenericGdbServerProviderConfigWidget final
|
||||
: public GdbServerProviderConfigWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GenericGdbServerProviderConfigWidget(
|
||||
GenericGdbServerProvider *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
|
||||
Reference in New Issue
Block a user