Add option to keep the Debug Server always running #1268
Replies: 10 comments
-
Something like this should be possible if you combine "attach" / "listen" with |
Beta Was this translation helpful? Give feedback.
-
@int19h I'm not sure I get what you're trying to explain. Specifically the part about Right now I have a python file which at some point has the following:
What do you suggest needs to be done (or perhaps where) to always have the VSCode debug server running so when I launch an interpreter outside of VSCode it will attach to its debugger? |
Beta Was this translation helpful? Give feedback.
-
On VSCode side, use a debug configuration with By itself, this just reverses the direction of connection. But if you also add |
Beta Was this translation helpful? Give feedback.
-
@int19h, unfortunately I've not been able to make this work. To simplify testing I created a simple project in CLion and launch the python interpreter from there when starting a debug session. This hits the breakpoints in C++ code when the I'm probably simply unaware of some fundamentals on how to make VSCode python debugging tick. The relevant snippet from the python script:
This is the
I launch VSCode debugger once to make sure the debug server is started. Based on your earlier comments I assume it should keep running afterwards thanks to the When I launch the python interpreter from CLion the C++ breakpoint gets hit. It does not hit any python breakpoint in VSCode. VSCode stops waiting for the a client connection, so the retry does not seem to be working. It looks like Sorry to keep this thread open. I really appreciate your you take the time to help me figure this out. Thanks! |
Beta Was this translation helpful? Give feedback.
-
By setting |
Beta Was this translation helpful? Give feedback.
-
To clarify, the "restart" bit needs to be outside of the "listen" block. With respect to UI for the listening server we're limited by what a debugger extension can do in VSCode. But, basically, so long as it's listening, you should be seeing the debugger toolbar with "Stop" etc - if that goes away, the server is not there anymore. |
Beta Was this translation helpful? Give feedback.
-
Yes, I've been able to debug single sessions initiated from CLion and hitting breakpoints in VSCode! Regarding the Right now the session only works once. Do you happen to have a working sample config? |
Beta Was this translation helpful? Give feedback.
-
While certain debuggers seem to support
Am I missing something here? |
Beta Was this translation helpful? Give feedback.
-
There is a bit of a disconnect between what debugpy actually supports, and what the VSCode launch.json schema for its config says it supports. The "restart" bit is very recent, and not fully supported for all types of attach, so it's not in their schema yet. And the squiggles that you get from the editor are from schema validation, so they shouldn't prevent the config from actually being used. (One way to make sure that this property is indeed being read by debugpy is to put some nonsense there instead of a boolean - then you should get a message box with an error about it when you actually start debugging.) |
Beta Was this translation helpful? Give feedback.
-
Finally got it working, thanks for the support @int19h! I was unable to reproduce the |
Beta Was this translation helpful? Give feedback.
-
Summary:
It would be very helpful if the user could start a debug server and keep it running for the time VSCode keeps running. This allows external processes to initiate the launch of the script while still connecting to the debug server in VSCode.
Example case:
Currently I'm working on a C++ API for python. This C++ API ends up in a
.dll
which python scripts load. In Visual Studio 19` I set launch options to call the python interpreter with the script. This allows me to debug the API on the C++ side. If the debug server would keep running on the VSCode side, and let the script connect the the python debugger in VSCode when initiated from Visual Studio, I would be able to hit breakpoints in both C++ (Visual Studio) and Python (VSCode).It might be that this feature already exists but I couldn't find it in the documentation.
For what its worth, pydevd in Eclipse has this feature, and this keeps me attached to that platform. It is simply too powerful of a development feature.
Below some screenshots of the feature in pydev as exposed in Eclipse.
Beta Was this translation helpful? Give feedback.
All reactions