From ac2012a73a377e94b4851a1da30fdde1ccce1002 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 12 Sep 2017 10:33:59 +0200 Subject: [PATCH] Debugger: De-virtualize *Engine::notify* functions Most were never re-implemented, so just for debugging purposes in the mixed engine. Change-Id: If569e0e553e3fdd5ef83b3bdfdbd22fd0ad5b90f Reviewed-by: Christian Stenger --- src/plugins/debugger/debuggerengine.h | 49 ++++++++++++----------- src/plugins/debugger/gdb/gdbengine.cpp | 36 +++++++---------- src/plugins/debugger/gdb/gdbengine.h | 5 +-- src/plugins/debugger/qml/qmlcppengine.cpp | 30 -------------- src/plugins/debugger/qml/qmlcppengine.h | 6 --- 5 files changed, 41 insertions(+), 85 deletions(-) diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index 99cd156d5ab..c09cd0d217a 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -340,44 +340,45 @@ protected: // The base notify*() function implementation should be sufficient // in most cases, but engines are free to override them to do some // engine specific cleanup like stopping timers etc. - virtual void notifyEngineSetupOk(); - virtual void notifyEngineSetupFailed(); - virtual void notifyEngineRunFailed(); + void notifyEngineSetupOk(); + void notifyEngineSetupFailed(); + void notifyEngineRunFailed(); - virtual void notifyInferiorSetupOk(); - virtual void notifyInferiorSetupFailed(); + void notifyInferiorSetupOk(); + void notifyInferiorSetupFailed(); - virtual void notifyEngineRunAndInferiorRunOk(); - virtual void notifyEngineRunAndInferiorStopOk(); - virtual void notifyEngineRunOkAndInferiorUnrunnable(); // Called by CoreAdapter. + void notifyEngineRunAndInferiorRunOk(); + void notifyEngineRunAndInferiorStopOk(); + void notifyEngineRunOkAndInferiorUnrunnable(); // Called by CoreAdapter. // Use notifyInferiorRunRequested() plus notifyInferiorRunOk() instead. - //virtual void notifyInferiorSpontaneousRun(); + // void notifyInferiorSpontaneousRun(); - virtual void notifyInferiorRunRequested(); - virtual void notifyInferiorRunOk(); - virtual void notifyInferiorRunFailed(); + void notifyInferiorRunRequested(); + void notifyInferiorRunOk(); + void notifyInferiorRunFailed(); - virtual void notifyInferiorStopOk(); - virtual void notifyInferiorSpontaneousStop(); - virtual void notifyInferiorStopFailed(); + void notifyInferiorStopOk(); + void notifyInferiorSpontaneousStop(); + void notifyInferiorStopFailed(); - public: - virtual void notifyInferiorExited(); + public: // FIXME: Remove, currently needed for Android. + void notifyInferiorExited(); + + protected: void notifyDebuggerProcessFinished(int exitCode, QProcess::ExitStatus exitStatus, const QString &backendName); -protected: virtual void setState(DebuggerState state, bool forced = false); - virtual void notifyInferiorShutdownOk(); - virtual void notifyInferiorShutdownFailed(); + void notifyInferiorShutdownOk(); + void notifyInferiorShutdownFailed(); - virtual void notifyEngineSpontaneousShutdown(); - virtual void notifyEngineShutdownOk(); - virtual void notifyEngineShutdownFailed(); + void notifyEngineSpontaneousShutdown(); + void notifyEngineShutdownOk(); + void notifyEngineShutdownFailed(); - virtual void notifyEngineIll(); + void notifyEngineIll(); virtual void setupEngine() = 0; virtual void setupInferior() = 0; diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index e3c2cc3cca1..30f01469219 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -4106,14 +4106,6 @@ void GdbEngine::handleAdapterStartFailed(const QString &msg, Id settingsIdHint) notifyEngineSetupFailed(); } -void GdbEngine::notifyInferiorSetupFailed() -{ - // FIXME: that's not enough to stop gdb from getting confused - // by a timeout of the adapter. - //resetCommandQueue(); - DebuggerEngine::notifyInferiorSetupFailed(); -} - void GdbEngine::prepareForRestart() { m_rerunPending = false; @@ -4191,7 +4183,7 @@ void GdbEngine::handleDebugInfoLocation(const DebuggerResponse &response) } } -void GdbEngine::notifyInferiorSetupFailed(const QString &msg) +void GdbEngine::notifyInferiorSetupFailedHelper(const QString &msg) { showStatusMessage(tr("Failed to start application:") + ' ' + msg); if (state() == EngineSetupFailed) { @@ -4200,7 +4192,7 @@ void GdbEngine::notifyInferiorSetupFailed(const QString &msg) } showMessage("INFERIOR START FAILED"); AsynchronousMessageBox::critical(tr("Failed to start application"), msg); - DebuggerEngine::notifyInferiorSetupFailed(); + notifyInferiorSetupFailed(); } void GdbEngine::handleAdapterCrashed(const QString &msg) @@ -4633,13 +4625,13 @@ void GdbEngine::handleAttach(const DebuggerResponse &response) } case ResultError: if (response.data["msg"].data() == "ptrace: Operation not permitted.") { - notifyInferiorSetupFailed(msgPtraceError(runParameters().startMode)); + notifyInferiorSetupFailedHelper(msgPtraceError(runParameters().startMode)); break; } - notifyInferiorSetupFailed(response.data["msg"].data()); + notifyInferiorSetupFailedHelper(response.data["msg"].data()); break; default: - notifyInferiorSetupFailed(response.data["msg"].data()); + notifyInferiorSetupFailedHelper(response.data["msg"].data()); break; } @@ -4702,7 +4694,7 @@ void GdbEngine::handleFileExecAndSymbols(const DebuggerResponse &response) showMessage(msg, StatusBar); callTargetRemote(); // Proceed nevertheless. } else { - notifyInferiorSetupFailed(msg); + notifyInferiorSetupFailedHelper(msg); } } @@ -4718,7 +4710,7 @@ void GdbEngine::handleFileExecAndSymbols(const DebuggerResponse &response) "in the core file.") + ' ' + tr("Try to specify the binary using the " "Debug->Start Debugging->Attach to Core dialog."); - notifyInferiorSetupFailed(msg); + notifyInferiorSetupFailedHelper(msg); } } else if (isPlainEngine()) { @@ -4730,7 +4722,7 @@ void GdbEngine::handleFileExecAndSymbols(const DebuggerResponse &response) // Extend the message a bit in unknown cases. if (!msg.endsWith("File format not recognized")) msg = tr("Starting executable failed:") + '\n' + msg; - notifyInferiorSetupFailed(msg); + notifyInferiorSetupFailedHelper(msg); } } @@ -4817,7 +4809,7 @@ void GdbEngine::handleTargetRemote(const DebuggerResponse &response) handleInferiorPrepared(); } else { // 16^error,msg="hd:5555: Connection timed out." - notifyInferiorSetupFailed(msgConnectRemoteServerFailed(response.data["msg"].data())); + notifyInferiorSetupFailedHelper(msgConnectRemoteServerFailed(response.data["msg"].data())); } } @@ -4851,14 +4843,14 @@ void GdbEngine::handleTargetExtendedRemote(const DebuggerResponse &response) mb->button(QMessageBox::Ok)->setText(tr("Stop Debugging")); if (mb->exec() == QMessageBox::Ok) { showMessage("KILLING DEBUGGER AS REQUESTED BY USER"); - notifyInferiorSetupFailed(title); + notifyInferiorSetupFailedHelper(title); } else { showMessage("CONTINUE DEBUGGER AS REQUESTED BY USER"); handleInferiorPrepared(); // This will likely fail. } } } else { - notifyInferiorSetupFailed(msgConnectRemoteServerFailed(response.data["msg"].data())); + notifyInferiorSetupFailedHelper(msgConnectRemoteServerFailed(response.data["msg"].data())); } } @@ -4869,7 +4861,7 @@ void GdbEngine::handleTargetExtendedAttach(const DebuggerResponse &response) // gdb server will stop the remote application itself. handleInferiorPrepared(); } else { - notifyInferiorSetupFailed(msgConnectRemoteServerFailed(response.data["msg"].data())); + notifyInferiorSetupFailedHelper(msgConnectRemoteServerFailed(response.data["msg"].data())); } } @@ -4891,7 +4883,7 @@ void GdbEngine::handleTargetQnx(const DebuggerResponse &response) handleInferiorPrepared(); } else { // 16^error,msg="hd:5555: Connection timed out." - notifyInferiorSetupFailed(response.data["msg"].data()); + notifyInferiorSetupFailedHelper(response.data["msg"].data()); } } @@ -4908,7 +4900,7 @@ void GdbEngine::handleSetNtoExecutable(const DebuggerResponse &response) } case ResultError: default: - notifyInferiorSetupFailed(response.data["msg"].data()); + notifyInferiorSetupFailedHelper(response.data["msg"].data()); } } diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index 01b1d86a49a..c7122340f06 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -78,7 +78,6 @@ private: ////////// General Interface ////////// DebuggerEngine *cppEngine() final { return this; } void handleGdbStartFailed(); - void notifyInferiorSetupFailed() final; void prepareForRestart() final; bool hasCapability(unsigned) const final; @@ -118,8 +117,8 @@ private: ////////// General Interface ////////// void handleDebugInfoLocation(const DebuggerResponse &response); - // The adapter is still running just fine, but it failed to acquire a debuggee. - void notifyInferiorSetupFailed(const QString &msg); + // The engine is still running just fine, but it failed to acquire a debuggee. + void notifyInferiorSetupFailedHelper(const QString &msg); void notifyAdapterShutdownOk(); void notifyAdapterShutdownFailed(); diff --git a/src/plugins/debugger/qml/qmlcppengine.cpp b/src/plugins/debugger/qml/qmlcppengine.cpp index d8d0a66404e..31742a890e2 100644 --- a/src/plugins/debugger/qml/qmlcppengine.cpp +++ b/src/plugins/debugger/qml/qmlcppengine.cpp @@ -378,36 +378,6 @@ void QmlCppEngine::setupEngine() m_cppEngine->setupSlaveEngine(); } -void QmlCppEngine::notifyEngineRunAndInferiorRunOk() -{ - EDEBUG("\nMASTER NOTIFY ENGINE RUN AND INFERIOR RUN OK"); - DebuggerEngine::notifyEngineRunAndInferiorRunOk(); -} - -void QmlCppEngine::notifyInferiorRunOk() -{ - EDEBUG("\nMASTER NOTIFY INFERIOR RUN OK"); - DebuggerEngine::notifyInferiorRunOk(); -} - -void QmlCppEngine::notifyInferiorSpontaneousStop() -{ - EDEBUG("\nMASTER SPONTANEOUS STOP OK"); - DebuggerEngine::notifyInferiorSpontaneousStop(); -} - -void QmlCppEngine::notifyInferiorShutdownOk() -{ - EDEBUG("\nMASTER INFERIOR SHUTDOWN OK"); - DebuggerEngine::notifyInferiorShutdownOk(); -} - -void QmlCppEngine::notifyInferiorSetupOk() -{ - EDEBUG("\nMASTER INFERIOR SETUP OK"); - DebuggerEngine::notifyInferiorSetupOk(); -} - void QmlCppEngine::setupInferior() { EDEBUG("\nMASTER SETUP INFERIOR"); diff --git a/src/plugins/debugger/qml/qmlcppengine.h b/src/plugins/debugger/qml/qmlcppengine.h index 52442d0e898..38a3c00d566 100644 --- a/src/plugins/debugger/qml/qmlcppengine.h +++ b/src/plugins/debugger/qml/qmlcppengine.h @@ -114,12 +114,6 @@ protected: void quitDebugger() override; void abortDebugger() override; - void notifyInferiorRunOk() override; - void notifyInferiorSpontaneousStop() override; - void notifyEngineRunAndInferiorRunOk() override; - void notifyInferiorShutdownOk() override; - - void notifyInferiorSetupOk() override; void loadAdditionalQmlStack() override; private: