<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: debugger.xml 17299 2012-10-10 23:47:33Z joewiz $ --><book><bookinfo><productname>eXist-db – Open Source Native XML Database</productname><title>Server-side debugging with eXist-db</title><date>September 2009</date><author><firstname>Dmitriy</firstname><surname>Shabanov</surname>
            <!--affiliation>
                <address format="linespecific"><email>wolfgang at exist-db.org</email></address>
            </affiliation--></author></bookinfo><chapter><title>Debugger</title><para>Starting with eXist-db release 1.4 the database provides an facility to debug xquery code on the server.
            This document descibes how to build this extension, and how to configure your editor to work with the
            extension.</para><section><title>Compile</title><para>The following steps are required to enable the debugger interface: <procedure><step><para>Enable the debugger in <filename>$EXIST_HOME/extensions/local.build.properties</filename>: by adding
                                <emphasis>include.feature.debugger = true</emphasis>. Create the document if does not exist.</para></step><step><para>Download the required jar files.</para></step><step><para>Recompile eXist-db: <synopsis format="linespecific">build.sh</synopsis></para></step></procedure></para></section><section><title>Setup your editor</title><para>Currently two editors can use the debugger interface: Emacs and VIM. </para><section><title>Emacs</title><para>First you need to install <ulink url="http://code.google.com/p/geben-on-emacs/">geben</ulink>.
                    When installed you can start geben with "Meta-x geben"</para><para>Run your XQuery script in the debug mode:
                        <filename>http://www.example.com/script.xql?XDEBUG_SESSION_START</filename> or you can use the
                        <ulink url="https://addons.mozilla.org/en-US/firefox/addon/3960">Xdebug Helper</ulink> add-on
                    for Firefox. </para><para>If every thing was done correct you should see <filename>script.xql</filename>. Available commands
                    are: <variablelist><varlistentry><term>spc</term><listitem><para>step into/step over</para></listitem></varlistentry><varlistentry><term>i</term><listitem><para>step into</para></listitem></varlistentry><varlistentry><term>o</term><listitem><para>step over</para></listitem></varlistentry><varlistentry><term>r</term><listitem><para>step out</para></listitem></varlistentry><varlistentry><term>b</term><listitem><para>set a breakpoint at a line</para></listitem></varlistentry><varlistentry><term>u</term><listitem><para>unset a breakpoint at a line</para></listitem></varlistentry><varlistentry><term>g</term><listitem><para>run</para></listitem></varlistentry><varlistentry><term>q</term><listitem><para>stop</para></listitem></varlistentry></variablelist></para></section><section><title>VIM</title><para> To debug with vim you have to install the <ulink url="http://www.vim.org/scripts/script.php?script_id=1152">remote debugger interface</ulink> for
                    the <ulink url="http://xdebug.org/docs-dbgp.php">DBGp</ulink> protocol. In the editor you can press
                    &lt;F5&gt; and browse xquery file in debug mode within 5 seconds</para></section></section></chapter></book>