From a4712967805429e4e940c8dab4f50188feee51ac Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 15 Apr 2011 14:20:04 +0200 Subject: [PATCH] Maemo: Detect unexpected gdbserver exit. Task-number: QTCREATORBUG-4535 --- .../qt-maemo/maemodebugsupport.cpp | 31 ++++++++++++++----- .../qt-maemo/maemodebugsupport.h | 1 + 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp index ee755edb601..732a517ae94 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp @@ -294,17 +294,34 @@ void MaemoDebugSupport::startDebugging() args += QString(QLatin1String(" -qmljsdebugger=port:%1,block")) .arg(m_qmlPort); } - const QString remoteCommandLine - = m_debuggingType == MaemoRunConfiguration::DebugQmlOnly - ? QString::fromLocal8Bit("%1 %2 %3 %4").arg(cmdPrefix).arg(env) - .arg(remoteExe).arg(args) - : QString::fromLocal8Bit("%1 %2 gdbserver :%3 %4 %5") - .arg(cmdPrefix).arg(env).arg(m_gdbServerPort) - .arg(remoteExe).arg(args); + + QString remoteCommandLine; + if (m_debuggingType == MaemoRunConfiguration::DebugQmlOnly) { + remoteCommandLine = QString::fromLocal8Bit("%1 %2 %3 %4") + .arg(cmdPrefix).arg(env).arg(remoteExe).arg(args); + } else { + remoteCommandLine = QString::fromLocal8Bit("%1 %2 gdbserver :%3 %4 %5") + .arg(cmdPrefix).arg(env).arg(m_gdbServerPort) + .arg(remoteExe).arg(args); + connect(m_runner, SIGNAL(remoteProcessFinished(qint64)), + SLOT(handleGdbServerFinished(qint64))); + } + m_runner->startExecution(remoteCommandLine.toUtf8()); } } +void MaemoDebugSupport::handleGdbServerFinished(qint64 exitCode) +{ + if (!m_engine || m_state == Inactive || exitCode == 0) + return; + + if (m_state == Debugging) + m_engine->notifyInferiorIll(); + else + m_engine->handleRemoteSetupFailed(tr("The gdbserver process closed unexpectedly.")); +} + void MaemoDebugSupport::handleDebuggingFinished() { setState(Inactive); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.h b/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.h index ed1af09d934..176b890c4c2 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.h @@ -80,6 +80,7 @@ private slots: void handleRemoteErrorOutput(const QByteArray &output); void handleProgressReport(const QString &progressOutput); void handleRemoteProcessStarted(); + void handleGdbServerFinished(qint64 exitCode); private: enum State {