Commit 753a28ed authored by hjk's avatar hjk
Browse files

debugger: make debugger restartable using the buttons in the application output pane

parent 62060ce7
......@@ -685,8 +685,6 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl)
d->m_runControl = runControl;
QTC_ASSERT(state() == DebuggerNotReady, qDebug() << state());
d->m_inferiorPid = d->m_startParameters.attachPID > 0
? d->m_startParameters.attachPID : 0;
......@@ -700,7 +698,10 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl)
theDebuggerAction(OperateByInstruction)
->setEnabled(engineCapabilities & DisassemblerCapability);
QTC_ASSERT(state() == DebuggerNotReady || state() == DebuggerFinished,
qDebug() << state());
setState(EngineSetupRequested);
setupEngine();
}
......@@ -869,9 +870,16 @@ void DebuggerEngine::addToWatchWindow()
watchHandler()->watchExpression(exp);
}
// Called from RunControl.
void DebuggerEngine::handleStartFailed()
{
d->m_runControl = 0;
}
// Called from RunControl.
void DebuggerEngine::handleFinished()
{
d->m_runControl = 0;
modulesHandler()->removeAll();
stackHandler()->removeAll();
threadsHandler()->removeAll();
......@@ -983,7 +991,7 @@ static bool isAllowedTransition(DebuggerState from, DebuggerState to)
case EngineSetupRequested:
return to == EngineSetupOk || to == EngineSetupFailed;
case EngineSetupFailed:
// FIXME: In therory it's the engine's task to go into a
// FIXME: In therory it's the engine's task to go into a
// proper "Shutdown" state before calling notifyEngineSetupFailed
//return to == DebuggerFinished;
return to == EngineShutdownRequested;
......@@ -1034,7 +1042,7 @@ static bool isAllowedTransition(DebuggerState from, DebuggerState to)
return to == DebuggerFinished;
case DebuggerFinished:
return false;
return to == EngineSetupRequested; // Happens on restart.
}
qDebug() << "UNKNOWN STATE:" << from;
......@@ -1046,7 +1054,9 @@ void DebuggerEngine::notifyEngineSetupFailed()
showMessage(_("NOTE: ENGINE SETUP FAILED"));
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
setState(EngineSetupFailed);
d->m_runControl->startFailed();
QTC_ASSERT(d->m_runControl, /**/);
if (d->m_runControl)
d->m_runControl->startFailed();
d->queueShutdownEngine();
}
......@@ -1055,7 +1065,9 @@ void DebuggerEngine::notifyEngineSetupOk()
showMessage(_("NOTE: ENGINE SETUP OK"));
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
setState(EngineSetupOk);
d->m_runControl->startSuccessful();
QTC_ASSERT(d->m_runControl, /**/);
if (d->m_runControl)
d->m_runControl->startSuccessful();
showMessage(_("QUEUE: SETUP INFERIOR"));
QTimer::singleShot(0, d, SLOT(doSetupInferior()));
}
......
......@@ -213,6 +213,7 @@ public:
QAbstractItemModel *sourceFilesModel() const;
void handleFinished();
void handleStartFailed();
bool debuggerActionsEnabled() const;
static bool debuggerActionsEnabled(DebuggerState state);
void showModuleSymbols(const QString &moduleName, const Symbols &symbols);
......
......@@ -470,6 +470,7 @@ void DebuggerRunControl::startFailed()
{
m_running = false;
emit finished();
engine()->handleStartFailed();
}
void DebuggerRunControl::handleStarted()
......
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