Wednesday, October 12, 2011

Debug Top-level Toolbar

Recently the platform debug team has been working on a new idea for debug-view-less debugging. We have come up with the idea of a top-level toolbar for the common debug commands; so (in theory) you can debug with needing the debug view front and center of your current perspective. The new toolbar can be activated from within the debug view using the View Menu > Debug Toolbar menu item.

The root Eclipse bug for the enhancement is bug 258767

We have already found lots of room for improvement:
bug 359151, bug 264485, bug 360172, bug 360636 and bug 360637

So for all those interested in the debug-view-less debugging idea, please spend some time and try out the new toolbar, just remember to file bugs!

The toolbar look and feel:

The debug top-level toolbar

Friday, January 14, 2011

Debugging Ant Tasks with Self Hosting

Do you know that Eclipse Ant support has debugging capabilities?

If not, check out this tutorial to get started.

Do you know how to self-host with Eclipse to test plug-ins?

If not here is a quick overview.

To debug ant tasks in a self hosted environment, the tasks must be included in a plug-in project.  If you are working with tasks outside of a plug-in development scenario, you can use remote debugging instead.  Here is a blog post to get you started.

Scenario:


You are developing an ant task to be included in an Eclipse plug-in.  You have the java code to execute the task in a plug-in that defines the task as an ant task extension in the plug-in xml.  The task runs, but the output is a bit off.  Time to start debugging.


1) Start a runtime workbench

Same as you would when debugging any other plug-in.

2) Create a new ant script

It doesn't matter what kind of project you put the script in.

Fill in the script with the proper targets and properties.  When calling your tasks, you will have to put in their full name as defined in the org.eclipse.ant.core.antTasks extension.  When running from a built jar, just the name of the class is satisfactory, but when self hosting we need the full name.

3) Create a new ant launch configuration

Right click on the script and hold down Ctrl while clicking "Debug > Ant Script".  You can also open the launch config dialog from the main menu, "Run > External Tools > External Tools Configurations".

4) Set up configuration options

Give the configuration a name.  On the JRE tab, select "Run in the same JRE as the workspace".  If you don't change this option, debugging won't work correctly.

5) Run the configuration

If there is a problem running the task, check that you have the full name of the task written in.  You can also check that Ant knows about your task by looking on the Ant > Runtime preference page (the Tasks tab will list all known tasks).

6) Start debugging

Set some breakpoints in the host workspace.  Make sure you debug your ant script (not just run it).

Note: Hot Code Replace does not work when debugging this way as the jar containing the tasks must be rebuilt.