forked from qt-creator/qt-creator
Fixes: debugger: simplify state logic
This commit is contained in:
@@ -107,7 +107,7 @@ STDMETHODIMP MSVCDebugEventCallback::CreateProcess(
|
||||
{
|
||||
m_pEngine->m_hDebuggeeProcess = (HANDLE)Handle;
|
||||
m_pEngine->m_hDebuggeeThread = (HANDLE)InitialThreadHandle;
|
||||
m_pEngine->qq->notifyStartupFinished();
|
||||
//m_pEngine->qq->notifyStartupFinished();
|
||||
m_pEngine->qq->notifyInferiorRunning();
|
||||
|
||||
ULONG currentThreadId;
|
||||
|
@@ -553,12 +553,6 @@ void DebuggerManager::showStatusMessage(const QString &msg, int timeout)
|
||||
}
|
||||
}
|
||||
|
||||
void DebuggerManager::notifyStartupFinished()
|
||||
{
|
||||
setStatus(DebuggerProcessReady);
|
||||
showStatusMessage(tr("Startup finished. Debugger ready."), -1);
|
||||
}
|
||||
|
||||
void DebuggerManager::notifyInferiorStopRequested()
|
||||
{
|
||||
setStatus(DebuggerInferiorStopRequested);
|
||||
@@ -572,12 +566,6 @@ void DebuggerManager::notifyInferiorStopped()
|
||||
showStatusMessage(tr("Stopped."), 5000);
|
||||
}
|
||||
|
||||
void DebuggerManager::notifyInferiorUpdateFinished()
|
||||
{
|
||||
setStatus(DebuggerInferiorReady);
|
||||
showStatusMessage(tr("Stopped."), 5000);
|
||||
}
|
||||
|
||||
void DebuggerManager::notifyInferiorRunningRequested()
|
||||
{
|
||||
setStatus(DebuggerInferiorRunningRequested);
|
||||
@@ -592,7 +580,7 @@ void DebuggerManager::notifyInferiorRunning()
|
||||
|
||||
void DebuggerManager::notifyInferiorExited()
|
||||
{
|
||||
setStatus(DebuggerProcessReady);
|
||||
setStatus(DebuggerProcessNotReady);
|
||||
showStatusMessage(tr("Stopped."), 5000);
|
||||
}
|
||||
|
||||
@@ -679,7 +667,9 @@ void DebuggerManager::toggleBreakpoint(const QString &fileName, int lineNumber)
|
||||
{
|
||||
QTC_ASSERT(m_engine, return);
|
||||
QTC_ASSERT(m_breakHandler, return);
|
||||
if (status() != DebuggerInferiorRunning && status() != DebuggerInferiorStopped) {
|
||||
if (status() != DebuggerInferiorRunning
|
||||
&& status() != DebuggerInferiorStopped
|
||||
&& status() != DebuggerProcessNotReady) {
|
||||
showStatusMessage(tr("Changing breakpoint state requires either a "
|
||||
"fully running or fully stopped application."));
|
||||
return;
|
||||
@@ -842,11 +832,13 @@ bool DebuggerManager::startNewDebugger(StartMode mode)
|
||||
else
|
||||
setDebuggerType(GdbDebugger);
|
||||
|
||||
if (!m_engine->startDebugger())
|
||||
setStatus(DebuggerProcessStartingUp);
|
||||
if (!m_engine->startDebugger()) {
|
||||
setStatus(DebuggerProcessNotReady);
|
||||
return false;
|
||||
}
|
||||
|
||||
m_busy = false;
|
||||
setStatus(DebuggerProcessStartingUp);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1049,16 +1041,11 @@ void DebuggerManager::setStatus(int status)
|
||||
const bool started = status == DebuggerInferiorRunning
|
||||
|| status == DebuggerInferiorRunningRequested
|
||||
|| status == DebuggerInferiorStopRequested
|
||||
|| status == DebuggerInferiorStopped
|
||||
|| status == DebuggerInferiorUpdating
|
||||
|| status == DebuggerInferiorUpdateFinishing
|
||||
|| status == DebuggerInferiorReady;
|
||||
|| status == DebuggerInferiorStopped;
|
||||
|
||||
const bool starting = status == DebuggerProcessStartingUp;
|
||||
const bool running = status == DebuggerInferiorRunning;
|
||||
const bool ready = status == DebuggerInferiorStopped
|
||||
|| status == DebuggerInferiorReady
|
||||
|| status == DebuggerProcessReady;
|
||||
const bool ready = status == DebuggerInferiorStopped;
|
||||
|
||||
m_startExternalAction->setEnabled(!started && !starting);
|
||||
m_attachExternalAction->setEnabled(!started && !starting);
|
||||
|
@@ -77,23 +77,15 @@ class BreakpointData;
|
||||
// DebuggerProcessNotReady
|
||||
// |
|
||||
// DebuggerProcessStartingUp
|
||||
// |
|
||||
// DebuggerReady [R] [N]
|
||||
// | <-------------------------------------.
|
||||
// DebuggerInferiorRunningRequested |
|
||||
// | |
|
||||
// DebuggerInferiorRunning |
|
||||
// | |
|
||||
// | |
|
||||
// DebuggerInferiorRunning |
|
||||
// | |
|
||||
// DebuggerInferiorStopRequested |
|
||||
// | |
|
||||
// DebuggerInferiorStopped |
|
||||
// | |
|
||||
// DebuggerInferiorUpdating |
|
||||
// | |
|
||||
// DebuggerInferiorUpdateFinishing |
|
||||
// | |
|
||||
// DebuggerInferiorReady [C] [N] |
|
||||
// | |
|
||||
// `---------------------------------------'
|
||||
//
|
||||
// Allowed actions:
|
||||
@@ -107,17 +99,11 @@ enum DebuggerStatus
|
||||
{
|
||||
DebuggerProcessNotReady, // Debugger not started
|
||||
DebuggerProcessStartingUp, // Debugger starting up
|
||||
DebuggerProcessReady, // Debugger started, Inferior not yet
|
||||
// running or already finished
|
||||
|
||||
DebuggerInferiorRunningRequested, // Debuggee requested to run
|
||||
DebuggerInferiorRunning, // Debuggee running
|
||||
DebuggerInferiorStopRequested, // Debuggee running, stop requested
|
||||
DebuggerInferiorStopped, // Debuggee stopped
|
||||
|
||||
DebuggerInferiorUpdating, // Debuggee updating data views
|
||||
DebuggerInferiorUpdateFinishing, // Debuggee updating data views aborting
|
||||
DebuggerInferiorReady,
|
||||
};
|
||||
|
||||
|
||||
@@ -151,10 +137,8 @@ private:
|
||||
friend class WinEngine;
|
||||
|
||||
// called from the engines after successful startup
|
||||
virtual void notifyStartupFinished() = 0;
|
||||
virtual void notifyInferiorStopRequested() = 0;
|
||||
virtual void notifyInferiorStopped() = 0;
|
||||
virtual void notifyInferiorUpdateFinished() = 0;
|
||||
virtual void notifyInferiorRunningRequested() = 0;
|
||||
virtual void notifyInferiorRunning() = 0;
|
||||
virtual void notifyInferiorExited() = 0;
|
||||
@@ -343,9 +327,7 @@ private:
|
||||
QString selectedPluginBreakpointsPattern() const
|
||||
{ return m_settings.m_pluginSelectedBreakpointsPattern; }
|
||||
|
||||
void notifyStartupFinished();
|
||||
void notifyInferiorStopped();
|
||||
void notifyInferiorUpdateFinished();
|
||||
void notifyInferiorRunningRequested();
|
||||
void notifyInferiorStopRequested();
|
||||
void notifyInferiorRunning();
|
||||
|
@@ -216,7 +216,6 @@ bool ScriptEngine::startDebugger()
|
||||
m_scriptContents = stream.readAll();
|
||||
scriptFile.close();
|
||||
attemptBreakpointSynchronization();
|
||||
QTimer::singleShot(0, q, SLOT(notifyStartupFinished()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user