forked from qt-creator/qt-creator
Debugger: Use Utils::QtcProcess instead of GdbProcess
The original use case of running GDB itself remotely is not present anymore. Change-Id: I283a27216d6a8849fea7d9ca8df6b94571fb99fd Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
@@ -109,7 +109,6 @@ QtcPlugin {
|
|||||||
"coregdbadapter.cpp", "coregdbadapter.h",
|
"coregdbadapter.cpp", "coregdbadapter.h",
|
||||||
"gdbengine.cpp", "gdbengine.h",
|
"gdbengine.cpp", "gdbengine.h",
|
||||||
"gdboptionspage.cpp", "gdboptionspage.h",
|
"gdboptionspage.cpp", "gdboptionspage.h",
|
||||||
"gdbprocess.cpp", "gdbprocess.h",
|
|
||||||
"gdbplainengine.cpp", "gdbplainengine.h",
|
"gdbplainengine.cpp", "gdbplainengine.h",
|
||||||
"remotegdbserveradapter.cpp", "remotegdbserveradapter.h",
|
"remotegdbserveradapter.cpp", "remotegdbserveradapter.h",
|
||||||
"startgdbserverdialog.cpp", "startgdbserverdialog.h",
|
"startgdbserverdialog.cpp", "startgdbserverdialog.h",
|
||||||
|
|||||||
@@ -551,6 +551,9 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl)
|
|||||||
if (!d->m_runParameters.environment.size())
|
if (!d->m_runParameters.environment.size())
|
||||||
d->m_runParameters.environment = Utils::Environment();
|
d->m_runParameters.environment = Utils::Environment();
|
||||||
|
|
||||||
|
if (isNativeMixedActive())
|
||||||
|
d->m_runParameters.environment.set(QLatin1String("QV4_FORCE_INTERPRETER"), QLatin1String("1"));
|
||||||
|
|
||||||
action(OperateByInstruction)->setEnabled(hasCapability(DisassemblerCapability));
|
action(OperateByInstruction)->setEnabled(hasCapability(DisassemblerCapability));
|
||||||
|
|
||||||
QTC_ASSERT(state() == DebuggerNotReady || state() == DebuggerFinished,
|
QTC_ASSERT(state() == DebuggerNotReady || state() == DebuggerFinished,
|
||||||
|
|||||||
@@ -58,9 +58,9 @@ void GdbAttachEngine::setupEngine()
|
|||||||
showMessage(_("TRYING TO START ADAPTER"));
|
showMessage(_("TRYING TO START ADAPTER"));
|
||||||
|
|
||||||
if (!runParameters().workingDirectory.isEmpty())
|
if (!runParameters().workingDirectory.isEmpty())
|
||||||
m_gdbProc->setWorkingDirectory(runParameters().workingDirectory);
|
m_gdbProc.setWorkingDirectory(runParameters().workingDirectory);
|
||||||
if (runParameters().environment.size())
|
if (runParameters().environment.size())
|
||||||
m_gdbProc->setEnvironment(runParameters().environment.toStringList());
|
m_gdbProc.setEnvironment(runParameters().environment);
|
||||||
|
|
||||||
startGdb();
|
startGdb();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
#define DEBUGGER_ATTACHGDBADAPTER_H
|
#define DEBUGGER_ATTACHGDBADAPTER_H
|
||||||
|
|
||||||
#include "gdbengine.h"
|
#include "gdbengine.h"
|
||||||
#include "gdbprocess.h"
|
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ HEADERS += \
|
|||||||
$$PWD/termgdbadapter.h \
|
$$PWD/termgdbadapter.h \
|
||||||
$$PWD/remotegdbserveradapter.h \
|
$$PWD/remotegdbserveradapter.h \
|
||||||
$$PWD/gdbplainengine.h \
|
$$PWD/gdbplainengine.h \
|
||||||
$$PWD/gdbprocess.h \
|
|
||||||
$$PWD/startgdbserverdialog.h
|
$$PWD/startgdbserverdialog.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
@@ -16,6 +15,5 @@ SOURCES += \
|
|||||||
$$PWD/coregdbadapter.cpp \
|
$$PWD/coregdbadapter.cpp \
|
||||||
$$PWD/termgdbadapter.cpp \
|
$$PWD/termgdbadapter.cpp \
|
||||||
$$PWD/remotegdbserveradapter.cpp \
|
$$PWD/remotegdbserveradapter.cpp \
|
||||||
$$PWD/gdbprocess.cpp \
|
|
||||||
$$PWD/gdbplainengine.cpp \
|
$$PWD/gdbplainengine.cpp \
|
||||||
$$PWD/startgdbserverdialog.cpp
|
$$PWD/startgdbserverdialog.cpp
|
||||||
|
|||||||
@@ -82,6 +82,7 @@
|
|||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
#include <QDirIterator>
|
#include <QDirIterator>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QProcess>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QTemporaryFile>
|
#include <QTemporaryFile>
|
||||||
|
|
||||||
@@ -241,7 +242,6 @@ GdbEngine::GdbEngine(const DebuggerRunParameters &startParameters)
|
|||||||
m_terminalTrap = startParameters.useTerminal;
|
m_terminalTrap = startParameters.useTerminal;
|
||||||
m_fullStartDone = false;
|
m_fullStartDone = false;
|
||||||
m_systemDumpersLoaded = false;
|
m_systemDumpersLoaded = false;
|
||||||
m_gdbProc = new GdbProcess(this);
|
|
||||||
|
|
||||||
m_debugInfoTaskHandler = new DebugInfoTaskHandler(this);
|
m_debugInfoTaskHandler = new DebugInfoTaskHandler(this);
|
||||||
//ExtensionSystem::PluginManager::addObject(m_debugInfoTaskHandler);
|
//ExtensionSystem::PluginManager::addObject(m_debugInfoTaskHandler);
|
||||||
@@ -282,7 +282,7 @@ QString GdbEngine::errorMessage(QProcess::ProcessError error)
|
|||||||
return tr("The gdb process failed to start. Either the "
|
return tr("The gdb process failed to start. Either the "
|
||||||
"invoked program \"%1\" is missing, or you may have insufficient "
|
"invoked program \"%1\" is missing, or you may have insufficient "
|
||||||
"permissions to invoke the program.\n%2")
|
"permissions to invoke the program.\n%2")
|
||||||
.arg(m_gdb, m_gdbProc->errorString());
|
.arg(m_gdb, m_gdbProc.errorString());
|
||||||
case QProcess::Crashed:
|
case QProcess::Crashed:
|
||||||
if (targetState() == DebuggerFinished)
|
if (targetState() == DebuggerFinished)
|
||||||
return tr("The gdb process crashed some time after starting "
|
return tr("The gdb process crashed some time after starting "
|
||||||
@@ -763,7 +763,7 @@ void GdbEngine::handleResponse(const QByteArray &buff)
|
|||||||
|
|
||||||
void GdbEngine::readGdbStandardError()
|
void GdbEngine::readGdbStandardError()
|
||||||
{
|
{
|
||||||
QByteArray err = m_gdbProc->readAllStandardError();
|
QByteArray err = m_gdbProc.readAllStandardError();
|
||||||
showMessage(_("UNEXPECTED GDB STDERR: " + err));
|
showMessage(_("UNEXPECTED GDB STDERR: " + err));
|
||||||
if (err == "Undefined command: \"bb\". Try \"help\".\n")
|
if (err == "Undefined command: \"bb\". Try \"help\".\n")
|
||||||
return;
|
return;
|
||||||
@@ -779,7 +779,7 @@ void GdbEngine::readGdbStandardOutput()
|
|||||||
int newstart = 0;
|
int newstart = 0;
|
||||||
int scan = m_inbuffer.size();
|
int scan = m_inbuffer.size();
|
||||||
|
|
||||||
QByteArray out = m_gdbProc->readAllStandardOutput();
|
QByteArray out = m_gdbProc.readAllStandardOutput();
|
||||||
m_inbuffer.append(out);
|
m_inbuffer.append(out);
|
||||||
|
|
||||||
// This can trigger when a dialog starts a nested event loop.
|
// This can trigger when a dialog starts a nested event loop.
|
||||||
@@ -961,7 +961,7 @@ void GdbEngine::flushCommand(const DebuggerCommand &cmd0)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTC_ASSERT(m_gdbProc->state() == QProcess::Running, return);
|
QTC_ASSERT(m_gdbProc.state() == QProcess::Running, return);
|
||||||
|
|
||||||
const int token = ++currentToken();
|
const int token = ++currentToken();
|
||||||
|
|
||||||
@@ -1039,7 +1039,7 @@ void GdbEngine::commandTimeout()
|
|||||||
if (mb->exec() == QMessageBox::Ok) {
|
if (mb->exec() == QMessageBox::Ok) {
|
||||||
showMessage(_("KILLING DEBUGGER AS REQUESTED BY USER"));
|
showMessage(_("KILLING DEBUGGER AS REQUESTED BY USER"));
|
||||||
// This is an undefined state, so we just pull the emergency brake.
|
// This is an undefined state, so we just pull the emergency brake.
|
||||||
m_gdbProc->kill();
|
m_gdbProc.kill();
|
||||||
notifyEngineShutdownFailed();
|
notifyEngineShutdownFailed();
|
||||||
} else {
|
} else {
|
||||||
showMessage(_("CONTINUE DEBUGGER AS REQUESTED BY USER"));
|
showMessage(_("CONTINUE DEBUGGER AS REQUESTED BY USER"));
|
||||||
@@ -1908,9 +1908,9 @@ void GdbEngine::notifyAdapterShutdownOk()
|
|||||||
{
|
{
|
||||||
CHECK_STATE(EngineShutdownRequested);
|
CHECK_STATE(EngineShutdownRequested);
|
||||||
showMessage(_("INITIATE GDBENGINE SHUTDOWN IN STATE %1, PROC: %2")
|
showMessage(_("INITIATE GDBENGINE SHUTDOWN IN STATE %1, PROC: %2")
|
||||||
.arg(lastGoodState()).arg(m_gdbProc->state()));
|
.arg(lastGoodState()).arg(m_gdbProc.state()));
|
||||||
m_commandsDoneCallback = 0;
|
m_commandsDoneCallback = 0;
|
||||||
switch (m_gdbProc->state()) {
|
switch (m_gdbProc.state()) {
|
||||||
case QProcess::Running: {
|
case QProcess::Running: {
|
||||||
if (runParameters().closeMode == KillAndExitMonitorAtClose)
|
if (runParameters().closeMode == KillAndExitMonitorAtClose)
|
||||||
postCommand("monitor exit");
|
postCommand("monitor exit");
|
||||||
@@ -1926,7 +1926,7 @@ void GdbEngine::notifyAdapterShutdownOk()
|
|||||||
break;
|
break;
|
||||||
case QProcess::Starting:
|
case QProcess::Starting:
|
||||||
showMessage(_("GDB NOT REALLY RUNNING; KILLING IT"));
|
showMessage(_("GDB NOT REALLY RUNNING; KILLING IT"));
|
||||||
m_gdbProc->kill();
|
m_gdbProc.kill();
|
||||||
notifyEngineShutdownFailed();
|
notifyEngineShutdownFailed();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1943,7 +1943,7 @@ void GdbEngine::handleGdbExit(const DebuggerResponse &response)
|
|||||||
QString::fromLocal8Bit(response.data["msg"].data()));
|
QString::fromLocal8Bit(response.data["msg"].data()));
|
||||||
qDebug() << (_("GDB WON'T EXIT (%1); KILLING IT").arg(msg));
|
qDebug() << (_("GDB WON'T EXIT (%1); KILLING IT").arg(msg));
|
||||||
showMessage(_("GDB WON'T EXIT (%1); KILLING IT").arg(msg));
|
showMessage(_("GDB WON'T EXIT (%1); KILLING IT").arg(msg));
|
||||||
m_gdbProc->kill();
|
m_gdbProc.kill();
|
||||||
notifyEngineShutdownFailed();
|
notifyEngineShutdownFailed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4073,7 +4073,7 @@ void GdbEngine::startGdb(const QStringList &args)
|
|||||||
foreach (int test, m_testCases)
|
foreach (int test, m_testCases)
|
||||||
showMessage(_("ENABLING TEST CASE: " + QByteArray::number(test)));
|
showMessage(_("ENABLING TEST CASE: " + QByteArray::number(test)));
|
||||||
|
|
||||||
m_gdbProc->disconnect(); // From any previous runs
|
m_gdbProc.disconnect(); // From any previous runs
|
||||||
|
|
||||||
const DebuggerRunParameters &rp = runParameters();
|
const DebuggerRunParameters &rp = runParameters();
|
||||||
m_gdb = gdbBinary(rp);
|
m_gdb = gdbBinary(rp);
|
||||||
@@ -4091,15 +4091,18 @@ void GdbEngine::startGdb(const QStringList &args)
|
|||||||
gdbArgs << _("-n");
|
gdbArgs << _("-n");
|
||||||
gdbArgs += args;
|
gdbArgs += args;
|
||||||
|
|
||||||
connect(m_gdbProc, &GdbProcess::error, this, &GdbEngine::handleGdbError);
|
connect(&m_gdbProc, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error),
|
||||||
connect(m_gdbProc, &GdbProcess::finished, this, &GdbEngine::handleGdbFinished);
|
this, &GdbEngine::handleGdbError);
|
||||||
connect(m_gdbProc, &GdbProcess::readyReadStandardOutput, this, &GdbEngine::readGdbStandardOutput);
|
connect(&m_gdbProc, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
|
||||||
connect(m_gdbProc, &GdbProcess::readyReadStandardError, this, &GdbEngine::readGdbStandardError);
|
this, &GdbEngine::handleGdbFinished);
|
||||||
|
connect(&m_gdbProc, &QtcProcess::readyReadStandardOutput, this, &GdbEngine::readGdbStandardOutput);
|
||||||
|
connect(&m_gdbProc, &QtcProcess::readyReadStandardError, this, &GdbEngine::readGdbStandardError);
|
||||||
|
|
||||||
showMessage(_("STARTING ") + m_gdb + _(" ") + gdbArgs.join(QLatin1Char(' ')));
|
showMessage(_("STARTING ") + m_gdb + _(" ") + gdbArgs.join(QLatin1Char(' ')));
|
||||||
m_gdbProc->start(m_gdb, gdbArgs);
|
m_gdbProc.setCommand(m_gdb, QtcProcess::joinArgs(gdbArgs));
|
||||||
|
m_gdbProc.start();
|
||||||
|
|
||||||
if (!m_gdbProc->waitForStarted()) {
|
if (!m_gdbProc.waitForStarted()) {
|
||||||
handleGdbStartFailed();
|
handleGdbStartFailed();
|
||||||
const QString msg = errorMessage(QProcess::FailedToStart);
|
const QString msg = errorMessage(QProcess::FailedToStart);
|
||||||
handleAdapterStartFailed(msg);
|
handleAdapterStartFailed(msg);
|
||||||
@@ -4328,8 +4331,7 @@ void GdbEngine::abortDebugger()
|
|||||||
if (targetState() == DebuggerFinished) {
|
if (targetState() == DebuggerFinished) {
|
||||||
// We already tried. Try harder.
|
// We already tried. Try harder.
|
||||||
showMessage(_("ABORTING DEBUGGER. SECOND TIME."));
|
showMessage(_("ABORTING DEBUGGER. SECOND TIME."));
|
||||||
QTC_ASSERT(m_gdbProc, return);
|
m_gdbProc.kill();
|
||||||
m_gdbProc->kill();
|
|
||||||
} else {
|
} else {
|
||||||
// Be friendly the first time. This will change targetState().
|
// Be friendly the first time. This will change targetState().
|
||||||
showMessage(_("ABORTING DEBUGGER. FIRST TIME."));
|
showMessage(_("ABORTING DEBUGGER. FIRST TIME."));
|
||||||
@@ -4501,7 +4503,7 @@ void GdbEngine::handleAdapterCrashed(const QString &msg)
|
|||||||
notifyEngineIll();
|
notifyEngineIll();
|
||||||
|
|
||||||
// No point in being friendly here ...
|
// No point in being friendly here ...
|
||||||
m_gdbProc->kill();
|
m_gdbProc.kill();
|
||||||
|
|
||||||
if (!msg.isEmpty())
|
if (!msg.isEmpty())
|
||||||
AsynchronousMessageBox::critical(tr("Adapter crashed"), msg);
|
AsynchronousMessageBox::critical(tr("Adapter crashed"), msg);
|
||||||
@@ -4586,7 +4588,7 @@ bool GdbEngine::attemptQuickStart() const
|
|||||||
|
|
||||||
void GdbEngine::write(const QByteArray &data)
|
void GdbEngine::write(const QByteArray &data)
|
||||||
{
|
{
|
||||||
m_gdbProc->write(data);
|
m_gdbProc.write(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GdbEngine::prepareCommand()
|
bool GdbEngine::prepareCommand()
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
#include <coreplugin/id.h>
|
#include <coreplugin/id.h>
|
||||||
|
|
||||||
#include <projectexplorer/devicesupport/idevice.h>
|
#include <projectexplorer/devicesupport/idevice.h>
|
||||||
|
#include <utils/qtcprocess.h>
|
||||||
|
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
@@ -474,7 +475,9 @@ protected:
|
|||||||
bool prepareCommand();
|
bool prepareCommand();
|
||||||
void interruptLocalInferior(qint64 pid);
|
void interruptLocalInferior(qint64 pid);
|
||||||
|
|
||||||
GdbProcess *m_gdbProc;
|
protected:
|
||||||
|
Utils::QtcProcess m_gdbProc;
|
||||||
|
QString m_errorString;
|
||||||
ProjectExplorer::DeviceProcessSignalOperation::Ptr m_signalOperation;
|
ProjectExplorer::DeviceProcessSignalOperation::Ptr m_signalOperation;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,6 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "gdbplainengine.h"
|
#include "gdbplainengine.h"
|
||||||
#include "gdbprocess.h"
|
|
||||||
|
|
||||||
#include <debugger/debuggeractions.h>
|
#include <debugger/debuggeractions.h>
|
||||||
#include <debugger/debuggercore.h>
|
#include <debugger/debuggercore.h>
|
||||||
@@ -127,9 +126,10 @@ void GdbPlainEngine::setupEngine()
|
|||||||
gdbArgs.append(_("--tty=") + m_outputCollector.serverName());
|
gdbArgs.append(_("--tty=") + m_outputCollector.serverName());
|
||||||
|
|
||||||
if (!runParameters().workingDirectory.isEmpty())
|
if (!runParameters().workingDirectory.isEmpty())
|
||||||
m_gdbProc->setWorkingDirectory(runParameters().workingDirectory);
|
m_gdbProc.setWorkingDirectory(runParameters().workingDirectory);
|
||||||
if (runParameters().environment.size())
|
Utils::Environment env = runParameters().environment;
|
||||||
m_gdbProc->setEnvironment(runParameters().environment.toStringList());
|
if (env.size())
|
||||||
|
m_gdbProc.setEnvironment(env);
|
||||||
|
|
||||||
startGdb(gdbArgs);
|
startGdb(gdbArgs);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,134 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2015 The Qt Company Ltd.
|
|
||||||
** Contact: http://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 http://www.qt.io/terms-conditions. For further information
|
|
||||||
** use the contact form at http://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
||||||
** General Public License version 2.1 or version 3 as published by the Free
|
|
||||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
||||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
||||||
** following information to ensure the GNU Lesser General Public License
|
|
||||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
||||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
||||||
** rights. These rights are described in The Qt Company LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "gdbprocess.h"
|
|
||||||
|
|
||||||
#include <debugger/debuggerconstants.h>
|
|
||||||
#include <debugger/debuggercore.h>
|
|
||||||
#include <debugger/procinterrupt.h>
|
|
||||||
|
|
||||||
namespace Debugger {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
GdbProcess::GdbProcess(QObject *parent) : QObject(parent)
|
|
||||||
{
|
|
||||||
connect(&m_gdbProc, SIGNAL(error(QProcess::ProcessError)),
|
|
||||||
this, SIGNAL(error(QProcess::ProcessError)));
|
|
||||||
connect(&m_gdbProc, SIGNAL(finished(int,QProcess::ExitStatus)),
|
|
||||||
this, SIGNAL(finished(int,QProcess::ExitStatus)));
|
|
||||||
connect(&m_gdbProc, SIGNAL(readyReadStandardOutput()),
|
|
||||||
this, SIGNAL(readyReadStandardOutput()));
|
|
||||||
connect(&m_gdbProc, SIGNAL(readyReadStandardError()),
|
|
||||||
this, SIGNAL(readyReadStandardError()));
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray GdbProcess::readAllStandardOutput()
|
|
||||||
{
|
|
||||||
return m_gdbProc.readAllStandardOutput();
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray GdbProcess::readAllStandardError()
|
|
||||||
{
|
|
||||||
return m_gdbProc.readAllStandardError();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GdbProcess::start(const QString &cmd, const QStringList &args)
|
|
||||||
{
|
|
||||||
m_gdbProc.setCommand(cmd, Utils::QtcProcess::joinArgs(args));
|
|
||||||
m_gdbProc.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GdbProcess::waitForStarted()
|
|
||||||
{
|
|
||||||
return m_gdbProc.waitForStarted();
|
|
||||||
}
|
|
||||||
|
|
||||||
qint64 GdbProcess::write(const QByteArray &data)
|
|
||||||
{
|
|
||||||
return m_gdbProc.write(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GdbProcess::kill()
|
|
||||||
{
|
|
||||||
m_gdbProc.kill();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GdbProcess::interrupt()
|
|
||||||
{
|
|
||||||
long pid = Utils::qPidToPid(m_gdbProc.pid());
|
|
||||||
return interruptProcess(pid, GdbEngineType, &m_errorString);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GdbProcess::setUseCtrlCStub(bool enable)
|
|
||||||
{
|
|
||||||
m_gdbProc.setUseCtrlCStub(enable);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GdbProcess::winInterruptByCtrlC()
|
|
||||||
{
|
|
||||||
m_gdbProc.interrupt();
|
|
||||||
}
|
|
||||||
|
|
||||||
QProcess::ProcessState GdbProcess::state() const
|
|
||||||
{
|
|
||||||
return m_gdbProc.state();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString GdbProcess::errorString() const
|
|
||||||
{
|
|
||||||
return m_errorString + m_gdbProc.errorString();
|
|
||||||
}
|
|
||||||
|
|
||||||
QProcessEnvironment GdbProcess::processEnvironment() const
|
|
||||||
{
|
|
||||||
return m_gdbProc.processEnvironment();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GdbProcess::setProcessEnvironment(const QProcessEnvironment &env)
|
|
||||||
{
|
|
||||||
m_gdbProc.setProcessEnvironment(env);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GdbProcess::setEnvironment(const QStringList &env_)
|
|
||||||
{
|
|
||||||
QStringList env = env_;
|
|
||||||
if (isNativeMixedActive())
|
|
||||||
env.append(QLatin1String("QV4_FORCE_INTERPRETER=1")); // FIXME: REMOVE!
|
|
||||||
m_gdbProc.setEnvironment(Utils::Environment(env));
|
|
||||||
}
|
|
||||||
|
|
||||||
void GdbProcess::setWorkingDirectory(const QString &dir)
|
|
||||||
{
|
|
||||||
m_gdbProc.setWorkingDirectory(dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Debugger
|
|
||||||
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2015 The Qt Company Ltd.
|
|
||||||
** Contact: http://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 http://www.qt.io/terms-conditions. For further information
|
|
||||||
** use the contact form at http://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
||||||
** General Public License version 2.1 or version 3 as published by the Free
|
|
||||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
||||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
||||||
** following information to ensure the GNU Lesser General Public License
|
|
||||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
||||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
||||||
** rights. These rights are described in The Qt Company LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef GDBPROCESS_H
|
|
||||||
#define GDBPROCESS_H
|
|
||||||
|
|
||||||
#include <utils/qtcprocess.h>
|
|
||||||
|
|
||||||
namespace Debugger {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class GdbProcess : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit GdbProcess(QObject *parent = 0);
|
|
||||||
|
|
||||||
QByteArray readAllStandardOutput();
|
|
||||||
QByteArray readAllStandardError();
|
|
||||||
|
|
||||||
void start(const QString &cmd, const QStringList &args);
|
|
||||||
bool waitForStarted();
|
|
||||||
qint64 write(const QByteArray &data);
|
|
||||||
void kill();
|
|
||||||
bool interrupt();
|
|
||||||
void setUseCtrlCStub(bool enable);
|
|
||||||
void winInterruptByCtrlC();
|
|
||||||
|
|
||||||
QProcess::ProcessState state() const;
|
|
||||||
QString errorString() const;
|
|
||||||
|
|
||||||
QProcessEnvironment processEnvironment() const;
|
|
||||||
void setProcessEnvironment(const QProcessEnvironment &env);
|
|
||||||
void setEnvironment(const QStringList &env);
|
|
||||||
void setWorkingDirectory(const QString &dir);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void error(QProcess::ProcessError);
|
|
||||||
void finished(int exitCode, QProcess::ExitStatus exitStatus);
|
|
||||||
void readyReadStandardError();
|
|
||||||
void readyReadStandardOutput();
|
|
||||||
|
|
||||||
private:
|
|
||||||
Utils::QtcProcess m_gdbProc;
|
|
||||||
QString m_errorString;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Debugger
|
|
||||||
|
|
||||||
#endif // GDBPROCESS_H
|
|
||||||
@@ -30,13 +30,12 @@
|
|||||||
|
|
||||||
#include "remotegdbserveradapter.h"
|
#include "remotegdbserveradapter.h"
|
||||||
|
|
||||||
#include "gdbprocess.h"
|
|
||||||
|
|
||||||
#include <debugger/debuggeractions.h>
|
#include <debugger/debuggeractions.h>
|
||||||
#include <debugger/debuggercore.h>
|
#include <debugger/debuggercore.h>
|
||||||
#include <debugger/debuggerprotocol.h>
|
#include <debugger/debuggerprotocol.h>
|
||||||
#include <debugger/debuggerstartparameters.h>
|
#include <debugger/debuggerstartparameters.h>
|
||||||
#include <debugger/debuggerstringutils.h>
|
#include <debugger/debuggerstringutils.h>
|
||||||
|
#include <debugger/procinterrupt.h>
|
||||||
|
|
||||||
#include <coreplugin/messagebox.h>
|
#include <coreplugin/messagebox.h>
|
||||||
|
|
||||||
@@ -63,7 +62,7 @@ GdbRemoteServerEngine::GdbRemoteServerEngine(const DebuggerRunParameters &startP
|
|||||||
: GdbEngine(startParameters), m_startAttempted(false)
|
: GdbEngine(startParameters), m_startAttempted(false)
|
||||||
{
|
{
|
||||||
if (HostOsInfo::isWindowsHost())
|
if (HostOsInfo::isWindowsHost())
|
||||||
m_gdbProc->setUseCtrlCStub(startParameters.useCtrlCStub); // This is only set for QNX/BlackBerry
|
m_gdbProc.setUseCtrlCStub(startParameters.useCtrlCStub); // This is only set for QNX/BlackBerry
|
||||||
|
|
||||||
connect(&m_uploadProc, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error),
|
connect(&m_uploadProc, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error),
|
||||||
this, &GdbRemoteServerEngine::uploadProcError);
|
this, &GdbRemoteServerEngine::uploadProcError);
|
||||||
@@ -91,9 +90,9 @@ void GdbRemoteServerEngine::setupEngine()
|
|||||||
m_uploadProc.waitForStarted();
|
m_uploadProc.waitForStarted();
|
||||||
}
|
}
|
||||||
if (!runParameters().workingDirectory.isEmpty())
|
if (!runParameters().workingDirectory.isEmpty())
|
||||||
m_gdbProc->setWorkingDirectory(runParameters().workingDirectory);
|
m_gdbProc.setWorkingDirectory(runParameters().workingDirectory);
|
||||||
if (runParameters().environment.size())
|
if (runParameters().environment.size())
|
||||||
m_gdbProc->setEnvironment(runParameters().environment.toStringList());
|
m_gdbProc.setEnvironment(runParameters().environment);
|
||||||
|
|
||||||
if (runParameters().remoteSetupNeeded)
|
if (runParameters().remoteSetupNeeded)
|
||||||
notifyEngineRequestRemoteSetup();
|
notifyEngineRequestRemoteSetup();
|
||||||
@@ -435,9 +434,10 @@ void GdbRemoteServerEngine::interruptInferior2()
|
|||||||
postCommand("-exec-interrupt", GdbEngine::Immediate,
|
postCommand("-exec-interrupt", GdbEngine::Immediate,
|
||||||
CB(handleInterruptInferior));
|
CB(handleInterruptInferior));
|
||||||
} else if (m_isQnxGdb && HostOsInfo::isWindowsHost()) {
|
} else if (m_isQnxGdb && HostOsInfo::isWindowsHost()) {
|
||||||
m_gdbProc->winInterruptByCtrlC();
|
m_gdbProc.interrupt();
|
||||||
} else {
|
} else {
|
||||||
bool ok = m_gdbProc->interrupt();
|
long pid = Utils::qPidToPid(m_gdbProc.pid());
|
||||||
|
bool ok = interruptProcess(pid, GdbEngineType, &m_errorString);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
// FIXME: Extra state needed?
|
// FIXME: Extra state needed?
|
||||||
showMessage(_("NOTE: INFERIOR STOP NOT POSSIBLE"));
|
showMessage(_("NOTE: INFERIOR STOP NOT POSSIBLE"));
|
||||||
|
|||||||
Reference in New Issue
Block a user