From 14814c377c7ba99bf4d1c78792bb3bb407278aeb Mon Sep 17 00:00:00 2001 From: "Ilya.Kazakevich" Date: Fri, 4 Sep 2015 16:56:15 +0300 Subject: [PATCH] PY-15975 Any python configuration is debuggable except one that declares itself not debuggable. All other configurations are skipped by PyDebugRunner --- .../python/debugger/PyDebugRunner.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/python/src/com/jetbrains/python/debugger/PyDebugRunner.java b/python/src/com/jetbrains/python/debugger/PyDebugRunner.java index c39fdb22bf3b..1e7ec4331c60 100644 --- a/python/src/com/jetbrains/python/debugger/PyDebugRunner.java +++ b/python/src/com/jetbrains/python/debugger/PyDebugRunner.java @@ -82,10 +82,28 @@ public class PyDebugRunner extends GenericProgramRunner { // If not debug at all return false; } + /** + * Any python configuration is debuggable unless it explicitly declares itself as DebugAwareConfiguration and denies it + * with canRunUnderDebug == false + */ + + if (profile instanceof WrappingRunConfiguration) { + // If configuration is wrapper -- unwrap it and check + return isDebuggable(((WrappingRunConfiguration)profile).getPeer()); + } + return isDebuggable(profile); + } + + private static boolean isDebuggable(@NotNull final RunProfile profile) { if (profile instanceof DebugAwareConfiguration) { // if configuration knows whether debug is allowed return ((DebugAwareConfiguration)profile).canRunUnderDebug(); } + if (profile instanceof AbstractPythonRunConfiguration) { + // Any python configuration is debuggable + return true; + } + // No even a python configuration return false; }