From 68d12f0724e153230ad49490bc79e0b4dec1d7e4 Mon Sep 17 00:00:00 2001 From: Artem Sokolovskii Date: Wed, 6 Sep 2023 11:23:59 +0200 Subject: [PATCH] DAP: Fix python debug stoping Change-Id: I49ac6d9d7164a7f74fe683840734d903643b3561 Reviewed-by: hjk --- src/plugins/debugger/dap/pydapengine.cpp | 16 ++++++++++++++++ src/plugins/debugger/dap/pydapengine.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/src/plugins/debugger/dap/pydapengine.cpp b/src/plugins/debugger/dap/pydapengine.cpp index d4eae2ea47a..89e87023245 100644 --- a/src/plugins/debugger/dap/pydapengine.cpp +++ b/src/plugins/debugger/dap/pydapengine.cpp @@ -177,6 +177,22 @@ void PyDapEngine::handleDapInitialize() qCDebug(dapEngineLog) << "handleDapAttach"; } +void PyDapEngine::quitDebugger() +{ + showMessage(QString("QUIT DEBUGGER REQUESTED IN STATE %1").arg(state())); + startDying(); + + // Temporary workaround for Python debugging instability, particularly + // in conjunction with PySide6, due to unreliable pause functionality. + if (state() == InferiorRunOk) { + setState(InferiorStopRequested); + notifyInferiorStopOk(); + return; + } + + DebuggerEngine::quitDebugger(); +} + void installDebugpyPackage(const FilePath &pythonPath) { CommandLine cmd{pythonPath, {"-m", "pip", "install", "debugpy"}}; diff --git a/src/plugins/debugger/dap/pydapengine.h b/src/plugins/debugger/dap/pydapengine.h index d81bd4e8359..06cdaba8716 100644 --- a/src/plugins/debugger/dap/pydapengine.h +++ b/src/plugins/debugger/dap/pydapengine.h @@ -14,6 +14,8 @@ public: private: void handleDapInitialize() override; + void quitDebugger() override; + void setupEngine() override; Utils::Process m_proc; };