forked from qt-creator/qt-creator
Debugging/gdb: Fix RemotePlainGdbAdapter.
Reviewed-by: hjk
This commit is contained in:
@@ -31,6 +31,8 @@
|
|||||||
|
|
||||||
#include "remoteplaingdbadapter.h"
|
#include "remoteplaingdbadapter.h"
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
@@ -59,6 +61,13 @@ QByteArray RemoteGdbProcess::readAllStandardError()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RemoteGdbProcess::start(const QString &cmd, const QStringList &args)
|
void RemoteGdbProcess::start(const QString &cmd, const QStringList &args)
|
||||||
|
{
|
||||||
|
Q_UNUSED(cmd);
|
||||||
|
Q_UNUSED(args);
|
||||||
|
QTC_ASSERT(m_gdbStarted, return);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RemoteGdbProcess::realStart(const QString &cmd, const QStringList &args)
|
||||||
{
|
{
|
||||||
m_command = cmd;
|
m_command = cmd;
|
||||||
m_cmdArgs = args;
|
m_cmdArgs = args;
|
||||||
@@ -66,7 +75,7 @@ void RemoteGdbProcess::start(const QString &cmd, const QStringList &args)
|
|||||||
m_error.clear();
|
m_error.clear();
|
||||||
m_conn = SshConnection::create();
|
m_conn = SshConnection::create();
|
||||||
connect(m_conn.data(), SIGNAL(connected()), this, SLOT(handleConnected()));
|
connect(m_conn.data(), SIGNAL(connected()), this, SLOT(handleConnected()));
|
||||||
connect(m_conn.data(), SIGNAL(error(SshError)), this,
|
connect(m_conn.data(), SIGNAL(error(Core::SshError)), this,
|
||||||
SLOT(handleConnectionError()));
|
SLOT(handleConnectionError()));
|
||||||
m_conn->connectToHost(m_connParams);
|
m_conn->connectToHost(m_connParams);
|
||||||
}
|
}
|
||||||
@@ -129,13 +138,15 @@ void RemoteGdbProcess::handleAppOutputReaderFinished(int exitStatus)
|
|||||||
void RemoteGdbProcess::handleGdbStarted()
|
void RemoteGdbProcess::handleGdbStarted()
|
||||||
{
|
{
|
||||||
m_gdbStarted = true;
|
m_gdbStarted = true;
|
||||||
|
emit started();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteGdbProcess::handleGdbFinished(int exitStatus)
|
void RemoteGdbProcess::handleGdbFinished(int exitStatus)
|
||||||
{
|
{
|
||||||
switch (exitStatus) {
|
switch (exitStatus) {
|
||||||
case SshRemoteProcess::FailedToStart:
|
case SshRemoteProcess::FailedToStart:
|
||||||
emitErrorExit(tr("Remote gdb failed to start."));
|
m_error = tr("Remote gdb failed to start.");
|
||||||
|
emit startFailed();
|
||||||
break;
|
break;
|
||||||
case SshRemoteProcess::KilledBySignal:
|
case SshRemoteProcess::KilledBySignal:
|
||||||
emitErrorExit(tr("Remote gdb crashed."));
|
emitErrorExit(tr("Remote gdb crashed."));
|
||||||
|
|||||||
@@ -67,9 +67,14 @@ public:
|
|||||||
virtual void setWorkingDirectory(const QString &dir);
|
virtual void setWorkingDirectory(const QString &dir);
|
||||||
|
|
||||||
void interruptInferior();
|
void interruptInferior();
|
||||||
|
void realStart(const QString &cmd, const QStringList &args);
|
||||||
|
|
||||||
static const QByteArray CtrlC;
|
static const QByteArray CtrlC;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void started();
|
||||||
|
void startFailed();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleConnected();
|
void handleConnected();
|
||||||
void handleConnectionError();
|
void handleConnectionError();
|
||||||
|
|||||||
@@ -41,6 +41,9 @@ RemotePlainGdbAdapter::RemotePlainGdbAdapter(GdbEngine *engine, QObject *parent)
|
|||||||
: AbstractPlainGdbAdapter(engine, parent),
|
: AbstractPlainGdbAdapter(engine, parent),
|
||||||
m_gdbProc(engine->startParameters().connParams, this)
|
m_gdbProc(engine->startParameters().connParams, this)
|
||||||
{
|
{
|
||||||
|
connect(&m_gdbProc, SIGNAL(started()), this, SLOT(handleGdbStarted()));
|
||||||
|
connect(&m_gdbProc, SIGNAL(startFailed()), this,
|
||||||
|
SLOT(handleGdbStartFailed()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemotePlainGdbAdapter::startAdapter()
|
void RemotePlainGdbAdapter::startAdapter()
|
||||||
@@ -106,11 +109,22 @@ void RemotePlainGdbAdapter::handleSetupDone()
|
|||||||
m_gdbProc.setWorkingDirectory(startParameters().workingDirectory);
|
m_gdbProc.setWorkingDirectory(startParameters().workingDirectory);
|
||||||
if (!startParameters().environment.isEmpty())
|
if (!startParameters().environment.isEmpty())
|
||||||
m_gdbProc.setEnvironment(startParameters().environment);
|
m_gdbProc.setEnvironment(startParameters().environment);
|
||||||
|
m_gdbProc.realStart(m_engine->startParameters().debuggerCommand,
|
||||||
|
QStringList() << QLatin1String("-i") << QLatin1String("mi"));
|
||||||
|
}
|
||||||
|
|
||||||
if (m_engine->startGdb(QStringList(), m_engine->startParameters().debuggerCommand))
|
void RemotePlainGdbAdapter::handleGdbStarted()
|
||||||
|
{
|
||||||
|
if (m_engine->startGdb(QStringList(),
|
||||||
|
m_engine->startParameters().debuggerCommand))
|
||||||
m_engine->handleAdapterStarted();
|
m_engine->handleAdapterStarted();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RemotePlainGdbAdapter::handleGdbStartFailed()
|
||||||
|
{
|
||||||
|
m_engine->handleAdapterStartFailed(m_gdbProc.errorString());
|
||||||
|
}
|
||||||
|
|
||||||
void RemotePlainGdbAdapter::handleSetupFailed(const QString &reason)
|
void RemotePlainGdbAdapter::handleSetupFailed(const QString &reason)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
|
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
|
||||||
|
|||||||
@@ -49,6 +49,10 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void requestSetup();
|
void requestSetup();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void handleGdbStarted();
|
||||||
|
void handleGdbStartFailed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void startAdapter();
|
void startAdapter();
|
||||||
void setupInferior();
|
void setupInferior();
|
||||||
|
|||||||
Reference in New Issue
Block a user