#include "remoteplaingdbadapter.h"
+#include <utils/qtcassert.h>
+
#include <ctype.h>
using namespace Core;
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;
m_gdbStarted = false;
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);
}
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."));
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();
: 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()
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());
signals:
void requestSetup();
+private slots:
+ void handleGdbStarted();
+ void handleGdbStartFailed();
+
private:
void startAdapter();
void setupInferior();