diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 19890fc0acc061a3c7409b14dfda3f88641851da..38e2f75a1c71b9cf7020fb30dc3f9ae49f1c7765 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -791,6 +791,8 @@ void GdbEngine::flushCommand(const GdbCommand &cmd0) return; } + QTC_ASSERT(gdbProc()->state() == QProcess::Running, /**/); + ++currentToken(); GdbCommand cmd = cmd0; cmd.postTime = QTime::currentTime(); @@ -809,7 +811,7 @@ void GdbEngine::flushCommand(const GdbCommand &cmd0) // sent and a response could be retrieved. We don't want the watchdog // to bark in that case since the only possible outcome is a dead // process anyway. - if (cmd.command != "-gdb-exit") + if (!cmd.command.endsWith("-gdb-exit")) m_commandTimer->start(); //if (cmd.flags & LosesChild) @@ -1665,7 +1667,13 @@ void GdbEngine::notifyAdapterShutdownOk() showMessage(_("INITIATE GDBENGINE SHUTDOWN IN STATE %1, PROC: %2") .arg(lastGoodState()).arg(gdbProc()->state())); m_commandsDoneCallback = 0; - postCommand("-gdb-exit", GdbEngine::ExitRequest, CB(handleGdbExit)); + if (gdbProc()->state() == QProcess::Running) { + postCommand("-gdb-exit", GdbEngine::ExitRequest, CB(handleGdbExit)); + } else { + showMessage(_("GDB NOT REALLY RUNNING; KILLING IT")); + gdbProc()->kill(); + notifyEngineShutdownFailed(); + } } void GdbEngine::handleGdbExit(const GdbResponse &response)