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