Saturday, September 01, 2007

Debugging Eclipse

Right now it appears that Eclipse sporadically does not shut down correctly for me: some times it is loosing my view configurations (they are not saved as they should be) and a process keeps running in the background.

Also, I can't seem to reproduce it reliably: it just happens in my production environment after running Eclipse for quite some time... usually after 1 or 2 days open.

So, I've been looking for a way to debug the Eclipse shutdown to see if there's something odd there, and the best way I was able to find is starting Eclipse with some debug flags:

-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n

And later, I can attach a debugger to that running instance (in my case, I'll start another Eclipse process and debug it using the 'remote java application' configuration in the run dialog).

The downside is that it is a bit slower to run Eclipse (but just a bit) and I'm not sure if using those options will make the vm unstable or not, but at least I'll be able to debug things in a production environment!

Or maybe there's a better way to do it?

Some useful references I found about it:

Eclipse remote debugging
Getting runtime info (as a snapshot) on a vm