From a4501441cb8fbfac38d5ed88cd83cfa332eb1b42 Mon Sep 17 00:00:00 2001 From: Christian Kandeler <christian.kandeler@nokia.com> Date: Thu, 21 Oct 2010 11:35:18 +0200 Subject: [PATCH] Maemo: Fix debugger race condition. "gdbserver started" does not necessarily mean "gdbserver has opened its port". Reviewed-by: Tobias Hunger --- .../qt-maemo/maemodebugsupport.cpp | 15 ++++++++------- .../qt-maemo/maemodebugsupport.h | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp index d67de573fdc..abac864fa01 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp @@ -230,12 +230,11 @@ void MaemoDebugSupport::startDebugging() if (useGdb()) { handleAdapterSetupDone(); } else { + m_gdbserverOutput.clear(); connect(m_runner, SIGNAL(remoteErrorOutput(QByteArray)), this, SLOT(handleRemoteErrorOutput(QByteArray))); connect(m_runner, SIGNAL(remoteOutput(QByteArray)), this, SLOT(handleRemoteOutput(QByteArray))); - connect(m_runner, SIGNAL(remoteProcessStarted()), this, - SLOT(handleRemoteProcessStarted())); const QString &remoteExe = m_runConfig->remoteExecutableFilePath(); const QString cmdPrefix = MaemoGlobal::remoteCommandPrefix(remoteExe); const QString env = environment(m_runConfig); @@ -250,11 +249,6 @@ void MaemoDebugSupport::startDebugging() } } -void MaemoDebugSupport::handleRemoteProcessStarted() -{ - handleAdapterSetupDone(); -} - void MaemoDebugSupport::handleDebuggingFinished() { m_stopped = true; @@ -269,6 +263,13 @@ void MaemoDebugSupport::handleRemoteOutput(const QByteArray &output) void MaemoDebugSupport::handleRemoteErrorOutput(const QByteArray &output) { m_runControl->showMessage(QString::fromUtf8(output), AppOutput); + if (!m_adapterStarted && !useGdb() && !m_qmlOnlyDebugging) { + m_gdbserverOutput += output; + if (m_gdbserverOutput.contains("Listening on port")) { + handleAdapterSetupDone(); + m_gdbserverOutput.clear(); + } + } } void MaemoDebugSupport::handleProgressReport(const QString &progressOutput) diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.h b/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.h index a53ae208573..d4849aa659c 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.h @@ -75,7 +75,6 @@ private slots: void handleSftpChannelInitialized(); void handleSftpChannelInitializationFailed(const QString &error); void handleSftpJobFinished(Core::SftpJobId job, const QString &error); - void handleRemoteProcessStarted(); void handleDebuggingFinished(); void handleRemoteOutput(const QByteArray &output); void handleRemoteErrorOutput(const QByteArray &output); @@ -102,6 +101,7 @@ private: Core::SftpJobId m_uploadJob; bool m_adapterStarted; bool m_stopped; + QByteArray m_gdbserverOutput; }; } // namespace Internal -- GitLab