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