Commit 3b280a3a authored by hjk's avatar hjk

debugger: fix 'Detach debugger' action

parent 163150e3
...@@ -1695,8 +1695,6 @@ void DebuggerManager::setState(DebuggerState state) ...@@ -1695,8 +1695,6 @@ void DebuggerManager::setState(DebuggerState state)
d->m_actions.runToFunctionAction->setEnabled(stopped); d->m_actions.runToFunctionAction->setEnabled(stopped);
d->m_actions.jumpToLineAction->setEnabled(stopped); d->m_actions.jumpToLineAction->setEnabled(stopped);
d->m_actions.nextAction->setEnabled(stopped); d->m_actions.nextAction->setEnabled(stopped);
//showStatusMessage(QString("stoppable: %1, running: %2")
// .arg(stoppable).arg(running));
emit stateChanged(d->m_state); emit stateChanged(d->m_state);
const bool notbusy = state == InferiorStopped const bool notbusy = state == InferiorStopped
|| state == DebuggerNotReady || state == DebuggerNotReady
......
...@@ -898,6 +898,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess ...@@ -898,6 +898,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
connect(theDebuggerAction(SettingsDialog), SIGNAL(triggered()), connect(theDebuggerAction(SettingsDialog), SIGNAL(triggered()),
this, SLOT(showSettingsDialog())); this, SLOT(showSettingsDialog()));
handleStateChanged(DebuggerNotReady);
return true; return true;
} }
...@@ -1120,8 +1121,8 @@ void DebuggerPlugin::handleStateChanged(int state) ...@@ -1120,8 +1121,8 @@ void DebuggerPlugin::handleStateChanged(int state)
const bool starting = state == EngineStarting; const bool starting = state == EngineStarting;
//const bool running = state == InferiorRunning; //const bool running = state == InferiorRunning;
const bool ready = state == InferiorStopped const bool detachable = state == InferiorStopped
&& m_manager->startParameters()->startMode != AttachCore; && m_manager->startParameters()->startMode != AttachCore;
m_startExternalAction->setEnabled(!started && !starting); m_startExternalAction->setEnabled(!started && !starting);
m_attachExternalAction->setEnabled(!started && !starting); m_attachExternalAction->setEnabled(!started && !starting);
...@@ -1131,7 +1132,7 @@ void DebuggerPlugin::handleStateChanged(int state) ...@@ -1131,7 +1132,7 @@ void DebuggerPlugin::handleStateChanged(int state)
m_attachCoreAction->setEnabled(!started && !starting); m_attachCoreAction->setEnabled(!started && !starting);
#endif #endif
m_startRemoteAction->setEnabled(!started && !starting); m_startRemoteAction->setEnabled(!started && !starting);
m_detachAction->setEnabled(ready); m_detachAction->setEnabled(detachable);
} }
void DebuggerPlugin::writeSettings() const void DebuggerPlugin::writeSettings() const
......
...@@ -1444,7 +1444,11 @@ void GdbEngine::shutdown() ...@@ -1444,7 +1444,11 @@ void GdbEngine::shutdown()
void GdbEngine::detachDebugger() void GdbEngine::detachDebugger()
{ {
QTC_ASSERT(startMode() == AttachExternal, /**/); QTC_ASSERT(state() == InferiorStopped, /**/);
QTC_ASSERT(startMode() != AttachCore, /**/);
postCommand(_("detach"));
setState(InferiorShuttingDown);
setState(InferiorShutDown);
shutdown(); shutdown();
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment