‘epyunit.debug.pydevrdc’ - Module

The PyDev plugin provides for the remote debugging of Python processes. This is also supported for processes started outside the control of the debugger. Here stub code is required in the process started outside the control domain of ‘pydevd.py’. The module ‘epyunit.debug’ supports the localization and load of ‘pydevd.py’ fromvarious versions and locations.

Support for the automation of cross-process remote debugging with PyDev and Eclipse.

The module provides helpers for the debugging with the PyDev in the Eclipse IDE. This includes utilities for the cross-process debugging by Remote-Debugging. The PyDevRDC module provides processes started outside the PyDev environment, as well as processes under control of PyDev.

In case the module epyunit.debug.checkRDbg is not yet loaded, this is done and the provided parameters are passed through to the initial call:

epyunit.debug.checkRDbg.checkAndRemoveRDbgOptions()

See ‘http://pydev.org/manual_adv_remote_debugger.html

The following parameters modify the control flow:

  • Module Variables:

    • epyunit.debug.pydevrdc.PYDEVD:

      Provides a pre-allocated controller object for remote debugging by PyDev as Eclipse plugin. Could be extended by custom instances as required. Just requires a simple import statement and could thereafter be controlled by parameters.

  • Environment Variables:

    • PYDEVDSCAN:

      The start directory for search on ‘pydevd.py’. If not set, the default is:

      px = $HOME/eclipse/eclipse
      px = os.path.abspath(px)
      px = os.path.realname(px)
      px = os.path.dirname(px)
      px = os.path.normpath(px)
      

Module Variables

  • epyunit.Eclipse.PYDEVD:

    Provides a pre-allocated controller object for remote debugging by PyDev as Eclipse plugin. Could be extended by custom instances as required. Just requires a simple import statement and could thereafter be controlled by options.

Environment Variables

  • PYDEVDSCAN:

    The start directory for search on ‘pydevd.py’. If not set, the default is:

    px = $HOME/eclipse/eclipse
    px = os.path.abspath(px)
    px = os.path.realname(px)
    px = os.path.dirname(px)
    px = os.path.normpath(px)
    

    The start directory for search on ‘pydevd.py’. is due to the manual(PyDevRemoteDebugging) located in:

    eclipse/plugins/org.python.pydev_x.x.x/pysrc/pydevd.py
    

    Apply ‘pyfilesysobjects’ with ‘re’ and ‘glob’ expressions for casual application of a specific version or iteration through the present.

Class: PyDevRDC

class epyunit.debug.pydevrdc.PyDevRDC(**kargs)[source]

Provides automation for remote debugging of external Python process with PyDev.

This particularly provides a prepared environment for cross-process debugging by ‘pydevd’.

Methods

__init__

PyDevRDC.__init__(**kargs)[source]

Create a control stub for a remote debugger.

Search and load ‘pydevd’ for cross-process remote debugging.

Args:

**kargs:

debug:

Debug RDBG itself, developer output.

label=<name>:

An optional label for identifying the currrent instance. The label could be provided as debugging flag.

remotedebug:

Switches remote debugging support On/Off. Dependent of this parameter an internal call of startRemoteDebugExt is performed and a new instance initialized.

rootforscan:

Directory path for the module ‘pydevd.py’, else defaults of ‘scanEclipseForPydevd’.

fpname:

The file path name of the main file for the current process, default:=callname.

label:

The label identifying the current process, default:=callname.

noargv:

Suppresses argv processing completely for the previous arguments. The testflags are still processed.

rdbg:

Same as ‘–rdbg’, for additional processing see ‘noargv’.

rdbgsrv:

Same as ‘–rdbg’srv, for additional processing see ‘noargv’.

rdbgforward:

Same as ‘–rdbg-forward’, for additional processing see ‘noargv’.

rdbgroot:

Same as ‘–rdbg-root’, for additional processing see ‘noargv’.

rdbgsub:

Same as ‘–rdbg-sub’, for additional processing see ‘noargv’.

testflags:

Flags to force specific behaviour - mostly faulty - in order to test the module itself. So, do not use these if you do not know what these actually do.

These partially fail, but provide a sufficient part of the control flow for the aspect of interest.

ignorePydevd:

Debugging the initial bootstrap of an simulated external process. Ignores present loaded debug support. For debugging of the debug support.

ignorePydevdSysPath:

Debugging the initial bootstrap of an simulated external process. Ignores load by current ‘sys.path’. For debugging of the debug support.

ignorePydevdCallParam:

Debugging the initial bootstrap of an simulated external process. Ignores current parameter for load. For debugging of the debug support.

verbose:

Display data for user parameters.
Returns:
Creates a proxy instance.
Raises:
passed through exceptions:

scanEclipseForPydevd

setDebugParams

PyDevRDC.setDebugParams(**kargs)[source]

Sets the parameters for debug.

Args:
**kargs:

host:

Hostname where the debug server is running.

From pdevd.py: The user may specify another host, if the debug server is not in the same machine (default is the local host).

ignore:

When set to False success is mandatory, else an exception it raised. Set this to True/default, when in production systems.

port:

Port the debug server is listening on. From pdevd.py: Specifies which port to use for communicating with the server (note that the server must be started in the same port). Note: currently it’s hard-coded at 5678 in the client

pydevdpath:

Required path pointing to directory for source of pydevd in PyDev subdirectory tree.

remotedebug:

Switches remote debugging support On/Off.

stderrToServer:

Sets whether stderr is directed to debugserver. From pdevd.py: When this is true, the stderr is passed to the debug server so that they are printed in its console and not in this process console.

stdoutToServer:

Sets whether stdout is directed to debugserver. From pdevd.py: When this is true, the stdout is passed to the debug server.

suspend:

If set to True, stops immediately after settrace() call, else at next valid break-condition. From pdevd.py: Whether a breakpoint should be emulated as soon as this function is called.

trace_only_current_thread:

From pdevd.py: Determines if only the current thread will be traced or all future threads will also have the tracing enabled.
Returns:
The location of pydevd.py
Raises:
AttributeError:

setFork

PyDevRDC.setFork()[source]

Prepares debugging after fork.

startDebug

PyDevRDC.startDebug(**kargs)[source]

Starts remote debugging for PyDev.

stopDebug

PyDevRDC.stopDebug()[source]

Stops remote debugging for PyDev.

__str__

PyDevRDC.__str__()[source]

Prints current remote debug parameters.

__repr__

PyDevRDC.__repr__()[source]

Prints the current representation of remote debug parameters.

Exceptions

exception epyunit.debug.pydevrdc.PyDevRDCException[source]
exception epyunit.debug.pydevrdc.PyDevRDCLoadException[source]

Failed load of ‘pydevd.py’.

exception epyunit.debug.pydevrdc.PyDevRDCServerException[source]

Debug server of PyDev is not running - cannot be reached.