Commit 8c6d8854 authored by Christian Kandeler's avatar Christian Kandeler
Browse files

Debugging/gdb: Fix RemotePlainGdbAdapter.

Reviewed-by: hjk
parent 8ae109b8
......@@ -31,6 +31,8 @@
#include "remoteplaingdbadapter.h"
#include <utils/qtcassert.h>
#include <ctype.h>
using namespace Core;
......@@ -59,6 +61,13 @@ QByteArray RemoteGdbProcess::readAllStandardError()
}
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_cmdArgs = args;
......@@ -66,7 +75,7 @@ void RemoteGdbProcess::start(const QString &cmd, const QStringList &args)
m_error.clear();
m_conn = SshConnection::create();
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()));
m_conn->connectToHost(m_connParams);
}
......@@ -129,13 +138,15 @@ void RemoteGdbProcess::handleAppOutputReaderFinished(int exitStatus)
void RemoteGdbProcess::handleGdbStarted()
{
m_gdbStarted = true;
emit started();
}
void RemoteGdbProcess::handleGdbFinished(int exitStatus)
{
switch (exitStatus) {
case SshRemoteProcess::FailedToStart:
emitErrorExit(tr("Remote gdb failed to start."));
m_error = tr("Remote gdb failed to start.");
emit startFailed();
break;
case SshRemoteProcess::KilledBySignal:
emitErrorExit(tr("Remote gdb crashed."));
......
......@@ -67,9 +67,14 @@ public:
virtual void setWorkingDirectory(const QString &dir);
void interruptInferior();
void realStart(const QString &cmd, const QStringList &args);
static const QByteArray CtrlC;
signals:
void started();
void startFailed();
private slots:
void handleConnected();
void handleConnectionError();
......
......@@ -41,6 +41,9 @@ RemotePlainGdbAdapter::RemotePlainGdbAdapter(GdbEngine *engine, QObject *parent)
: AbstractPlainGdbAdapter(engine, parent),
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()
......@@ -106,11 +109,22 @@ void RemotePlainGdbAdapter::handleSetupDone()
m_gdbProc.setWorkingDirectory(startParameters().workingDirectory);
if (!startParameters().environment.isEmpty())
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();
}
void RemotePlainGdbAdapter::handleGdbStartFailed()
{
m_engine->handleAdapterStartFailed(m_gdbProc.errorString());
}
void RemotePlainGdbAdapter::handleSetupFailed(const QString &reason)
{
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
......
......@@ -49,6 +49,10 @@ public:
signals:
void requestSetup();
private slots:
void handleGdbStarted();
void handleGdbStartFailed();
private:
void startAdapter();
void setupInferior();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment