BareMetal: Kill the GDB server provider when debugging stopped

On Windows when debugging is stopped, the QProcess::terminate()
method does nothing. At least it belongs to the started OpenOCD
process. It is better to use Utils::QtcProcess with setup of a
setUseCtrlCStub(true) instead of QProcess.

Change-Id: I954377dc94de77fbae630e096a252530f12aaf2d
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Tim Sander <tim@krieglstein.org>
This commit is contained in:
Denis Shienkov
2015-11-29 18:04:19 +03:00
committed by Tim Sander
parent ac8626aa78
commit cbb3aee076
2 changed files with 11 additions and 3 deletions

View File

@@ -45,8 +45,11 @@ GdbServerProviderProcess::GdbServerProviderProcess(
const QSharedPointer<const ProjectExplorer::IDevice> &device, const QSharedPointer<const ProjectExplorer::IDevice> &device,
QObject *parent) QObject *parent)
: ProjectExplorer::DeviceProcess(device, parent) : ProjectExplorer::DeviceProcess(device, parent)
, m_process(new QProcess(this)) , m_process(new Utils::QtcProcess(this))
{ {
if (Utils::HostOsInfo::isWindowsHost())
m_process->setUseCtrlCStub(true);
connect(m_process, SIGNAL(error(QProcess::ProcessError)), connect(m_process, SIGNAL(error(QProcess::ProcessError)),
SIGNAL(error(QProcess::ProcessError))); SIGNAL(error(QProcess::ProcessError)));
connect(m_process, SIGNAL(finished(int)), SIGNAL(finished())); connect(m_process, SIGNAL(finished(int)), SIGNAL(finished()));
@@ -62,7 +65,10 @@ GdbServerProviderProcess::GdbServerProviderProcess(
void GdbServerProviderProcess::start(const QString &executable, const QStringList &arguments) void GdbServerProviderProcess::start(const QString &executable, const QStringList &arguments)
{ {
QTC_ASSERT(m_process->state() == QProcess::NotRunning, return); QTC_ASSERT(m_process->state() == QProcess::NotRunning, return);
m_process->start(executable, arguments); QString args;
Utils::QtcProcess::addArgs(&args, arguments);
m_process->setCommand(executable, args);
m_process->start();
} }
void GdbServerProviderProcess::interrupt() void GdbServerProviderProcess::interrupt()

View File

@@ -33,6 +33,8 @@
#include <projectexplorer/devicesupport/deviceprocess.h> #include <projectexplorer/devicesupport/deviceprocess.h>
namespace Utils { class QtcProcess; }
namespace BareMetal { namespace BareMetal {
namespace Internal { namespace Internal {
@@ -64,7 +66,7 @@ public:
qint64 write(const QByteArray &data); qint64 write(const QByteArray &data);
private: private:
QProcess * const m_process; Utils::QtcProcess *m_process;
}; };
} // namespace Internal } // namespace Internal