Commit 28b549cf authored by Igor Kushnir's avatar Igor Kushnir Committed by Milian Wolff
Browse files

Implement virtual DebugSession::killDebuggerNow()

https://commits.kde.org/kdevelop/37ff587ebe2a2c355d71cb583fb5f058c5301ff3
introduced a pure virtual IDebugSession::killDebuggerNow() member
function. DebugSession must override it to become non-abstract and fix
the following compilation error (GCC):
  invalid new-expression of abstract class type ‘Python::DebugSession’

DebugSession::killDebuggerNow() kills the debugger process
unconditionally to mimic the behavior of ~DebugSession().

As far as I can tell, DebugSession::killDebuggerNow() will never be
called, because DebugSession::stopDebugger() switches to EndedState
synchronously and is destroyed before ~DebugController() invokes
&IDebugSession::killDebuggerNow.
parent 2f189cfd
...@@ -494,10 +494,22 @@ void DebugSession::stopDebugger() ...@@ -494,10 +494,22 @@ void DebugSession::stopDebugger()
if ( ! m_debuggerProcess->waitForFinished(200) ) { if ( ! m_debuggerProcess->waitForFinished(200) ) {
m_debuggerProcess->kill(); m_debuggerProcess->kill();
} }
qCDebug(KDEV_PYTHON_DEBUGGER) << "stopped debugger";
finalizeState();
}
void DebugSession::killDebuggerNow()
{
qCDebug(KDEV_PYTHON_DEBUGGER) << "killing debugger now";
m_debuggerProcess->kill();
finalizeState();
}
void DebugSession::finalizeState()
{
m_commandQueue.clear(); m_commandQueue.clear();
m_nextNotifyMethod = nullptr; m_nextNotifyMethod = nullptr;
m_nextNotifyObject.clear(); m_nextNotifyObject.clear();
qCDebug(KDEV_PYTHON_DEBUGGER) << "killed debugger";
setState(IDebugSession::EndedState); setState(IDebugSession::EndedState);
} }
......
...@@ -133,6 +133,11 @@ public: ...@@ -133,6 +133,11 @@ public:
* it'll just kill it. * it'll just kill it.
**/ **/
void stopDebugger() override; void stopDebugger() override;
/**
* @brief Kill the debugger process synchronously
**/
void killDebuggerNow() override;
/** /**
* @brief Gives the debugger state. * @brief Gives the debugger state.
...@@ -250,6 +255,11 @@ private: ...@@ -250,6 +255,11 @@ private:
* @brief Clear the data accumulated in m_buffer. * @brief Clear the data accumulated in m_buffer.
**/ **/
void clearOutputBuffer(); void clearOutputBuffer();
/**
* @brief Clean up and switch to EndedState after stopping/killing the debugger
**/
void finalizeState();
/// stores whether the data currently received comes from the debugger /// stores whether the data currently received comes from the debugger
/// or the debuggee. /// or the debuggee.
......
Markdown is supported
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