Debugger: Drop base DebuggerEngine::runEngine()

The lines between engine setup and running have always been
blurry, so it looks more and more unnatural to enforce this
in the architecture. Remove the runEngine() call from the
end of notifySetupEngineOk, and do it on the user side.

Change-Id: I3a5e158e8b3fe9b0a288d064f798e24b2ac47f86
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
hjk
2020-12-18 17:58:05 +01:00
parent 16421d08d3
commit b0d2c0d45d
14 changed files with 34 additions and 36 deletions

View File

@@ -530,6 +530,7 @@ void CdbEngine::handleInitialSessionIdle()
if (response.resultClass == ResultDone || runParameters().startMode == AttachCore) { if (response.resultClass == ResultDone || runParameters().startMode == AttachCore) {
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyEngineSetupOk") STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyEngineSetupOk")
notifyEngineSetupOk(); notifyEngineSetupOk();
runEngine();
} else { } else {
showMessage(QString("Failed to determine inferior pid: %1"). showMessage(QString("Failed to determine inferior pid: %1").
arg(response.data["msg"].data()), LogError); arg(response.data["msg"].data()), LogError);

View File

@@ -53,7 +53,7 @@ public:
bool canHandleToolTip(const DebuggerToolTipContext &context) const override; bool canHandleToolTip(const DebuggerToolTipContext &context) const override;
void setupEngine() override; void setupEngine() override;
void runEngine() override; void runEngine();
void shutdownInferior() override; void shutdownInferior() override;
void shutdownEngine() override; void shutdownEngine() override;
void abortDebuggerProcess() override; void abortDebuggerProcess() override;

View File

@@ -1257,7 +1257,6 @@ void DebuggerEngine::notifyEngineSetupOk()
setState(EngineRunRequested); setState(EngineRunRequested);
showMessage("CALL: RUN ENGINE"); showMessage("CALL: RUN ENGINE");
d->m_progress.setProgressValue(300); d->m_progress.setProgressValue(300);
runEngine();
} }
void DebuggerEngine::notifyEngineRunOkAndInferiorUnrunnable() void DebuggerEngine::notifyEngineRunOkAndInferiorUnrunnable()

View File

@@ -508,7 +508,6 @@ protected:
void notifyEngineIll(); void notifyEngineIll();
virtual void setupEngine() = 0; virtual void setupEngine() = 0;
virtual void runEngine() = 0;
virtual void shutdownInferior() = 0; virtual void shutdownInferior() = 0;
virtual void shutdownEngine() = 0; virtual void shutdownEngine() = 0;
virtual void resetInferior() {} virtual void resetInferior() {}

View File

@@ -3916,6 +3916,7 @@ void GdbEngine::finishInferiorSetup()
// and even if it fails (e.g. due to stripped binaries), continuing with // and even if it fails (e.g. due to stripped binaries), continuing with
// the start up is the best we can do. // the start up is the best we can do.
notifyEngineSetupOk(); notifyEngineSetupOk();
runEngine();
} }
void GdbEngine::handleDebugInfoLocation(const DebuggerResponse &response) void GdbEngine::handleDebugInfoLocation(const DebuggerResponse &response)
@@ -4091,6 +4092,7 @@ void GdbEngine::setupInferior()
if (rp.startMode == AttachToRemoteProcess) { if (rp.startMode == AttachToRemoteProcess) {
notifyEngineSetupOk(); notifyEngineSetupOk();
runEngine();
} else if (isAttachEngine()) { } else if (isAttachEngine()) {
// Task 254674 does not want to remove them // Task 254674 does not want to remove them

View File

@@ -392,7 +392,7 @@ private: ////////// General Interface //////////
bool isTermEngine() const; bool isTermEngine() const;
void setupEngine() final; void setupEngine() final;
void runEngine() final; void runEngine();
void shutdownEngine() final; void shutdownEngine() final;
void interruptInferior2(); void interruptInferior2();

View File

@@ -324,7 +324,10 @@ void LldbEngine::setupEngine()
// Some extra roundtrip to make sure we end up behind all commands triggered // Some extra roundtrip to make sure we end up behind all commands triggered
// from claimBreakpointsForEngine(). // from claimBreakpointsForEngine().
DebuggerCommand cmd3("executeRoundtrip"); DebuggerCommand cmd3("executeRoundtrip");
cmd3.callback = [this](const DebuggerResponse &) { notifyEngineSetupOk(); }; cmd3.callback = [this](const DebuggerResponse &) {
notifyEngineSetupOk();
runEngine();
};
runCommand(cmd3); runCommand(cmd3);
} else { } else {
notifyEngineSetupFailed(); notifyEngineSetupFailed();

View File

@@ -65,7 +65,7 @@ private:
void executeStepOver(bool byInstruction) override; void executeStepOver(bool byInstruction) override;
void setupEngine() override; void setupEngine() override;
void runEngine() override; void runEngine();
void shutdownInferior() override; void shutdownInferior() override;
void shutdownEngine() override; void shutdownEngine() override;
void abortDebuggerProcess() override; void abortDebuggerProcess() override;

View File

@@ -149,12 +149,10 @@ void PdbEngine::setupEngine()
notifyEngineSetupFailed(); notifyEngineSetupFailed();
return; return;
} }
notifyEngineSetupOk();
}
void PdbEngine::runEngine() notifyEngineSetupOk();
{
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state()); QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
showStatusMessage(tr("Running requested..."), 5000); showStatusMessage(tr("Running requested..."), 5000);
BreakpointManager::claimBreakpointsForEngine(this); BreakpointManager::claimBreakpointsForEngine(this);
notifyEngineRunAndInferiorStopOk(); notifyEngineRunAndInferiorStopOk();

View File

@@ -52,7 +52,6 @@ private:
void executeStepOver(bool) override; void executeStepOver(bool) override;
void setupEngine() override; void setupEngine() override;
void runEngine() override;
void shutdownInferior() override; void shutdownInferior() override;
void shutdownEngine() override; void shutdownEngine() override;

View File

@@ -501,29 +501,6 @@ void QmlEngine::closeConnection()
} }
} }
void QmlEngine::runEngine()
{
// we won't get any debug output
if (!terminal()) {
d->retryOnConnectFail = true;
d->automaticConnect = true;
}
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
if (isPrimaryEngine()) {
// QML only.
if (runParameters().startMode == AttachToRemoteServer)
tryToConnect();
else if (runParameters().startMode == AttachToRemoteProcess)
beginConnection();
else
startApplicationLauncher();
} else {
tryToConnect();
}
}
void QmlEngine::startApplicationLauncher() void QmlEngine::startApplicationLauncher()
{ {
if (!d->applicationLauncher.isRunning()) { if (!d->applicationLauncher.isRunning()) {
@@ -576,6 +553,26 @@ void QmlEngine::setupEngine()
{ {
notifyEngineSetupOk(); notifyEngineSetupOk();
// we won't get any debug output
if (!terminal()) {
d->retryOnConnectFail = true;
d->automaticConnect = true;
}
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
if (isPrimaryEngine()) {
// QML only.
if (runParameters().startMode == AttachToRemoteServer)
tryToConnect();
else if (runParameters().startMode == AttachToRemoteProcess)
beginConnection();
else
startApplicationLauncher();
} else {
tryToConnect();
}
if (d->automaticConnect) if (d->automaticConnect)
beginConnection(); beginConnection();
} }

View File

@@ -78,7 +78,6 @@ private:
void executeStepOut() override; void executeStepOut() override;
void setupEngine() override; void setupEngine() override;
void runEngine() override;
void shutdownInferior() override; void shutdownInferior() override;
void shutdownEngine() override; void shutdownEngine() override;

View File

@@ -633,6 +633,7 @@ void UvscEngine::handleProjectClosed()
showMessage("UVSC: ALL INITIALIZED SUCCESSFULLY."); showMessage("UVSC: ALL INITIALIZED SUCCESSFULLY.");
notifyEngineSetupOk(); notifyEngineSetupOk();
runEngine();
} }
void UvscEngine::handleUpdateLocation(quint64 address) void UvscEngine::handleUpdateLocation(quint64 address)

View File

@@ -40,7 +40,7 @@ public:
explicit UvscEngine(); explicit UvscEngine();
void setupEngine() final; void setupEngine() final;
void runEngine() final; void runEngine();
void shutdownInferior() final; void shutdownInferior() final;
void shutdownEngine() final; void shutdownEngine() final;