From e3f47cbf94439306c9d5efa31363973c8d447313 Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Tue, 15 Sep 2009 12:16:21 +0200 Subject: [PATCH] debugger: fix recent regression in startup logic --- src/plugins/debugger/gdb/gdbengine.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index bfe3549b2b7..839d028e052 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -762,15 +762,21 @@ void GdbEngine::postCommand(const QString &command, GdbCommandFlags flags, void GdbEngine::flushCommand(GdbCommand &cmd) { + if (m_gdbAdapter->state() != QProcess::Running) { + emit gdbInputAvailable(LogInput, cmd.command); + debugMessage(_("GDB PROCESS NOT RUNNING, PLAIN CMD IGNORED: ") + cmd.command); + return; + } + ++currentToken(); cmd.postTime = QTime::currentTime(); m_cookieForToken[currentToken()] = cmd; cmd.command = QString::number(currentToken()) + cmd.command; if (cmd.flags & EmbedToken) cmd.command = cmd.command.arg(currentToken()); - emit gdbInputAvailable(LogInput, cmd.command); - executeDebuggerCommand(cmd.command); + + m_gdbAdapter->write(cmd.command.toLatin1() + "\r\n"); } void GdbEngine::handleResultRecord(const GdbResultRecord &record) @@ -841,6 +847,8 @@ void GdbEngine::handleResultRecord(const GdbResultRecord &record) << m_pendingRequests << cmd.command); } + // Continue only if there are no commands wire anymore, so this will + // be fully synchroneous. // This is somewhat inefficient, as it makes the last command synchronous. // An optimization would be requesting the continue immediately when the // event loop is entered, and let individual commands have a flag to suppress -- GitLab