Debugger: Fix crash toggling Stack/"Derefence Pointers" without project

Enable debugger actions correctly.
Reviewed-by: hjk <qtc-committer@nokia.com>
This commit is contained in:
Friedemann Kleint
2009-10-07 13:36:48 +02:00
parent e2e9c77323
commit 1fb8f60e03
9 changed files with 62 additions and 10 deletions

View File

@@ -1684,11 +1684,51 @@ void DebuggerManager::setState(DebuggerState state)
d->m_actions.runToFunctionAction->setEnabled(stopped);
d->m_actions.jumpToLineAction->setEnabled(stopped);
d->m_actions.nextAction->setEnabled(stopped);
const bool actionsEnabled = debuggerActionsEnabled();
theDebuggerAction(RecheckDebuggingHelpers)->setEnabled(actionsEnabled);
theDebuggerAction(AutoDerefPointers)->setEnabled(actionsEnabled && d->m_engine->isGdbEngine());
theDebuggerAction(ExpandStack)->setEnabled(actionsEnabled);
theDebuggerAction(ExecuteCommand)->setEnabled(d->m_state != DebuggerNotReady);
emit stateChanged(d->m_state);
const bool notbusy = state == InferiorStopped
|| state == DebuggerNotReady
|| state == InferiorUnrunnable;
setBusyCursor(!notbusy);
}
bool DebuggerManager::debuggerActionsEnabled() const
{
if (!d->m_engine)
return false;
switch (state()) {
case InferiorPrepared:
case InferiorStarting:
case InferiorRunningRequested:
case InferiorRunning:
case InferiorUnrunnable:
case InferiorStopping:
case InferiorStopped:
return true;
case DebuggerNotReady:
case EngineStarting:
case AdapterStarting:
case AdapterStarted:
case AdapterStartFailed:
case InferiorPreparing:
case InferiorPreparationFailed:
case InferiorStartFailed:
case InferiorStopFailed:
case InferiorShuttingDown:
case InferiorShutDown:
case InferiorShutdownFailed:
case AdapterShuttingDown:
case AdapterShutdownFailed:
break;
}
return false;
}
QDebug operator<<(QDebug d, DebuggerState state)