Commit 2385e15b authored by hjk's avatar hjk

debugger: merge 'AdapterStarting' into 'EngineStarting' state

parent 76e85abf
......@@ -80,10 +80,9 @@ enum DebuggerState
DebuggerNotReady, // Debugger not started
EngineStarting, // Engine starts
AdapterStarting,
EngineStarted,
EngineStartFailed,
InferiorUnrunnable, // Used in the core dump adapter
InferiorStarting,
// InferiorStarted, // Use InferiorRunningRequested or InferiorStopped
......
......@@ -144,7 +144,6 @@ const char *DebuggerEngine::stateName(int s)
switch (s) {
SN(DebuggerNotReady)
SN(EngineStarting)
SN(AdapterStarting)
SN(EngineStarted)
SN(EngineStartFailed)
SN(InferiorStarting)
......@@ -909,9 +908,6 @@ static bool isAllowedTransition(int from, int to)
return to == EngineStarting || to == DebuggerNotReady;
case EngineStarting:
return to == AdapterStarting || to == DebuggerNotReady;
case AdapterStarting:
return to == EngineStarted || to == EngineStartFailed;
case EngineStarted:
return to == InferiorStarting || to == EngineShuttingDown;
......@@ -996,7 +992,6 @@ bool DebuggerEngine::debuggerActionsEnabled(DebuggerState state)
return true;
case DebuggerNotReady:
case EngineStarting:
case AdapterStarting:
case EngineStarted:
case EngineStartFailed:
case InferiorStartFailed:
......
......@@ -57,7 +57,6 @@ AttachGdbAdapter::AttachGdbAdapter(GdbEngine *engine, QObject *parent)
void AttachGdbAdapter::startAdapter()
{
QTC_ASSERT(state() == EngineStarting, qDebug() << state());
setState(AdapterStarting);
showMessage(_("TRYING TO START ADAPTER"));
if (!m_engine->startGdb())
......
......@@ -60,7 +60,6 @@ CoreGdbAdapter::CoreGdbAdapter(GdbEngine *engine, QObject *parent)
void CoreGdbAdapter::startAdapter()
{
QTC_ASSERT(state() == EngineStarting, qDebug() << state());
setState(AdapterStarting);
showMessage(_("TRYING TO START ADAPTER"));
if (!m_engine->startGdb())
......
......@@ -122,7 +122,6 @@ QByteArray GdbEngine::tooltipIName(const QString &exp)
static bool stateAcceptsGdbCommands(DebuggerState state)
{
switch (state) {
case AdapterStarting:
case EngineStarted:
case EngineStartFailed:
case InferiorUnrunnable:
......@@ -142,7 +141,7 @@ static bool stateAcceptsGdbCommands(DebuggerState state)
case EngineStarting:
case InferiorStopFailed:
case EngineShuttingDown:
break;
return false;
}
return false;
}
......@@ -1629,13 +1628,12 @@ void GdbEngine::shutdown()
}
switch (state()) {
case DebuggerNotReady: // Nothing to do! :)
case EngineStarting: // We can't get here, really
case InferiorShuttingDown: // Will auto-trigger further shutdown steps
case EngineShuttingDown: // Do not disturb! :)
case InferiorRunningRequested_Kill:
case InferiorStopping_Kill:
break;
case AdapterStarting: // GDB is up, adapter is "doing something"
case EngineStarting: // GDB is up, adapter is "doing something"
setState(EngineStartFailed);
m_gdbAdapter->shutdown();
// fall-through
......@@ -3085,7 +3083,6 @@ void GdbEngine::activateSnapshot2()
// Otherwise the stack data might be stale.
// See http://sourceware.org/bugzilla/show_bug.cgi?id=1124.
setState(EngineStarting);
setState(AdapterStarting);
postCommand("set stack-cache off");
handleAdapterStarted();
}
......
......@@ -69,7 +69,6 @@ AbstractGdbAdapter::DumperHandling LocalPlainGdbAdapter::dumperHandling() const
void LocalPlainGdbAdapter::startAdapter()
{
QTC_ASSERT(state() == EngineStarting, qDebug() << state());
setState(AdapterStarting);
showMessage(_("TRYING TO START ADAPTER"));
QStringList gdbArgs;
......
......@@ -85,7 +85,6 @@ AbstractGdbAdapter::DumperHandling RemoteGdbServerAdapter::dumperHandling() cons
void RemoteGdbServerAdapter::startAdapter()
{
QTC_ASSERT(state() == EngineStarting, qDebug() << state());
setState(AdapterStarting);
showMessage(_("TRYING TO START ADAPTER"));
// FIXME: make asynchroneous
......
......@@ -47,7 +47,6 @@ RemotePlainGdbAdapter::RemotePlainGdbAdapter(GdbEngine *engine,
void RemotePlainGdbAdapter::startAdapter()
{
QTC_ASSERT(state() == EngineStarting, qDebug() << state());
setState(AdapterStarting);
showMessage(QLatin1String("TRYING TO START ADAPTER"));
if (!startParameters().workingDirectory.isEmpty())
......
......@@ -330,7 +330,7 @@ void TcfTrkGdbAdapter::startGdb()
void TcfTrkGdbAdapter::tcftrkDeviceError(const QString &errorString)
{
logMessage(errorString);
if (state() == AdapterStarting) {
if (state() == EngineStarting) {
emit adapterStartFailed(errorString, QString());
} else {
emit adapterCrashed(errorString);
......@@ -949,7 +949,6 @@ void TcfTrkGdbAdapter::startAdapter()
m_symbolFile.replace(QLatin1Char('\\'), QLatin1Char('/'));
// Start
QTC_ASSERT(state() == EngineStarting, qDebug() << state());
setState(AdapterStarting);
showMessage(_("TRYING TO START ADAPTER"));
logMessage(QLatin1String("### Starting TcfTrkGdbAdapter"));
......
......@@ -82,7 +82,6 @@ AbstractGdbAdapter::DumperHandling TermGdbAdapter::dumperHandling() const
void TermGdbAdapter::startAdapter()
{
QTC_ASSERT(state() == EngineStarting, qDebug() << state());
setState(AdapterStarting);
showMessage(_("TRYING TO START ADAPTER"));
// Currently, adapters are not re-used
......@@ -112,7 +111,7 @@ void TermGdbAdapter::startAdapter()
void TermGdbAdapter::handleInferiorStarted()
{
QTC_ASSERT(state() == AdapterStarting, qDebug() << state());
QTC_ASSERT(state() == EngineStarting, qDebug() << state());
emit adapterStarted();
}
......@@ -173,7 +172,7 @@ void TermGdbAdapter::stubMessage(const QString &msg, bool)
void TermGdbAdapter::stubExited()
{
showMessage(_("STUB EXITED"));
if (state() != AdapterStarting // From previous instance
if (state() != EngineStarting // From previous instance
&& state() != EngineShuttingDown && state() != DebuggerNotReady)
emit adapterCrashed(QString());
}
......
......@@ -1502,7 +1502,6 @@ void TrkGdbAdapter::startAdapter()
m_symbolFile.replace(QLatin1Char('\\'), QLatin1Char('/'));
// Start
QTC_ASSERT(state() == EngineStarting, qDebug() << state());
setState(AdapterStarting);
showMessage(_("TRYING TO START ADAPTER"));
logMessage(QLatin1String("### Starting TrkGdbAdapter"));
......
......@@ -141,7 +141,6 @@ void PdbEngine::exitDebugger()
void PdbEngine::startDebugger()
{
setState(EngineStarting);
setState(AdapterStarting);
m_scriptFileName = QFileInfo(startParameters().executable).absoluteFilePath();
QFile scriptFile(m_scriptFileName);
......
......@@ -249,7 +249,6 @@ void QmlEngine::startDebugger()
connect(&m_proc, SIGNAL(readyReadStandardError()),
SLOT(readProcStandardError()));
setState(AdapterStarting);
m_proc.setEnvironment(env.toStringList());
m_proc.setWorkingDirectory(sp.workingDirectory);
m_proc.start(sp.executable, sp.processArgs);
......
......@@ -234,7 +234,6 @@ void ScriptEngine::startDebugger()
showMessage(_("STARTING SCRIPT DEBUGGER"), LogMisc);
QTC_ASSERT(state() == DebuggerNotReady, setState(DebuggerNotReady));
setState(EngineStarting);
setState(AdapterStarting);
if (m_scriptEngine.isNull())
m_scriptEngine = Core::ICore::instance()->scriptManager()->scriptEngine();
if (!m_scriptAgent)
......
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