Debugger: Move part of engine startup to preparation phase

Change-Id: I414c356cd615096ee68588b839aaf975657fb7f9
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2017-04-27 15:39:30 +02:00
parent 009865f8b3
commit e213585910
6 changed files with 41 additions and 40 deletions

View File

@@ -107,13 +107,18 @@ static QLatin1String engineTypeName(DebuggerEngineType et)
return QLatin1String("No engine");
}
void DebuggerRunTool::start()
void DebuggerRunTool::prepare()
{
Debugger::Internal::saveModeToRestore();
Debugger::selectPerspective(Debugger::Constants::CppPerspectiveId);
TaskHub::clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_DEBUGINFO);
TaskHub::clearTasks(Debugger::Constants::TASK_CATEGORY_DEBUGGER_RUNTIME);
m_engine->prepare();
}
void DebuggerRunTool::start()
{
DebuggerEngine *engine = m_engine;
QTC_ASSERT(engine, return);
const DebuggerRunParameters &rp = engine->runParameters();
@@ -152,16 +157,8 @@ void DebuggerRunTool::start()
}
}
Internal::runControlStarted(engine);
// We might get a synchronous startFailed() notification on Windows,
// when launching the process fails. Emit a proper finished() sequence.
runControl()->reportApplicationStart();
engine->startDebugger();
if (runControl()->isRunning())
appendMessage(tr("Debugging starts") + QLatin1Char('\n'), NormalMessageFormat);
appendMessage(tr("Debugging starts") + QLatin1Char('\n'), NormalMessageFormat);
engine->start();
}
void DebuggerRunTool::startFailed()
@@ -512,12 +509,6 @@ DebuggerRunTool::DebuggerRunTool(RunControl *runControl, const DebuggerRunParame
connect(runControl, &RunControl::finished,
this, &DebuggerRunTool::handleFinished);
connect(m_engine, &DebuggerEngine::requestRemoteSetup,
this, &DebuggerRunTool::requestRemoteSetup);
connect(m_engine, &DebuggerEngine::stateChanged,
this, &DebuggerRunTool::stateChanged);
connect(m_engine, &DebuggerEngine::aboutToNotifyInferiorSetupOk,
this, &DebuggerRunTool::aboutToNotifyInferiorSetupOk);
}
DebuggerRunTool::~DebuggerRunTool()