forked from qt-creator/qt-creator
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user