Eclipse Debug Filtering


If you use AOP, hibernate and various other projects, and you’re debugging in Eclipse, I’m sure you’ve encountered this scenario.

You hit F5 (step-into) and end up in an interceptor, which leads to another and another, and eventually you get to the line of code you actually want. Of course, I could open the file I want and do Ctrl-R (run to here), but if I forget… plus it’s extra work.

The other place is in a method, and wanting to return. Press F7 (Step Return) and end up walking back through all the interception code.

Well, Eclipse has an ‘answer’ for this. They’re called Step Filters, and can be found in preferences, Java/Debug/Step Filtering. You will likely already see some entries here, but feel free to add whatever packages/classes you don’t normally want to see when debugging. I’ve added things like:

  • org.apache.commons.logging.*
  • org.springframework.aop.*
  • org.springframework.jdbc.*

etc. I could have just added org.springframework.*, but wanted to be more specific.

Then, when debugging, ensure that Step Filtering is activated (available in the preferences, but also an icon in the Debug Perspective. Now when you do step into, step return etc, the items you’ve requested to be filtered out will be.

One thing I’ve noticed. On the preferences dialog, when you choose Add Packages…, be patient. It takes Eclipse awhile to build up the list of packages to select from, but I think it’s worth the wait…