Menu

#222 Remote Debugger should be able to map files better.

open
nobody
None
5
2007-04-17
2007-04-17
No

Just tried Pydev Extensions because the possibility to do remote debugging. Unfortunately, this don't work well when the host machine is unixish and dev machine is under Windows because the filename mismatch.
Found a simple solution, that should work if no system-dependent libs are used. The solution is to patch pydevd_comm.py so that NormFile would translate the file path using a mapping of unix -> windows path (in the example I use samba mount to the actual project directory):

FILE_TRANS_MAP = {'/path/to/the/project/unix/': 'z:/',
'/usr/lib/python2.4/': 'c:/Python24/Lib/'}

def NormFile(filename):
try:
rPath = os.path.realpath #@UndefinedVariable
except:
# jython does not support os.path.realpath
# realpath is a no-op on systems without islink support
rPath = os.path.abspath
fname = os.path.normcase(rPath(filename))
for _from, _to in FILE_TRANS_MAP.items():
if fname.startswith(_from):
fname = fname.replace(_from, _to, 1)
break
return fname

Though, the more convenient way would be to map filenames on the dev machine instead of the remote debug client. E.g., the mapping could be defined in a project settings dialog, and the debug server would use the mapping to translate remote filenames to local. What do you think?

Regards,
Max

Discussion

  • Fabio Zadrozny

    Fabio Zadrozny - 2007-04-17
    • summary: Pydev Extensions: remote debug filename mismatch solution --> Remote Debugger should be able to map files better.
     
  • Fabio Zadrozny

    Fabio Zadrozny - 2007-04-17

    Logged In: YES
    user_id=617340
    Originator: NO

    I agree that the best solution would be to set the mapping in the client and not in the server. It should not be difficult to add that support... I'll probably not do it in the next release (which should be out this week), but I'll try to do it for the next one after this.

    Cheers,

    Fabio

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.