Eclipse Tips: Debugging your multi thread application (2)

This post is another tips of debugging your multi thread application. If you are interested on how to debugging a multi thread application, probably you will find my first post useful as well.

In a multi thread application, it’s still possible to use a certain class from different threads. The problem is if you try to set a breakpoint in this shared class, the breakpoint will be valid for all threads. This is typically just slowing our debugging session.

With Eclipse, you can set a breakpoint that only valid in certain threads. The catch is since there is no way that Eclipse knows what threads will be available, you can only set this on runtime.

To do this, you need to first set the breakpoint you want (remember, you probably need to Suspend the VM as well).

After that, you can start the debugging session and wait until the application is suspended. In this occasion, let open the breakpoint properties. In this window, there are two elements in the left tree: Breakpoint Properties and Filtering. Select Filtering and after that you can set to which thread the breakpoint should be valid for.


There are two more catches.

  • If the intended thread is not running yet, this method is not usable.
  • Every time the debugging session is restarted, you’ll need to filter it again.

Despite that catches, I think this is nice feature to know by multi-thread application developers and who know, it may be useful sometime in the future.

Leave a comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.