Log in Help
Homewiki 〉 debugging-gui.html

Attaching a debugger to the GATE GUI

(This page describes the situation as of GATE 5.2.1.)

If you are building new resource implementations in Java, or especially if you are building GUI plugins, you are likely to want to be able to debug your code in the live GUI.

You can do this by adding some options to the build.xml file in the GATE installation directory.

When you launch the GATE GUI via the executable for your platform, the executable in turn launches Apache Ant. Ant executes the tasks specified in build.xml.

If you search in build.xml, you will find a few different executions of the Ant java task that launch the GUI. (Slightly different copies are used for different platforms.)

They look like:

 <java classname="gate.Main"
          .... >
    various options

To set up for debugging, you add the following XML elements as the first children of the <java> element:

 <jvmarg value="-Xdebug"/>
       <jvmarg value="-Xnoagent"/>
       <jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,address=8000"/>

These options instruct the JVM to stop and wait for a debugger connection, via TCP, on port 8000, at launch.

After launching the GUI, you instruct the debugger of your choice to make a remote debugging connection to port 8000 on the relevant host, and off you go.