|
Last Site Update: 20 July 2010 | Latest Version: 1.6.0 |
|
|
|
|
|
|
|
![]() |
![]() |
|
|
Remote DebuggerIn Pydev you can debug a remote program (a file that is not launched from within Eclipse). The steps to debug an external program are:
Let's see a simple 'step-by-step' example on how this works:
1. Start the remote debugger server: To start the remote debugger server, you have to click the
green button pointed by '1' in the image below. After doing that, it will show a message in the console (indicated by '2') to
confirm that the server is listening for incoming connections.
Image: Remote Debugger Server 2. Go to the debug perspective: This is needed because it has no actual 'signal' that it reached a breakpoint when doing remote debugging. So, if you already have it open, just cycle to it with Ctrl+F8. Otherwise, go to the menu: window > Open Perspective > Other > Debug. Note that there should appear a process named 'Debug Server' in the debug view (see '1' in the image below).
Image: Debug perspective 3. Make sure pydevd.py is in your pythonpath: This file is included in the org.python.pydev.debug plugin. So, you'll have to add it to the pythonpath. It's exact location will depend upon the eclipse location and the plugin version, being something like: eclipse/plugins/org.python.pydev.debug_x.x.x/pysrc/pydevd.py (so, the container folder must be in your pythonpath). If you choose to execute it from another machine, you need to copy all the files within that folder to the target machine in order to be able to debug it (if the target machine does not have the same paths as the client machine, the file pydevd_file_utils.py must be edited to properly translate the paths from one machine to the other -- see comments on that file). 4. Call pydevd.settrace(): Now that the pydevd.py module is already on your pythonpath, you can use the template provided: 'pydevd' to make the call: import pydevd;pydevd.settrace(). When that call is reached, it will automatically suspend the execution and show the debugger.
Image: pydevd.settrace called Important NotesNOTE 1: the settrace() function can have an optional parameter to specify the host where the remote debugger is listening. E.g.: pydevd.settrace('10.0.0.1') NOTE 2: the settrace() function can have optional parameters to specify that all the messages printed to stdout or stderr should be passed to the server to show. E.g.: pydevd.settrace(stdoutToServer=True, stderrToServer=True)
NOTE 3: You can have the running program in one machine and Pydev on another machine,
but if the paths are not exactly the same, some adjustments have to be done in the target machine:
|
|
|
Copyright: Aptana, Inc. 2008-2010 |