diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index 76dfff70a4eec7fae9a764cee80d9f1a2345b4df..3e83cd7c19f69e17576b015dff0c979fbb517c57 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -1695,8 +1695,6 @@ void DebuggerManager::setState(DebuggerState state) d->m_actions.runToFunctionAction->setEnabled(stopped); d->m_actions.jumpToLineAction->setEnabled(stopped); d->m_actions.nextAction->setEnabled(stopped); - //showStatusMessage(QString("stoppable: %1, running: %2") - // .arg(stoppable).arg(running)); emit stateChanged(d->m_state); const bool notbusy = state == InferiorStopped || state == DebuggerNotReady diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 4efc857d1f122b18ebd87624b235f87b51a136f7..421eaeea4d47e72dbb4ab61e18d94f4f649869f0 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -898,6 +898,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess connect(theDebuggerAction(SettingsDialog), SIGNAL(triggered()), this, SLOT(showSettingsDialog())); + handleStateChanged(DebuggerNotReady); return true; } @@ -1120,8 +1121,8 @@ void DebuggerPlugin::handleStateChanged(int state) const bool starting = state == EngineStarting; //const bool running = state == InferiorRunning; - const bool ready = state == InferiorStopped - && m_manager->startParameters()->startMode != AttachCore; + const bool detachable = state == InferiorStopped + && m_manager->startParameters()->startMode != AttachCore; m_startExternalAction->setEnabled(!started && !starting); m_attachExternalAction->setEnabled(!started && !starting); @@ -1131,7 +1132,7 @@ void DebuggerPlugin::handleStateChanged(int state) m_attachCoreAction->setEnabled(!started && !starting); #endif m_startRemoteAction->setEnabled(!started && !starting); - m_detachAction->setEnabled(ready); + m_detachAction->setEnabled(detachable); } void DebuggerPlugin::writeSettings() const diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index ba15808f918dae192f604a721a66f80167d65297..e338d76f7e8fc5b67e8d86edcbb11e5220fb1b56 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -1444,7 +1444,11 @@ void GdbEngine::shutdown() void GdbEngine::detachDebugger() { - QTC_ASSERT(startMode() == AttachExternal, /**/); + QTC_ASSERT(state() == InferiorStopped, /**/); + QTC_ASSERT(startMode() != AttachCore, /**/); + postCommand(_("detach")); + setState(InferiorShuttingDown); + setState(InferiorShutDown); shutdown(); }