Debugger: Centralize abort handling

... and apply even more force on the second trying by forcing
ramp down of the runControl itself instead of hoping that it
would pick up hints.

Change-Id: I9d0f4130cb9a137b91c9fa81c3d255f236f98be0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2017-09-19 12:31:19 +02:00
parent ed2ae5fa81
commit 526e217ce9
10 changed files with 27 additions and 39 deletions

View File

@@ -840,17 +840,9 @@ void CdbEngine::shutdownEngine()
}
}
void CdbEngine::abortDebugger()
void CdbEngine::abortDebuggerProcess()
{
if (isDying()) {
// We already tried. Try harder.
showMessage("ABORTING DEBUGGER. SECOND TIME.");
m_process.kill();
} else {
// Be friendly the first time. This will change targetState().
showMessage("ABORTING DEBUGGER. FIRST TIME.");
quitDebugger();
}
}
void CdbEngine::processFinished()

View File

@@ -70,7 +70,7 @@ public:
void runEngine() override;
void shutdownInferior() override;
void shutdownEngine() override;
void abortDebugger() override;
void abortDebuggerProcess() override;
void detachDebugger() override;
bool hasCapability(unsigned cap) const override;
void watchPoint(const QPoint &) override;

View File

@@ -1353,8 +1353,17 @@ void DebuggerEngine::quitDebugger()
void DebuggerEngine::abortDebugger()
{
// Overridden in e.g. GdbEngine.
if (!isDying()) {
// Be friendly the first time. This will change targetState().
showMessage("ABORTING DEBUGGER. FIRST TIME.");
quitDebugger();
} else {
// We already tried. Try harder.
showMessage("ABORTING DEBUGGER. SECOND TIME.");
abortDebuggerProcess();
if (runControl())
runControl()->initiateFinish();
}
}
void DebuggerEngine::requestInterruptInferior()

View File

@@ -360,7 +360,8 @@ public:
virtual void resetLocation();
virtual void gotoLocation(const Internal::Location &location);
virtual void quitDebugger(); // called when pressing the stop button
virtual void abortDebugger(); // called from the debug menu action
void abortDebugger(); // called from the debug menu action
void updateViews();
bool isSlaveEngine() const;
@@ -450,6 +451,8 @@ protected:
virtual void frameUp();
virtual void frameDown();
virtual void abortDebuggerProcess() {} // second attempt
virtual void doUpdateLocals(const UpdateParameters &params);
void setMasterEngine(DebuggerEngine *masterEngine);

View File

@@ -4062,17 +4062,9 @@ void GdbEngine::handleGdbFinished(int exitCode, QProcess::ExitStatus exitStatus)
notifyDebuggerProcessFinished(exitCode, exitStatus, "GDB");
}
void GdbEngine::abortDebugger()
void GdbEngine::abortDebuggerProcess()
{
if (isDying()) {
// We already tried. Try harder.
showMessage("ABORTING DEBUGGER. SECOND TIME.");
m_gdbProc.kill();
} else {
// Be friendly the first time. This will change targetState().
showMessage("ABORTING DEBUGGER. FIRST TIME.");
quitDebugger();
}
}
void GdbEngine::resetInferior()

View File

@@ -83,7 +83,7 @@ private: ////////// General Interface //////////
bool hasCapability(unsigned) const final;
void detachDebugger() final;
void shutdownInferior() final;
void abortDebugger() final;
void abortDebuggerProcess() final;
void resetInferior() final;
bool acceptsDebuggerCommands() const final;

View File

@@ -160,17 +160,9 @@ void LldbEngine::shutdownEngine()
notifyEngineShutdownOk();
}
void LldbEngine::abortDebugger()
void LldbEngine::abortDebuggerProcess()
{
if (isDying()) {
// We already tried. Try harder.
showMessage("ABORTING DEBUGGER. SECOND TIME.");
m_lldbProc.kill();
} else {
// Be friendly the first time. This will change targetState().
showMessage("ABORTING DEBUGGER. FIRST TIME.");
quitDebugger();
}
}
void LldbEngine::setupEngine()

View File

@@ -78,7 +78,7 @@ private:
void runEngine() override;
void shutdownInferior() override;
void shutdownEngine() override;
void abortDebugger() override;
void abortDebuggerProcess() override;
bool canHandleToolTip(const DebuggerToolTipContext &) const override;

View File

@@ -410,10 +410,10 @@ void QmlCppEngine::quitDebugger()
m_cppEngine->quitDebugger();
}
void QmlCppEngine::abortDebugger()
void QmlCppEngine::abortDebuggerProcess()
{
EDEBUG("\nMASTER ABORT DEBUGGER");
m_cppEngine->abortDebugger();
m_cppEngine->abortDebuggerProcess();
}
void QmlCppEngine::setState(DebuggerState newState, bool forced)

View File

@@ -112,7 +112,7 @@ protected:
void shutdownInferior() override;
void shutdownEngine() override;
void quitDebugger() override;
void abortDebugger() override;
void abortDebuggerProcess() override;
void loadAdditionalQmlStack() override;