#549 Enable PyDev debugger to find remote sources via RSE and SSH

closed-fixed
nobody
None
5
2013-04-10
2011-08-05
Matt Pietrek
No

For full discussion, see here: https://sourceforge.net/projects/pydev/forums/forum/293649/topic/4641556/index/page/1

Relevant excerpt:

I understand and accept that I need to add a reference and use pydevd from my source. I've had some limited success in that I can see in my Mac Eclipse instance that the process has debug-attached, and that I can step/run the remote app - just not with source debugging. Each time I step, the Eclipse debugger indicates that it can't find the source file. Thus the first question:

1) How do I get the Eclipse debugger to point at the remote machine sources? I can obviously see and edit these sources via RSE, it's just that the debugger seems unaware of them. I've noticed that there's a Pydev "Debug | source locater" dialog, but it implies that the sources are in both locations. I don't have the source locally - They're only on the remote system. What's the preferred way of working with this situation?

Discussion

  • Fabio Zadrozny
    Fabio Zadrozny
    2011-08-09

    Can you grab the latest nightly and see if it works for you now (see: http://pydev.org/download.html for details on getting the nightly).

    Under window > preferences > pydev > debugger > source locator, you can select an option so that it always only gets from the remote backed -- without asking for the local source.

     
  • Fabio Zadrozny
    Fabio Zadrozny
    2011-08-09

    • status: open --> closed-fixed
     
  • Matt Pietrek
    Matt Pietrek
    2011-08-09

    Fabio,

    Just tried this out, and at least on my simple first test it works great! Very, very cool. This will be a total lifesaver for me when working remotely. Thanks so much!

    Matt

     
  • Matt Pietrek
    Matt Pietrek
    2011-08-09

    I've played around this a little bit more and have noticed one quirk. It seems that if the target source file (i.e., the one with pydevd.settrace) is not open in the Debug perspective, the debugger doesn't open it. However, if I switch to the RSE perspective and manually switch back to the debug perspective, the debugger will subsequently "sync up" once you start stepping.

    My potentially naive expectation is that if the debugger breaks in, the debug perspective should open up the corresponding source window. Mind you, I'm still quite happy this was implemented. Just trying to make it seamless for the next person who tries it.

    Matt

     
  • Fabio Zadrozny
    Fabio Zadrozny
    2011-08-11

    Actually that's expected (when setting a breakpoint, usually -- if you didn't ask otherwise -- it should open the debug perspective automatically).

    This happens because it'll only enable an editor when the file is selected in the debugger stack frames view -- I think you could enable that view on your rse perspective if you wanted to view the file in this case (but personally, when debugging I always go to the debug perspective).

     
  • Fabio Zadrozny
    Fabio Zadrozny
    2011-08-11

    Actually, re-reading what you wrote, I answered you wrong... do you have the stack frame selected when it breaks?

     
  • Fieldhouse
    Fieldhouse
    2013-04-10

    Sorry to dredge this up but from what I can tell the behavior is a little odd. Like Matt mentioned no source is displayed in the debug perspective unless you copy the source files from the remote host.

    I tried messing around with the pydevd_file_utils.py PATHS_FROM_ECLIPSE_TO_PYTHON mapping but changing the mapping the server's path to either location (rse://) or path (/remoteserver_) helped.

    The location shown under the resource properties of a remote project source file in PyDev is rse://<remote ssh server ip>/path/on/server/to/file.py
    and the "path" is <rse connection name>_<project name>/path/to/file.py

    So, for example, if I have a remote server that I ssh to with an ip address of 10.1.1.1 for which I created a connection named "remoteserver" and my python project is located on the server at /home/fieldhouse/MyTestProject the "path" for a file might be /remoteserver_MyTestProject/src/root/nested/mod1.py and the location shown is rse://10.1.1.1/home/fieldhouse/MyTestProject/src/root/nested/mod1.py

    I can live with having to copy source back local but any suggestions on the correct way to map remote projects would be greatly appreciated.

    EDIT: I think I've found a slightly better way. If the local path is pointed to the remote server's folder under workspace\RemoteSystemsTempFiles (RSE's local file cache) then you can right-click a remote path and select "Synchronize Cache" to automatically copy over any changed files from the remote server. This pre-populates the cache so you don't get complaints from the debugger about missing files.

    This isn't ideal, connections to the debug server still show as unknown but at least it syncs up with the cached code without having to create another unsynced local copy of the files.

     
    Last edit: Fieldhouse 2013-04-11