diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 8456591f85f..d36686d3855 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -746,6 +746,17 @@ void GdbEngine::postCommandHelper(const GdbCommand &cmd) } } +void GdbEngine::flushQueuedCommands() +{ + showStatusMessage(tr("Processing queued commands."), 1000); + while (!m_commandsToRunOnTemporaryBreak.isEmpty()) { + GdbCommand cmd = m_commandsToRunOnTemporaryBreak.takeFirst(); + debugMessage(_("RUNNING QUEUED COMMAND %1 %2") + .arg(cmd.command).arg(_(cmd.callbackName))); + flushCommand(cmd); + } +} + void GdbEngine::flushCommand(const GdbCommand &cmd0) { GdbCommand cmd = cmd0; @@ -1066,13 +1077,7 @@ void GdbEngine::handleStopResponse(const GdbMi &data) if (!m_commandsToRunOnTemporaryBreak.isEmpty()) { QTC_ASSERT(state() == InferiorStopping, qDebug() << state()) setState(InferiorStopped); - showStatusMessage(tr("Processing queued commands."), 1000); - while (!m_commandsToRunOnTemporaryBreak.isEmpty()) { - GdbCommand cmd = m_commandsToRunOnTemporaryBreak.takeFirst(); - debugMessage(_("RUNNING QUEUED COMMAND %1 %2") - .arg(cmd.command).arg(_(cmd.callbackName))); - flushCommand(cmd); - } + flushQueuedCommands(); QTC_ASSERT(m_commandsDoneCallback == 0, /**/); m_commandsDoneCallback = &GdbEngine::autoContinueInferior; return; @@ -1319,6 +1324,8 @@ void GdbEngine::handleExecContinue(const GdbResponse &response) setState(InferiorStopped); QByteArray msg = response.data.findChild("msg").data(); if (msg.startsWith("Cannot find bounds of current function")) { + if (!m_commandsToRunOnTemporaryBreak.isEmpty()) + flushQueuedCommands(); showStatusMessage(tr("Stopped."), 5000); //showStatusMessage(tr("No debug information available. " // "Leaving function...")); @@ -1326,6 +1333,7 @@ void GdbEngine::handleExecContinue(const GdbResponse &response) } else { showMessageBox(QMessageBox::Critical, tr("Execution Error"), tr("Cannot continue debugged process:\n") + QString::fromLocal8Bit(msg)); + m_commandsToRunOnTemporaryBreak.clear(); shutdown(); } } diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index 2636d16c8dd..665e77688de 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -226,6 +226,7 @@ private: ////////// Gdb Command Management ////////// const char *callbackName, const QVariant &cookie = QVariant()); void postCommandHelper(const GdbCommand &cmd); + void flushQueuedCommands(); void setTokenBarrier(); QHash m_cookieForToken;