Commit cc775492 authored by hjk's avatar hjk

Debugger: Simplify use of DebuggerEnginePrivate members

Each engine has now the RunTool pointer, not just the master.

Change-Id: I6bab026998d5da5da82224bfaf4a93d3cfb3a898
Reviewed-by: Christian Stenger's avatarChristian Stenger <christian.stenger@qt.io>
parent ad4ec4eb
......@@ -280,9 +280,6 @@ public:
public:
DebuggerState state() const { return m_state; }
bool isMasterEngine() const { return m_engine->isMasterEngine(); }
DebuggerRunTool *runTool() const
{ return m_masterEngine ? m_masterEngine->runTool() : m_runTool.data(); }
RunControl *runControl() const;
DebuggerEngine *m_engine = nullptr; // Not owned.
DebuggerEngine *m_masterEngine = nullptr; // Not owned
......@@ -498,7 +495,7 @@ void DebuggerEngine::start()
const DebuggerRunParameters &rp = runParameters();
d->m_inferiorPid = rp.attachPID.isValid() ? rp.attachPID : ProcessHandle();
if (d->m_inferiorPid.isValid())
runControl()->setApplicationProcessHandle(d->m_inferiorPid);
d->m_runTool->runControl()->setApplicationProcessHandle(d->m_inferiorPid);
action(OperateByInstruction)->setEnabled(hasCapability(DisassemblerCapability));
......@@ -935,8 +932,8 @@ void DebuggerEnginePrivate::doShutdownEngine()
{
m_engine->setState(EngineShutdownRequested);
QTC_ASSERT(isMasterEngine(), qDebug() << m_engine; return);
QTC_ASSERT(runTool(), return);
runTool()->startDying();
QTC_ASSERT(m_runTool, return);
m_runTool->startDying();
m_engine->showMessage("CALL: SHUTDOWN ENGINE");
m_engine->shutdownEngine();
}
......@@ -957,12 +954,6 @@ void DebuggerEngine::notifyEngineShutdownFailed()
d->doFinishDebugger();
}
RunControl *DebuggerEnginePrivate::runControl() const
{
DebuggerRunTool *tool = runTool();
return tool ? tool->runControl() : nullptr;
}
void DebuggerEngine::notifyEngineIll()
{
//#ifdef WITH_BENCHMARK
......@@ -1221,7 +1212,7 @@ void DebuggerEngine::notifyInferiorPid(const ProcessHandle &pid)
return;
d->m_inferiorPid = pid;
if (pid.isValid()) {
runControl()->setApplicationProcessHandle(pid);
d->m_runTool->runControl()->setApplicationProcessHandle(pid);
showMessage(tr("Taking notice of pid %1").arg(pid.pid()));
DebuggerStartMode sm = runParameters().startMode;
if (sm == StartInternal || sm == StartExternal || sm == AttachExternal)
......@@ -1297,8 +1288,8 @@ void DebuggerEngine::abortDebugger()
// We already tried. Try harder.
showMessage("ABORTING DEBUGGER. SECOND TIME.");
abortDebuggerProcess();
if (runControl())
runControl()->initiateFinish();
if (d->m_runTool && d->m_runTool->runControl())
d->m_runTool->runControl()->initiateFinish();
}
}
......@@ -1313,11 +1304,6 @@ void DebuggerEngine::progressPing()
d->m_progress.setProgressValue(progress);
}
RunControl *DebuggerEngine::runControl() const
{
return d->runControl();
}
DebuggerRunTool *DebuggerEngine::runTool() const
{
return d->m_runTool.data();
......
......@@ -458,7 +458,6 @@ protected:
void setMasterEngine(DebuggerEngine *masterEngine);
ProjectExplorer::RunControl *runControl() const;
TerminalRunner *terminal() const;
static QString msgStopped(const QString &reason = QString());
......
......@@ -3221,8 +3221,9 @@ void GdbEngine::handleMakeSnapshot(const DebuggerResponse &response, const QStri
const StackFrame &frame = frames.at(0);
function = frame.function + ":" + QString::number(frame.line);
}
QTC_ASSERT(runControl()->runConfiguration(), return);
auto rc = new RunControl(runControl()->runConfiguration(), ProjectExplorer::Constants::DEBUG_RUN_MODE);
auto runConfig = runTool()->runControl()->runConfiguration();
QTC_ASSERT(runConfig, return);
auto rc = new RunControl(runConfig, ProjectExplorer::Constants::DEBUG_RUN_MODE);
auto debugger = new DebuggerRunTool(rc);
debugger->setStartMode(AttachCore);
debugger->setRunControlName(function + ": " + QDateTime::currentDateTime().toString());
......
......@@ -334,7 +334,7 @@ void QmlEngine::handleLauncherStarted()
{
// FIXME: The QmlEngine never calls notifyInferiorPid() triggering the
// raising, so do it here manually for now.
runControl()->applicationProcessHandle().activate();
runTool()->runControl()->applicationProcessHandle().activate();
tryToConnect();
}
......
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