Skip to content

Commit

Permalink
BareMetal: Kill the GDB server provider when debugging stopped
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Tim Sander <[email protected]>
  • Loading branch information
denis-shienkov authored and Tim Sander committed Dec 3, 2015
1 parent ac8626a commit cbb3aee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/plugins/baremetal/gdbserverproviderprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ GdbServerProviderProcess::GdbServerProviderProcess(
const QSharedPointer<const ProjectExplorer::IDevice> &device,
QObject *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)),
SIGNAL(error(QProcess::ProcessError)));
connect(m_process, SIGNAL(finished(int)), SIGNAL(finished()));
Expand All @@ -62,7 +65,10 @@ GdbServerProviderProcess::GdbServerProviderProcess(
void GdbServerProviderProcess::start(const QString &executable, const QStringList &arguments)
{
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()
Expand Down
4 changes: 3 additions & 1 deletion src/plugins/baremetal/gdbserverproviderprocess.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

#include <projectexplorer/devicesupport/deviceprocess.h>

namespace Utils { class QtcProcess; }

namespace BareMetal {
namespace Internal {

Expand Down Expand Up @@ -64,7 +66,7 @@ class GdbServerProviderProcess : public ProjectExplorer::DeviceProcess
qint64 write(const QByteArray &data);

private:
QProcess * const m_process;
Utils::QtcProcess *m_process;
};

} // namespace Internal
Expand Down

0 comments on commit cbb3aee

Please sign in to comment.