diff --git a/src/plugins/debugger/gdb/remotegdbprocess.cpp b/src/plugins/debugger/gdb/remotegdbprocess.cpp index 7288f44c7b813d52409d4509852ac489397d0232..0b84a5b4a02497f6f311ad981b7e432652c9ecfa 100644 --- a/src/plugins/debugger/gdb/remotegdbprocess.cpp +++ b/src/plugins/debugger/gdb/remotegdbprocess.cpp @@ -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.")); diff --git a/src/plugins/debugger/gdb/remotegdbprocess.h b/src/plugins/debugger/gdb/remotegdbprocess.h index 9a9679b6952b7c156fd0059820bc45245e1bc9a4..e47a4a22841e7318799e4700eff07a7a4dfe9753 100644 --- a/src/plugins/debugger/gdb/remotegdbprocess.h +++ b/src/plugins/debugger/gdb/remotegdbprocess.h @@ -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(); diff --git a/src/plugins/debugger/gdb/remoteplaingdbadapter.cpp b/src/plugins/debugger/gdb/remoteplaingdbadapter.cpp index 2d06ff3175426976fdb59a5c6e7ef1c3d2e23285..9ade0265e685711a3c628f36fae6a1f39bc4ffe9 100644 --- a/src/plugins/debugger/gdb/remoteplaingdbadapter.cpp +++ b/src/plugins/debugger/gdb/remoteplaingdbadapter.cpp @@ -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()); diff --git a/src/plugins/debugger/gdb/remoteplaingdbadapter.h b/src/plugins/debugger/gdb/remoteplaingdbadapter.h index 68a2651b06c7d74f1f5ecc5c17ecbdcb965ec80c..6275e8a7d9ff22c59d25fb5a8e8b8bc7b61522c4 100644 --- a/src/plugins/debugger/gdb/remoteplaingdbadapter.h +++ b/src/plugins/debugger/gdb/remoteplaingdbadapter.h @@ -49,6 +49,10 @@ public: signals: void requestSetup(); +private slots: + void handleGdbStarted(); + void handleGdbStartFailed(); + private: void startAdapter(); void setupInferior();