11

Resolved

Cross-OS remote debugging

description

It would be extremely useful if PTVS supported remote debugging on non-windows machines.
This could be easily done in a way similar to how winpdb or eclipse pydev work: You import the debugger module in your code and then call either a function which immediately breaks (similar to debugger; in javascript) or one that simply starts the debugging server.

The advantage of this would be being able to keep the platform independency of python - for example, a webapp i work on runs better on linux so I run it via WSGI/Apache on a linux system but access it through a SMB share from my windows machine. And even though that case might be a bit special I guess quite some users who work with multiple OSs would appreciate being able to use their favourite IDE even for debugging on the other OS.

comments

dinov wrote Oct 12, 2011 at 6:18 PM

This also doesn't have to be about being x-plat, it could also just be about enabling an attach scenario which doesn't require us to find the Python interpreter and set up the debugger ourselves. That would be useful for attach to non-CPython interpreters.

AphexSA wrote Dec 6, 2011 at 12:59 AM

I'd love to see this as well. I have the same scenario; I need to debug a python application that only runs on linux because it uses platform-specific python modules like fcntl and resource.

I got excited when I saw the main PTVS page listing 'remote debugging' as a feature, but I don't see how to accomplish this even with PTVS 1.1 Alpha installed.

dinov wrote Dec 6, 2011 at 2:35 AM

Normal remote debugging is achieved with the normal VS debugging experience. You can do Debug->Attach to Process and select a remote machine. The machine will need to have VS and PTVS installed and you need to start the remote debugger which is under Visual Studio in the start menu.

We also support automatically deploying and running for MPI Python debugging. As we tackle other scenarios that involve deployment we'll presumably do starting on the remote machine as appropriate (rather than just attach to process).

AphexSA wrote Dec 8, 2011 at 12:54 AM

It appears the way other IDEs like SlickEdit and KOMODO do remote python debugging is with pydbgp - http://docs.activestate.com/komodo/4.4/debugpython.html

You simply run your script inside Pydbgp on the remote server, and it wraps any uncaught exceptions as well as providing breakpoint support through communication with the local editor. I would LOVE to see PTVS support pydbgp.

dinov wrote Dec 8, 2011 at 1:37 AM

I would suspect the amount of work to support something like pydbgp is greater than the amount of work to simply enable remote debugging w/ our own debugger. For our own debugger all we do is communicate over a socket between VS and the local Python process. We could support starting the process with our own debugging script, or support importing our debugging script, and then we just need to connect to VS and at some point launch debugging within VS.

It actually shouldn't be difficult to do - the difficult parts might be wiring it into VS which could be easy (just add a new Debug->Attach to Remote Python menu item and flow the options through to our debugger when we do a debug launch) to the more extreme (wiring in and working with VS's debugger transport stuff, if that's even possible).

The only interesting questions are do we open a port on the debuggee or debugger machine or support both? Currently we open the port in the VS process and the debugge connects back.

If someone wanted to implement this I'd be happy to provide guidance, but there's still some other features on our priority list above this.

Zooba wrote Jul 16, 2012 at 3:35 PM

Issues like http://pytools.codeplex.com/workitem/751 would also benefit from this.

My vote is to have the debuggee connect to the debugger, since the PC running VS is more likely to have permissions to listen to incoming connections. It would also give a nicer experience if we actually add a launch mode that starts the script/host/interpreter directly and immediately begins waiting.

pminaev wrote Jan 25 at 10:10 PM

We're working to implement this feature in PTVS 2.0, and would like to hear any feedback on the API that will be exposed to user scripts to enable remote debugging in them. If you're interested in this feature, please have a look:

http://pytools.codeplex.com/discussions/430907