Commit e952470b authored by hjk's avatar hjk
Browse files

debugger: move coreAboutToClose() check to DebuggerPlugin

parent 7f01593b
...@@ -2721,34 +2721,12 @@ bool DebuggerPlugin::isRegisterViewVisible() const ...@@ -2721,34 +2721,12 @@ bool DebuggerPlugin::isRegisterViewVisible() const
return d->m_registerDock->toggleViewAction()->isChecked(); return d->m_registerDock->toggleViewAction()->isChecked();
} }
bool DebuggerPlugin::coreAboutToClose()
//////////////////////////////////////////////////////////////////////
//
// Testing
//
//////////////////////////////////////////////////////////////////////
/*
void DebuggerPlugin::runTest(const QString &fileName)
{ {
DebuggerStartParameters sp;
sp.executable = fileName;
sp.processArgs = QStringList() << "--run-debuggee";
sp.workingDirectory.clear();
startDebugger(m_debuggerRunControlFactory->create(sp));
}
*/
bool DebuggerListener::coreAboutToClose()
{
DebuggerPlugin *plugin = DebuggerPlugin::instance();
if (!plugin)
return true;
// FIXME: Iterate over all running debuggers. // FIXME: Iterate over all running debuggers.
// Ask to terminate the session. // Ask to terminate the session.
bool cleanTermination = false; bool cleanTermination = false;
switch (plugin->state()) { switch (state()) {
case DebuggerNotReady: case DebuggerNotReady:
case DebuggerFinished: case DebuggerFinished:
case InferiorUnrunnable: case InferiorUnrunnable:
...@@ -2784,7 +2762,7 @@ bool DebuggerListener::coreAboutToClose() ...@@ -2784,7 +2762,7 @@ bool DebuggerListener::coreAboutToClose()
"Terminating the session in the current" "Terminating the session in the current"
" state (%1) can leave the target in an inconsistent state." " state (%1) can leave the target in an inconsistent state."
" Would you still like to terminate it?") " Would you still like to terminate it?")
.arg(_(DebuggerEngine::stateName(plugin->state()))); .arg(_(DebuggerEngine::stateName(state())));
const QString title const QString title
= QCoreApplication::translate("Debugger::Internal::DebuggerListener", = QCoreApplication::translate("Debugger::Internal::DebuggerListener",
...@@ -2796,11 +2774,34 @@ bool DebuggerListener::coreAboutToClose() ...@@ -2796,11 +2774,34 @@ bool DebuggerListener::coreAboutToClose()
if (answer != QMessageBox::Yes) if (answer != QMessageBox::Yes)
return false; return false;
plugin->d->exitDebugger(); d->exitDebugger();
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents); QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
return true; return true;
} }
//////////////////////////////////////////////////////////////////////
//
// Testing
//
//////////////////////////////////////////////////////////////////////
/*
void DebuggerPlugin::runTest(const QString &fileName)
{
DebuggerStartParameters sp;
sp.executable = fileName;
sp.processArgs = QStringList() << "--run-debuggee";
sp.workingDirectory.clear();
startDebugger(m_debuggerRunControlFactory->create(sp));
}
*/
bool DebuggerListener::coreAboutToClose()
{
DebuggerPlugin *plugin = DebuggerPlugin::instance();
return plugin && plugin->coreAboutToClose();
}
} // namespace Debugger } // namespace Debugger
#include "debuggerplugin.moc" #include "debuggerplugin.moc"
......
...@@ -73,6 +73,7 @@ public: ...@@ -73,6 +73,7 @@ public:
QVariant sessionValue(const QString &name); QVariant sessionValue(const QString &name);
void setSessionValue(const QString &name, const QVariant &value); void setSessionValue(const QString &name, const QVariant &value);
void setConfigValue(const QString &name, const QVariant &value); void setConfigValue(const QString &name, const QVariant &value);
bool coreAboutToClose();
void resetLocation(); void resetLocation();
void gotoLocation(const QString &fileName, int lineNumber, bool setMarker); void gotoLocation(const QString &fileName, int lineNumber, bool setMarker);
......
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