Commit c438c872 authored by hjk's avatar hjk
Browse files

debugger: cleanup gdb command queue when inferior setup failed

parent 64f26f2c
......@@ -269,38 +269,41 @@ public:
virtual void quitDebugger(); // called by DebuggerRunControl
protected:
void notifyEngineSetupOk();
void notifyEngineSetupFailed();
void notifyEngineRunFailed();
// 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 notifyInferiorSetupOk();
void notifyInferiorSetupFailed();
virtual void notifyInferiorSetupOk();
virtual void notifyInferiorSetupFailed();
void notifyEngineRunAndInferiorRunOk();
void notifyEngineRunAndInferiorStopOk();
void notifyInferiorUnrunnable(); // Called by CoreAdapter.
virtual void notifyEngineRunAndInferiorRunOk();
virtual void notifyEngineRunAndInferiorStopOk();
virtual void notifyInferiorUnrunnable(); // Called by CoreAdapter.
// Use notifyInferiorRunRequested() plus notifyInferiorRunOk() instead.
//void notifyInferiorSpontaneousRun();
//virtual void notifyInferiorSpontaneousRun();
void notifyInferiorRunRequested();
void notifyInferiorRunOk();
void notifyInferiorRunFailed();
virtual void notifyInferiorRunRequested();
virtual void notifyInferiorRunOk();
virtual void notifyInferiorRunFailed();
void notifyInferiorStopOk();
void notifyInferiorSpontaneousStop();
void notifyInferiorStopFailed();
void notifyInferiorExited();
virtual void notifyInferiorStopOk();
virtual void notifyInferiorSpontaneousStop();
virtual void notifyInferiorStopFailed();
virtual void notifyInferiorExited();
void notifyInferiorShutdownOk();
void notifyInferiorShutdownFailed();
virtual void notifyInferiorShutdownOk();
virtual void notifyInferiorShutdownFailed();
void notifyEngineSpontaneousShutdown();
void notifyEngineShutdownOk();
void notifyEngineShutdownFailed();
virtual void notifyEngineSpontaneousShutdown();
virtual void notifyEngineShutdownOk();
virtual void notifyEngineShutdownFailed();
void notifyInferiorIll();
void notifyEngineIll();
virtual void notifyInferiorIll();
virtual void notifyEngineIll();
virtual void setupEngine() = 0;
virtual void setupInferior() = 0;
......
......@@ -4190,6 +4190,14 @@ void GdbEngine::setupInferior()
m_gdbAdapter->setupInferior();
}
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::handleInferiorPrepared()
{
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
......@@ -4289,6 +4297,19 @@ void GdbEngine::handleCreateFullBacktrace(const GdbResponse &response)
}
}
void GdbEngine::resetCommandQueue()
{
m_commandTimer->stop();
if (!m_cookieForToken.isEmpty()) {
QString msg;
QTextStream ts(&msg);
ts << "RESETING COMMAND QUEUE. LEFT OVER TOKENS: ";
foreach (const GdbCommand &cookie, m_cookieForToken)
ts << "CMD:" << cookie.command << cookie.callbackName;
m_cookieForToken.clear();
showMessage(msg);
}
}
//
// Factory
......
......@@ -113,6 +113,7 @@ private: ////////// General Interface //////////
virtual void detachDebugger();
virtual void shutdownEngine();
virtual void shutdownInferior();
virtual void notifyInferiorSetupFailed();
virtual void executeDebuggerCommand(const QString &command);
virtual QString qtNamespace() const { return m_dumperHelper.qtNamespace(); }
......@@ -287,6 +288,7 @@ private: ////////// Gdb Output, State & Capability Handling //////////
void handleStop1(const GdbResponse &response);
void handleStop1(const GdbMi &data);
StackFrame parseStackFrame(const GdbMi &mi, int level);
void resetCommandQueue();
bool isSynchroneous() const { return hasPython(); }
virtual bool hasPython() const;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment