Skip to content

Remote Custom Script Debugging#

The following guide will explain how to debug custom interception scripts.

Prepare Eclipse#

  1. Install the PyDev Eclipse plugin from the Eclipse Markeplace
  2. Open Debug perspective
  3. Start the remote debugger server by navigating to Menu > PyDev > Start Debug Server

Prepare CE#

  1. Log into the CE chroot container
  2. Change directory into the opt folder: cd /opt
  3. Download pydevd-1.1.1.tar.gz or later
  4. tar -xzf pydevd-1.1.1.tar.gz
  5. rm -rf pydevd-1.1.1.tar.gz
  6. ln -sf /opt/pydevd-1.1.1 /opt/pydevd

Enable Remote Debug in Custom Script#

  1. After the import section, add:

    ```
    REMOTE_DEBUG = True
    
    if REMOTE_DEBUG:
        try:
            import sys
            sys.path.append('/opt/pydevd')
            import pydevd
        except ImportError as ex:
            print "Failed to import pydevd: %s" % ex
            raise
    ```
    
  2. Add the following lines wherever breakpoints are needed:

    ```
    if REMOTE_DEBUG:
        pydevd.settrace('DEV_IP', port=5678, stdoutToServer=True, stderrToServer=True)
    ```
    

Start Flow to Trigger Breakpoint#

  1. Enable script
  2. Start authentication process
  3. After executing line with pydevd.settrace, Eclipse should show a dialog to select script source
  4. Select the appropriate script file and debug

Additional Resources#

  1. Remote debugger