From 3b280a3ad3f287a27265d6c83e8f25473868d4f5 Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Wed, 30 Sep 2009 13:07:14 +0200 Subject: [PATCH] debugger: fix 'Detach debugger' action --- src/plugins/debugger/debuggermanager.cpp | 2 -- src/plugins/debugger/debuggerplugin.cpp | 7 ++++--- src/plugins/debugger/gdb/gdbengine.cpp | 6 +++++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index 76dfff70a4e..3e83cd7c19f 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 4efc857d1f1..421eaeea4d4 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 ba15808f918..e338d76f7e8 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(); } -- GitLab