ActiveState Powered by ActiveState

ActiveState Community


Komodo IDE debugger proxy "pydbgpproxy"

Posted by ToddW on 2007-11-05 17:45
OS: All / Any | Product: Komodo | tags: debugging proxy
Question:
  • Why would I want to use the proxy service for debugging?
  • So how does debugger proxing work?
  • How do I setup the Komodo DBGP proxy service for remote debugging?
  • How do I start debugging with my selected Komodo application?
Answer:
  • Why would I want to use the proxy service for debugging?
    Note that it is *not* a requirement to use the DBGP proxy for remote debugging applications with Komodo. The proxy is useful when:

    • you have multiple users running the same server/application who wish to be able to debug independantly
    • the network requirements do not allow a direct TCP/IP connection between the application being debugged and the Komodo IDE, so you need to channel through a common proxy.
  • So how does debugger proxing work?
    • The proxy is started first, and listens on two separate ports.
    • Komodo connects to the proxy on one port to tell it the specific proxy key Komodo is using, as well as the IP address and port number Komodo is listening on.
    • The application being debugged connects to the proxy on the other proxy port when it starts a debugging session, sending the required ide key.
    • The proxy service checks the idekey (proxy key) given by the application being debugged and tries to match it to the connected Komodo session(s). If one matches, then the proxy tries to initiate a connection to this Komodo application and if successful the debug session is passed on to Komodo. When no match is found, the debug session is ignored.
  • How do I setup the Komodo DBGP proxy service for remote debugging?
    • You'll need Python installed.
    • You can download the remote debugging package here, note that the proxy is located as part of the Python debugging package: ftp://ftp.activestate.com/Komodo/RemoteDebugging
    • Start the proxy, note that the DBGP proxy service can be running anywhere (a linux machine, windows, mac...), as long as both the application/server to be debugged and Komodo IDE have TCP/IP access to connect to this proxy instance and vice-versa. I'll call the machine "mymachine" in the examples below. Here is the command to start the proxy "dbgpproxy -i IDE-PORT -d DEBUG-PORT":
      dbgpproxy -i 9001 -d 9000

      The IDE-PORT is where Komodo will to connect with the proxy and the DEBUG-PORT is where the application being debugged will connect to the proxy (see details below).

    • Komodo IDE will need to be configured and connect to this proxy service. Go to Komodo's preferences, then select the "Debugger->Connection" category, it does not matter what port Komodo is configured to listen upon (either a system-provided free port or a specific port is fine). Check the "I am running a debugger proxy and Komodo should use it." checkbox, then fill in the Proxy Listener Address, which is the IP address of where the proxy is running, i.e. "mymachine:9001". Set the proxy key to any string value you wish, I'll use "myname" (without the quotes) for the example.
    • Configure the application/server settings to connect to the proxy server, the details of this will be different between languages, but here are some examples:
      # Python
        pydbgp -d myname:9000 -k myname my_python_code.py
        # Perl
        export PERLDB_OPTS=RemotePort=mymachine:9000
        export DBGP_IDEKEY=myname
        # PHP, uses the Xdebug php.ini settings, like:
        xdebug.remote_host=mymachine
        xdebug.remote_port=9000
        xdebug.idekey=myname
        # Start your PHP debug session in your browser as you normally would, appending the xdebug string to the url "?XDEBUG_SESSION_START=myname"
    • Note that if you do not specify an proxy/IDE key when debugging, the user/username of the debugging process will be used.
  • How do I start debugging with my selected Komodo application?
    • You'll need to define your IDE key, this sets the Komodo application you wish to connect to and must match the Proxy Key setting you have placed in your Komodo debugging preferences. The key is defined and passed to the debugging proxy differently, depending upon the language your debugging. Some examples below:
      # Python, -k sets the proxy key
        pydbgp -d myname:9000 -k myname my_python_code.py
        # PHP, start your PHP debug session in your browser as you normally would, appending the xdebug string to the url:
        ?XDEBUG_SESSION_START=myname
        # the name after the equals sign "myname" represents the IDE key
    • When you do not define the ide key, the debugging client will use the username as the key, making use of the "USER" and "USERNAME" environment variables as necessary.

Additional configurations and settings for remote debugging can be found in Komodo's application help menu.

-->