debugger: refactor startup logic

This commit is contained in:
hjk
2010-07-08 18:10:50 +02:00
parent f2c7d33fa6
commit 9e7a456457
32 changed files with 341 additions and 239 deletions

View File

@@ -68,9 +68,9 @@ void CoreGdbAdapter::startAdapter()
m_engine->handleAdapterStarted();
}
void CoreGdbAdapter::startInferior()
void CoreGdbAdapter::setupInferior()
{
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
QTC_ASSERT(state() == InferiorSettingUp, qDebug() << state());
m_executable = startParameters().executable;
if (m_executable.isEmpty()) {
#ifdef EXE_FROM_CORE
@@ -103,7 +103,7 @@ void CoreGdbAdapter::loadExeAndSyms()
void CoreGdbAdapter::handleFileExecAndSymbols(const GdbResponse &response)
{
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
QTC_ASSERT(state() == InferiorSettingUp, qDebug() << state());
if (response.resultClass == GdbResultDone) {
showMessage(tr("Symbols found."), StatusBar);
} else {
@@ -124,7 +124,7 @@ void CoreGdbAdapter::loadCoreFile()
void CoreGdbAdapter::handleTargetCore(const GdbResponse &response)
{
QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
QTC_ASSERT(state() == InferiorSettingUp, qDebug() << state());
if (response.resultClass == GdbResultDone) {
#ifdef EXE_FROM_CORE
if (m_round == 1) {
@@ -156,15 +156,21 @@ void CoreGdbAdapter::handleTargetCore(const GdbResponse &response)
}
#endif
showMessage(tr("Attached to core."), StatusBar);
setState(InferiorUnrunnable);
m_engine->updateAll();
m_engine->handleInferiorPrepared();
} else {
QString msg = tr("Attach to core \"%1\" failed:\n").arg(startParameters().coreFile)
+ QString::fromLocal8Bit(response.data.findChild("msg").data());
m_engine->handleInferiorStartFailed(msg);
m_engine->handleInferiorSetupFailed(msg);
}
}
void CoreGdbAdapter::runAdapter()
{
QTC_ASSERT(state() == InferiorSetupOk, qDebug() << state());
setState(InferiorUnrunnable);
m_engine->updateAll();
}
void CoreGdbAdapter::interruptInferior()
{
// A core should never 'run'