forked from qt-creator/qt-creator
BareMetal: Get rid of unused GdbServerProviderProcess class
We don't need in this class, because the remote GDB servers are launches by the RunWorker. Besides, the BareMetalDevice::canCreateProcess() and the BareMetalDevice::createProcess() are not even gets called at all. Tested with the STM32 Nucleo-F767ZI board using the ST-Util GDB provider. Change-Id: I8d3770ec59738c63aa44dd39d371a1b443a81f9a Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -17,7 +17,6 @@ add_qtc_plugin(BareMetal
|
||||
debugserverproviderssettingspage.cpp debugserverproviderssettingspage.h
|
||||
debugservers/gdb/defaultgdbserverprovider.cpp debugservers/gdb/defaultgdbserverprovider.h
|
||||
debugservers/gdb/gdbserverprovider.cpp debugservers/gdb/gdbserverprovider.h
|
||||
debugservers/gdb/gdbserverproviderprocess.cpp debugservers/gdb/gdbserverproviderprocess.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
|
||||
|
@@ -44,7 +44,6 @@ QtcPlugin {
|
||||
files: [
|
||||
"defaultgdbserverprovider.cpp", "defaultgdbserverprovider.h",
|
||||
"gdbserverprovider.cpp", "gdbserverprovider.h",
|
||||
"gdbserverproviderprocess.cpp", "gdbserverproviderprocess.h",
|
||||
"openocdgdbserverprovider.cpp", "openocdgdbserverprovider.h",
|
||||
"stlinkutilgdbserverprovider.cpp", "stlinkutilgdbserverprovider.h",
|
||||
"jlinkgdbserverprovider.cpp", "jlinkgdbserverprovider.h",
|
||||
|
@@ -133,26 +133,6 @@ IDeviceWidget *BareMetalDevice::createWidget()
|
||||
return new BareMetalDeviceConfigurationWidget(sharedFromThis());
|
||||
}
|
||||
|
||||
bool BareMetalDevice::canCreateProcess() const
|
||||
{
|
||||
if (IDebugServerProvider *provider = DebugServerProviderManager::findProvider(
|
||||
m_debugServerProviderId)) {
|
||||
return provider->canCreateProcess();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
DeviceProcess *BareMetalDevice::createProcess(QObject *parent) const
|
||||
{
|
||||
if (IDebugServerProvider *provider = DebugServerProviderManager::findProvider(
|
||||
m_debugServerProviderId)) {
|
||||
return provider->createProcess(sharedFromThis(), parent);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Factory
|
||||
|
||||
BareMetalDeviceFactory::BareMetalDeviceFactory()
|
||||
|
@@ -51,9 +51,6 @@ public:
|
||||
|
||||
ProjectExplorer::DeviceProcessSignalOperation::Ptr signalOperation() const final;
|
||||
|
||||
bool canCreateProcess() const final;
|
||||
ProjectExplorer::DeviceProcess *createProcess(QObject *parent) const final;
|
||||
|
||||
QString debugServerProviderId() const;
|
||||
void setDebugServerProviderId(const QString &id);
|
||||
void unregisterDebugServerProvider(IDebugServerProvider *provider);
|
||||
|
@@ -1,121 +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 "gdbserverproviderprocess.h"
|
||||
|
||||
#include <projectexplorer/devicesupport/idevice.h>
|
||||
#include <projectexplorer/runcontrol.h>
|
||||
|
||||
#include <utils/environment.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace BareMetal {
|
||||
namespace Internal {
|
||||
|
||||
// GdbServerProviderProcess
|
||||
|
||||
GdbServerProviderProcess::GdbServerProviderProcess(
|
||||
const QSharedPointer<const ProjectExplorer::IDevice> &device,
|
||||
QObject *parent)
|
||||
: ProjectExplorer::DeviceProcess(device, parent)
|
||||
, m_process(new Utils::QtcProcess(this))
|
||||
{
|
||||
if (Utils::HostOsInfo::isWindowsHost())
|
||||
m_process->setUseCtrlCStub(true);
|
||||
|
||||
connect(m_process, &QProcess::errorOccurred, this, &GdbServerProviderProcess::error);
|
||||
connect(m_process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
|
||||
this, &GdbServerProviderProcess::finished);
|
||||
|
||||
connect(m_process, &QProcess::readyReadStandardOutput,
|
||||
this, &ProjectExplorer::DeviceProcess::readyReadStandardOutput);
|
||||
connect(m_process, &QProcess::readyReadStandardError,
|
||||
this, &ProjectExplorer::DeviceProcess::readyReadStandardError);
|
||||
connect(m_process, &QProcess::started,
|
||||
this, &ProjectExplorer::DeviceProcess::started);
|
||||
}
|
||||
|
||||
void GdbServerProviderProcess::start(const ProjectExplorer::Runnable &runnable)
|
||||
{
|
||||
QTC_ASSERT(m_process->state() == QProcess::NotRunning, return);
|
||||
m_process->setCommand(runnable.commandLine());
|
||||
m_process->start();
|
||||
}
|
||||
|
||||
void GdbServerProviderProcess::interrupt()
|
||||
{
|
||||
device()->signalOperation()->interruptProcess(m_process->processId());
|
||||
}
|
||||
|
||||
void GdbServerProviderProcess::terminate()
|
||||
{
|
||||
m_process->terminate();
|
||||
}
|
||||
|
||||
void GdbServerProviderProcess::kill()
|
||||
{
|
||||
m_process->kill();
|
||||
}
|
||||
|
||||
QProcess::ProcessState GdbServerProviderProcess::state() const
|
||||
{
|
||||
return m_process->state();
|
||||
}
|
||||
|
||||
QProcess::ExitStatus GdbServerProviderProcess::exitStatus() const
|
||||
{
|
||||
return m_process->exitStatus();
|
||||
}
|
||||
|
||||
int GdbServerProviderProcess::exitCode() const
|
||||
{
|
||||
return m_process->exitCode();
|
||||
}
|
||||
|
||||
QString GdbServerProviderProcess::errorString() const
|
||||
{
|
||||
return m_process->errorString();
|
||||
}
|
||||
|
||||
QByteArray GdbServerProviderProcess::readAllStandardOutput()
|
||||
{
|
||||
return m_process->readAllStandardOutput();
|
||||
}
|
||||
|
||||
QByteArray GdbServerProviderProcess::readAllStandardError()
|
||||
{
|
||||
return m_process->readAllStandardError();
|
||||
}
|
||||
|
||||
qint64 GdbServerProviderProcess::write(const QByteArray &data)
|
||||
{
|
||||
return m_process->write(data);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace BareMetal
|
@@ -1,65 +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 <projectexplorer/devicesupport/deviceprocess.h>
|
||||
|
||||
namespace Utils { class QtcProcess; }
|
||||
|
||||
namespace BareMetal {
|
||||
namespace Internal {
|
||||
|
||||
// GdbServerProviderProcess
|
||||
|
||||
class GdbServerProviderProcess final : public ProjectExplorer::DeviceProcess
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GdbServerProviderProcess(
|
||||
const QSharedPointer<const ProjectExplorer::IDevice> &device,
|
||||
QObject *parent = nullptr);
|
||||
|
||||
void start(const ProjectExplorer::Runnable &runnable) final;
|
||||
void interrupt() final;
|
||||
void terminate() final;
|
||||
void kill() final;
|
||||
|
||||
QProcess::ProcessState state() const final;
|
||||
QProcess::ExitStatus exitStatus() const final;
|
||||
int exitCode() const final;
|
||||
QString errorString() const final;
|
||||
|
||||
QByteArray readAllStandardOutput() final;
|
||||
QByteArray readAllStandardError() final;
|
||||
|
||||
qint64 write(const QByteArray &data) final;
|
||||
|
||||
private:
|
||||
Utils::QtcProcess *m_process = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace BareMetal
|
@@ -1,7 +1,6 @@
|
||||
HEADERS += \
|
||||
$$PWD/defaultgdbserverprovider.h \
|
||||
$$PWD/gdbserverprovider.h \
|
||||
$$PWD/gdbserverproviderprocess.h \
|
||||
$$PWD/openocdgdbserverprovider.h \
|
||||
$$PWD/stlinkutilgdbserverprovider.h \
|
||||
$$PWD/jlinkgdbserverprovider.h \
|
||||
@@ -9,7 +8,6 @@ HEADERS += \
|
||||
SOURCES += \
|
||||
$$PWD/defaultgdbserverprovider.cpp \
|
||||
$$PWD/gdbserverprovider.cpp \
|
||||
$$PWD/gdbserverproviderprocess.cpp \
|
||||
$$PWD/openocdgdbserverprovider.cpp \
|
||||
$$PWD/stlinkutilgdbserverprovider.cpp \
|
||||
$$PWD/jlinkgdbserverprovider.cpp \
|
||||
|
@@ -23,7 +23,6 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "gdbserverproviderprocess.h"
|
||||
#include "jlinkgdbserverprovider.h"
|
||||
|
||||
#include <baremetal/baremetalconstants.h>
|
||||
@@ -143,13 +142,6 @@ bool JLinkGdbServerProvider::isValid() const
|
||||
return true;
|
||||
}
|
||||
|
||||
ProjectExplorer::DeviceProcess *JLinkGdbServerProvider::createProcess(
|
||||
const QSharedPointer<const ProjectExplorer::IDevice> &device,
|
||||
QObject *parent) const
|
||||
{
|
||||
return new GdbServerProviderProcess(device, parent);
|
||||
}
|
||||
|
||||
GdbServerProvider *JLinkGdbServerProvider::clone() const
|
||||
{
|
||||
return new JLinkGdbServerProvider(*this);
|
||||
|
@@ -55,11 +55,6 @@ public:
|
||||
bool canStartupMode(StartupMode mode) const final;
|
||||
bool isValid() const final;
|
||||
|
||||
bool canCreateProcess() const final { return true; }
|
||||
ProjectExplorer::DeviceProcess *createProcess(
|
||||
const QSharedPointer<const ProjectExplorer::IDevice> &device,
|
||||
QObject *parent = nullptr) const final;
|
||||
|
||||
private:
|
||||
explicit JLinkGdbServerProvider();
|
||||
|
||||
|
@@ -23,7 +23,6 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "gdbserverproviderprocess.h"
|
||||
#include "openocdgdbserverprovider.h"
|
||||
|
||||
#include <baremetal/baremetalconstants.h>
|
||||
@@ -150,13 +149,6 @@ bool OpenOcdGdbServerProvider::isValid() const
|
||||
return true;
|
||||
}
|
||||
|
||||
ProjectExplorer::DeviceProcess *OpenOcdGdbServerProvider::createProcess(
|
||||
const QSharedPointer<const ProjectExplorer::IDevice> &device,
|
||||
QObject *parent) const
|
||||
{
|
||||
return new GdbServerProviderProcess(device, parent);
|
||||
}
|
||||
|
||||
GdbServerProvider *OpenOcdGdbServerProvider::clone() const
|
||||
{
|
||||
return new OpenOcdGdbServerProvider(*this);
|
||||
|
@@ -55,11 +55,6 @@ public:
|
||||
bool canStartupMode(StartupMode mode) const final;
|
||||
bool isValid() const final;
|
||||
|
||||
bool canCreateProcess() const final { return true; }
|
||||
ProjectExplorer::DeviceProcess *createProcess(
|
||||
const QSharedPointer<const ProjectExplorer::IDevice> &device,
|
||||
QObject *parent = nullptr) const final;
|
||||
|
||||
private:
|
||||
explicit OpenOcdGdbServerProvider();
|
||||
|
||||
|
@@ -23,7 +23,6 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "gdbserverproviderprocess.h"
|
||||
#include "stlinkutilgdbserverprovider.h"
|
||||
|
||||
#include <baremetal/baremetalconstants.h>
|
||||
@@ -143,13 +142,6 @@ bool StLinkUtilGdbServerProvider::isValid() const
|
||||
return true;
|
||||
}
|
||||
|
||||
ProjectExplorer::DeviceProcess *StLinkUtilGdbServerProvider::createProcess(
|
||||
const QSharedPointer<const ProjectExplorer::IDevice> &device,
|
||||
QObject *parent) const
|
||||
{
|
||||
return new GdbServerProviderProcess(device, parent);
|
||||
}
|
||||
|
||||
GdbServerProvider *StLinkUtilGdbServerProvider::clone() const
|
||||
{
|
||||
return new StLinkUtilGdbServerProvider(*this);
|
||||
|
@@ -58,11 +58,6 @@ public:
|
||||
bool canStartupMode(StartupMode mode) const final;
|
||||
bool isValid() const final;
|
||||
|
||||
bool canCreateProcess() const final { return true; }
|
||||
ProjectExplorer::DeviceProcess *createProcess(
|
||||
const QSharedPointer<const ProjectExplorer::IDevice> &device,
|
||||
QObject *parent = nullptr) const final;
|
||||
|
||||
private:
|
||||
explicit StLinkUtilGdbServerProvider();
|
||||
explicit StLinkUtilGdbServerProvider(const StLinkUtilGdbServerProvider &);
|
||||
|
@@ -45,7 +45,6 @@ class DebuggerRunTool;
|
||||
}
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class DeviceProcess;
|
||||
class IDevice;
|
||||
class RunControl;
|
||||
class RunWorker;
|
||||
@@ -87,11 +86,6 @@ public:
|
||||
|
||||
virtual bool isValid() const = 0;
|
||||
|
||||
virtual bool canCreateProcess() const { return false; }
|
||||
virtual ProjectExplorer::DeviceProcess *createProcess(
|
||||
const QSharedPointer<const ProjectExplorer::IDevice> &,
|
||||
QObject *) const { return nullptr; }
|
||||
|
||||
void registerDevice(BareMetalDevice *device);
|
||||
void unregisterDevice(BareMetalDevice *device);
|
||||
|
||||
|
Reference in New Issue
Block a user