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 <christian.stenger@qt.io>
This commit is contained in:
hjk
2017-09-12 10:33:59 +02:00
parent 0e92b085f9
commit ac2012a73a
5 changed files with 41 additions and 85 deletions

View File

@@ -340,44 +340,45 @@ protected:
// The base notify*() function implementation should be sufficient // The base notify*() function implementation should be sufficient
// in most cases, but engines are free to override them to do some // in most cases, but engines are free to override them to do some
// engine specific cleanup like stopping timers etc. // engine specific cleanup like stopping timers etc.
virtual void notifyEngineSetupOk(); void notifyEngineSetupOk();
virtual void notifyEngineSetupFailed(); void notifyEngineSetupFailed();
virtual void notifyEngineRunFailed(); void notifyEngineRunFailed();
virtual void notifyInferiorSetupOk(); void notifyInferiorSetupOk();
virtual void notifyInferiorSetupFailed(); void notifyInferiorSetupFailed();
virtual void notifyEngineRunAndInferiorRunOk(); void notifyEngineRunAndInferiorRunOk();
virtual void notifyEngineRunAndInferiorStopOk(); void notifyEngineRunAndInferiorStopOk();
virtual void notifyEngineRunOkAndInferiorUnrunnable(); // Called by CoreAdapter. void notifyEngineRunOkAndInferiorUnrunnable(); // Called by CoreAdapter.
// Use notifyInferiorRunRequested() plus notifyInferiorRunOk() instead. // Use notifyInferiorRunRequested() plus notifyInferiorRunOk() instead.
//virtual void notifyInferiorSpontaneousRun(); // void notifyInferiorSpontaneousRun();
virtual void notifyInferiorRunRequested(); void notifyInferiorRunRequested();
virtual void notifyInferiorRunOk(); void notifyInferiorRunOk();
virtual void notifyInferiorRunFailed(); void notifyInferiorRunFailed();
virtual void notifyInferiorStopOk(); void notifyInferiorStopOk();
virtual void notifyInferiorSpontaneousStop(); void notifyInferiorSpontaneousStop();
virtual void notifyInferiorStopFailed(); void notifyInferiorStopFailed();
public: public: // FIXME: Remove, currently needed for Android.
virtual void notifyInferiorExited(); void notifyInferiorExited();
protected:
void notifyDebuggerProcessFinished(int exitCode, QProcess::ExitStatus exitStatus, void notifyDebuggerProcessFinished(int exitCode, QProcess::ExitStatus exitStatus,
const QString &backendName); const QString &backendName);
protected:
virtual void setState(DebuggerState state, bool forced = false); virtual void setState(DebuggerState state, bool forced = false);
virtual void notifyInferiorShutdownOk(); void notifyInferiorShutdownOk();
virtual void notifyInferiorShutdownFailed(); void notifyInferiorShutdownFailed();
virtual void notifyEngineSpontaneousShutdown(); void notifyEngineSpontaneousShutdown();
virtual void notifyEngineShutdownOk(); void notifyEngineShutdownOk();
virtual void notifyEngineShutdownFailed(); void notifyEngineShutdownFailed();
virtual void notifyEngineIll(); void notifyEngineIll();
virtual void setupEngine() = 0; virtual void setupEngine() = 0;
virtual void setupInferior() = 0; virtual void setupInferior() = 0;

View File

@@ -4106,14 +4106,6 @@ void GdbEngine::handleAdapterStartFailed(const QString &msg, Id settingsIdHint)
notifyEngineSetupFailed(); 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() void GdbEngine::prepareForRestart()
{ {
m_rerunPending = false; 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); showStatusMessage(tr("Failed to start application:") + ' ' + msg);
if (state() == EngineSetupFailed) { if (state() == EngineSetupFailed) {
@@ -4200,7 +4192,7 @@ void GdbEngine::notifyInferiorSetupFailed(const QString &msg)
} }
showMessage("INFERIOR START FAILED"); showMessage("INFERIOR START FAILED");
AsynchronousMessageBox::critical(tr("Failed to start application"), msg); AsynchronousMessageBox::critical(tr("Failed to start application"), msg);
DebuggerEngine::notifyInferiorSetupFailed(); notifyInferiorSetupFailed();
} }
void GdbEngine::handleAdapterCrashed(const QString &msg) void GdbEngine::handleAdapterCrashed(const QString &msg)
@@ -4633,13 +4625,13 @@ void GdbEngine::handleAttach(const DebuggerResponse &response)
} }
case ResultError: case ResultError:
if (response.data["msg"].data() == "ptrace: Operation not permitted.") { if (response.data["msg"].data() == "ptrace: Operation not permitted.") {
notifyInferiorSetupFailed(msgPtraceError(runParameters().startMode)); notifyInferiorSetupFailedHelper(msgPtraceError(runParameters().startMode));
break; break;
} }
notifyInferiorSetupFailed(response.data["msg"].data()); notifyInferiorSetupFailedHelper(response.data["msg"].data());
break; break;
default: default:
notifyInferiorSetupFailed(response.data["msg"].data()); notifyInferiorSetupFailedHelper(response.data["msg"].data());
break; break;
} }
@@ -4702,7 +4694,7 @@ void GdbEngine::handleFileExecAndSymbols(const DebuggerResponse &response)
showMessage(msg, StatusBar); showMessage(msg, StatusBar);
callTargetRemote(); // Proceed nevertheless. callTargetRemote(); // Proceed nevertheless.
} else { } else {
notifyInferiorSetupFailed(msg); notifyInferiorSetupFailedHelper(msg);
} }
} }
@@ -4718,7 +4710,7 @@ void GdbEngine::handleFileExecAndSymbols(const DebuggerResponse &response)
"in the core file.") "in the core file.")
+ ' ' + tr("Try to specify the binary using the " + ' ' + tr("Try to specify the binary using the "
"<i>Debug->Start Debugging->Attach to Core</i> dialog."); "<i>Debug->Start Debugging->Attach to Core</i> dialog.");
notifyInferiorSetupFailed(msg); notifyInferiorSetupFailedHelper(msg);
} }
} else if (isPlainEngine()) { } else if (isPlainEngine()) {
@@ -4730,7 +4722,7 @@ void GdbEngine::handleFileExecAndSymbols(const DebuggerResponse &response)
// Extend the message a bit in unknown cases. // Extend the message a bit in unknown cases.
if (!msg.endsWith("File format not recognized")) if (!msg.endsWith("File format not recognized"))
msg = tr("Starting executable failed:") + '\n' + msg; msg = tr("Starting executable failed:") + '\n' + msg;
notifyInferiorSetupFailed(msg); notifyInferiorSetupFailedHelper(msg);
} }
} }
@@ -4817,7 +4809,7 @@ void GdbEngine::handleTargetRemote(const DebuggerResponse &response)
handleInferiorPrepared(); handleInferiorPrepared();
} else { } else {
// 16^error,msg="hd:5555: Connection timed out." // 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")); mb->button(QMessageBox::Ok)->setText(tr("Stop Debugging"));
if (mb->exec() == QMessageBox::Ok) { if (mb->exec() == QMessageBox::Ok) {
showMessage("KILLING DEBUGGER AS REQUESTED BY USER"); showMessage("KILLING DEBUGGER AS REQUESTED BY USER");
notifyInferiorSetupFailed(title); notifyInferiorSetupFailedHelper(title);
} else { } else {
showMessage("CONTINUE DEBUGGER AS REQUESTED BY USER"); showMessage("CONTINUE DEBUGGER AS REQUESTED BY USER");
handleInferiorPrepared(); // This will likely fail. handleInferiorPrepared(); // This will likely fail.
} }
} }
} else { } 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. // gdb server will stop the remote application itself.
handleInferiorPrepared(); handleInferiorPrepared();
} else { } else {
notifyInferiorSetupFailed(msgConnectRemoteServerFailed(response.data["msg"].data())); notifyInferiorSetupFailedHelper(msgConnectRemoteServerFailed(response.data["msg"].data()));
} }
} }
@@ -4891,7 +4883,7 @@ void GdbEngine::handleTargetQnx(const DebuggerResponse &response)
handleInferiorPrepared(); handleInferiorPrepared();
} else { } else {
// 16^error,msg="hd:5555: Connection timed out." // 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: case ResultError:
default: default:
notifyInferiorSetupFailed(response.data["msg"].data()); notifyInferiorSetupFailedHelper(response.data["msg"].data());
} }
} }

View File

@@ -78,7 +78,6 @@ private: ////////// General Interface //////////
DebuggerEngine *cppEngine() final { return this; } DebuggerEngine *cppEngine() final { return this; }
void handleGdbStartFailed(); void handleGdbStartFailed();
void notifyInferiorSetupFailed() final;
void prepareForRestart() final; void prepareForRestart() final;
bool hasCapability(unsigned) const final; bool hasCapability(unsigned) const final;
@@ -118,8 +117,8 @@ private: ////////// General Interface //////////
void handleDebugInfoLocation(const DebuggerResponse &response); void handleDebugInfoLocation(const DebuggerResponse &response);
// The adapter is still running just fine, but it failed to acquire a debuggee. // The engine is still running just fine, but it failed to acquire a debuggee.
void notifyInferiorSetupFailed(const QString &msg); void notifyInferiorSetupFailedHelper(const QString &msg);
void notifyAdapterShutdownOk(); void notifyAdapterShutdownOk();
void notifyAdapterShutdownFailed(); void notifyAdapterShutdownFailed();

View File

@@ -378,36 +378,6 @@ void QmlCppEngine::setupEngine()
m_cppEngine->setupSlaveEngine(); 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() void QmlCppEngine::setupInferior()
{ {
EDEBUG("\nMASTER SETUP INFERIOR"); EDEBUG("\nMASTER SETUP INFERIOR");

View File

@@ -114,12 +114,6 @@ protected:
void quitDebugger() override; void quitDebugger() override;
void abortDebugger() override; void abortDebugger() override;
void notifyInferiorRunOk() override;
void notifyInferiorSpontaneousStop() override;
void notifyEngineRunAndInferiorRunOk() override;
void notifyInferiorShutdownOk() override;
void notifyInferiorSetupOk() override;
void loadAdditionalQmlStack() override; void loadAdditionalQmlStack() override;
private: private: