/geben

DBGp debugger for Emacs

Primary LanguageEmacs LispGNU Lesser General Public License v2.1LGPL-2.1

GEBEN

Note: this is a fork with minor usability improvements, the changes are listed here.

GEBEN is a software package that interfaces Emacs to DBGp protocol with which you can debug running scripts interactive. At this present DBGp protocol are supported in several script languages with help of custom extensions.

  • PHP with Xdebug 2.0.*
  • Perl, Python, Ruby and Tcl with Komodo Debugger Extensions

Currently GEBEN implements the following features.

  • continuation commands: run/stop/step-in/step-over/step-out
  • set/unset/listing breakpoints
  • expression evaluation
  • STDOUT/STDERR redirection
  • backtrace listing
  • variable inspection

Requirements

[server side]

  • DBGp protocol enabled script engine, like:
    • PHP with Xdebug
    • Python with Komode Debugger Extension
    • etc.

[client side]

  • Emacs22.1 or later

Installation

[server side]

[client side]

  1. Unpack GEBEN source code package and change directory to the unpacked directory.

    <With GNU make command> a. run `make’(or `gmake’, depends on your environment). b. If you are an administrator, Run: sudo make install b’ Or Run: SITELISP=$HOME/path/to/install make install

    <Without GNU make command> a. Byte compile ‘dbgp.el’. b. Byte compile `geben.el’. c. Copy `dbgp.elc’, `geben.elc’ and entire `tree-widget’ directory to any directory where Emacs can find.(Or add the path to `load-path’ list)

  2. Insert autoload hooks into your .Emacs file. -> (autoload ‘geben “geben” “PHP Debugger on Emacs” t)
  3. Restart Emacs.

Debugging

Here is an illustration on PHP debugging.

  1. Run Emacs.
  2. Start geben, type: M-x geben
  3. Access to the target PHP script page with any browser. You may need to add a query parameter `XDEBUG_SESSION_START’ if you configured Xdebug to require manual trigger to start a remote debugging session. e.g.) http://www.example.com/test.php?XDEBUG_SESSION_START=1

    Adding those keys manually can be a chore, instead you can use The easiest Xdebug plugin for Firefox.

  4. Soon the server and GEBEN establish a debugging session connection. Then Emacs loads the script source code of the entry page in a buffer.
  5. Now the buffer is under the minor-mode ‘geben-mode’. You can control the debugger with several keys:
    spcstep into/step over
    istep into
    ostep over
    rstep out
    grun
    crun to cursor
    bset a breakpoint at a line
    Bset a breakpoint interactively
    uunset a breakpoint at a line
    Uclear all breakpoints
    \C-c bdisplay breakpoint list
    >set redirection mode
    \C-u tchange redirection mode
    ddisplay backtrace
    tdisplay backtrace
    vdisplay context variables
    \C-c fvisit script file
    wwhere
    qstop

    When you hit any unbound key of `geben-mode’, GEBEN will ask you to edit the original script file. Say yes and GEBEN will attempts to load the script file via `TRAMP’.

  6. If you felt you’d debugged enough, it’s time to quit GEBEN. To quit GEBEN, type: M-x geben-end

What’s new

  • Saner window management was implemented. GEBEN no longer pops so many buffers.
  • Multi-session debugging is enabled by default. Currently this only works when the dbgp proxy is used.
  • Calling geben-where outside of a geben session jumps to the first open session.
  • Calling geben-where within a buffer with the current breakpoint jumps to the next open session.
  • The output window is no longer popped every time after execution. This is controlled by a new custom geben-dbgp-display-redirect-window.
  • New function geben-find-this-file. When geben session is active, executing this function opens the current file in the debug mode.
  • GEBEN no longer breaks network connectivity in packages like erc.
  • There are unit tests now. Dummy dbgp engine was implemented to help with unit testing.

Support

Geben was orignally hosted on Google Code. Since it was closed, the official repository seems to be this.

Known issues

  • Xdebug does not support STDERR command feature so that STDERR redirection feature does not work expectedly.
  • Xdebug does not implement `dbgp:’ scheme feature so that with `step-in’ command into a lambda function (you can create it with `create_function’ in PHP) the cursor position is located at invalid line.
  • Xdebug may tell invalid line number on breaking by `return’ type breakpoint. To this case GEBEN indicates the cursor at the top of the file in where the current breakpoint exists.
  • Xdebug unexpectedly breaks on returning from class/instance method if there is a `call’ type breakpoint to the method.
  • If Xdebug is not loaded not as `zend_extension’, some feature do not work as expectedly (e.g. step_into).

Original authors

reedom <fujinaka.tohru@gmail.com>