Skip to content
Snippets Groups Projects
Commit 753a28ed authored by hjk's avatar hjk
Browse files

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

parent 62060ce7
No related branches found
No related tags found
No related merge requests found
...@@ -685,8 +685,6 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl) ...@@ -685,8 +685,6 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl)
d->m_runControl = runControl; d->m_runControl = runControl;
QTC_ASSERT(state() == DebuggerNotReady, qDebug() << state());
d->m_inferiorPid = d->m_startParameters.attachPID > 0 d->m_inferiorPid = d->m_startParameters.attachPID > 0
? d->m_startParameters.attachPID : 0; ? d->m_startParameters.attachPID : 0;
...@@ -700,7 +698,10 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl) ...@@ -700,7 +698,10 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl)
theDebuggerAction(OperateByInstruction) theDebuggerAction(OperateByInstruction)
->setEnabled(engineCapabilities & DisassemblerCapability); ->setEnabled(engineCapabilities & DisassemblerCapability);
QTC_ASSERT(state() == DebuggerNotReady || state() == DebuggerFinished,
qDebug() << state());
setState(EngineSetupRequested); setState(EngineSetupRequested);
setupEngine(); setupEngine();
} }
...@@ -869,9 +870,16 @@ void DebuggerEngine::addToWatchWindow() ...@@ -869,9 +870,16 @@ void DebuggerEngine::addToWatchWindow()
watchHandler()->watchExpression(exp); watchHandler()->watchExpression(exp);
} }
// Called from RunControl.
void DebuggerEngine::handleStartFailed()
{
d->m_runControl = 0;
}
// Called from RunControl. // Called from RunControl.
void DebuggerEngine::handleFinished() void DebuggerEngine::handleFinished()
{ {
d->m_runControl = 0;
modulesHandler()->removeAll(); modulesHandler()->removeAll();
stackHandler()->removeAll(); stackHandler()->removeAll();
threadsHandler()->removeAll(); threadsHandler()->removeAll();
...@@ -983,7 +991,7 @@ static bool isAllowedTransition(DebuggerState from, DebuggerState to) ...@@ -983,7 +991,7 @@ static bool isAllowedTransition(DebuggerState from, DebuggerState to)
case EngineSetupRequested: case EngineSetupRequested:
return to == EngineSetupOk || to == EngineSetupFailed; return to == EngineSetupOk || to == EngineSetupFailed;
case 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 // proper "Shutdown" state before calling notifyEngineSetupFailed
//return to == DebuggerFinished; //return to == DebuggerFinished;
return to == EngineShutdownRequested; return to == EngineShutdownRequested;
...@@ -1034,7 +1042,7 @@ static bool isAllowedTransition(DebuggerState from, DebuggerState to) ...@@ -1034,7 +1042,7 @@ static bool isAllowedTransition(DebuggerState from, DebuggerState to)
return to == DebuggerFinished; return to == DebuggerFinished;
case DebuggerFinished: case DebuggerFinished:
return false; return to == EngineSetupRequested; // Happens on restart.
} }
qDebug() << "UNKNOWN STATE:" << from; qDebug() << "UNKNOWN STATE:" << from;
...@@ -1046,7 +1054,9 @@ void DebuggerEngine::notifyEngineSetupFailed() ...@@ -1046,7 +1054,9 @@ void DebuggerEngine::notifyEngineSetupFailed()
showMessage(_("NOTE: ENGINE SETUP FAILED")); showMessage(_("NOTE: ENGINE SETUP FAILED"));
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state()); QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
setState(EngineSetupFailed); setState(EngineSetupFailed);
d->m_runControl->startFailed(); QTC_ASSERT(d->m_runControl, /**/);
if (d->m_runControl)
d->m_runControl->startFailed();
d->queueShutdownEngine(); d->queueShutdownEngine();
} }
...@@ -1055,7 +1065,9 @@ void DebuggerEngine::notifyEngineSetupOk() ...@@ -1055,7 +1065,9 @@ void DebuggerEngine::notifyEngineSetupOk()
showMessage(_("NOTE: ENGINE SETUP OK")); showMessage(_("NOTE: ENGINE SETUP OK"));
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state()); QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
setState(EngineSetupOk); setState(EngineSetupOk);
d->m_runControl->startSuccessful(); QTC_ASSERT(d->m_runControl, /**/);
if (d->m_runControl)
d->m_runControl->startSuccessful();
showMessage(_("QUEUE: SETUP INFERIOR")); showMessage(_("QUEUE: SETUP INFERIOR"));
QTimer::singleShot(0, d, SLOT(doSetupInferior())); QTimer::singleShot(0, d, SLOT(doSetupInferior()));
} }
......
...@@ -213,6 +213,7 @@ public: ...@@ -213,6 +213,7 @@ public:
QAbstractItemModel *sourceFilesModel() const; QAbstractItemModel *sourceFilesModel() const;
void handleFinished(); void handleFinished();
void handleStartFailed();
bool debuggerActionsEnabled() const; bool debuggerActionsEnabled() const;
static bool debuggerActionsEnabled(DebuggerState state); static bool debuggerActionsEnabled(DebuggerState state);
void showModuleSymbols(const QString &moduleName, const Symbols &symbols); void showModuleSymbols(const QString &moduleName, const Symbols &symbols);
......
...@@ -470,6 +470,7 @@ void DebuggerRunControl::startFailed() ...@@ -470,6 +470,7 @@ void DebuggerRunControl::startFailed()
{ {
m_running = false; m_running = false;
emit finished(); emit finished();
engine()->handleStartFailed();
} }
void DebuggerRunControl::handleStarted() void DebuggerRunControl::handleStarted()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment