Pages

Scope your breakpoints!

For something so simple, a breakpoint, this feature gave me a lot of headaches over the years. One off the things I find most frustrating is when I set a breakpoint in my source code and the debugger doesn’t stop on it. Recently a co-worker pointed out some great feature in the JDeveloper IDE: You can scope your breakpoints.

When working with small projects and workspaces for different functionality, we use a lot of libraries to include our jars, sources and docs. If you have a java file open from a different workspace, the debugger won’t always stop. 

The first sign is the red bullet without a green check in it. 

 

However, remember that if the class isn’t loaded by the compiler yet, the green check will also not show. If you know for sure that the code has been fired, for example because you see logging, but the debugger doesn’t stop there and the bullet is still red without a green check, scoping might be the answer!

One option is to Scope an individual breakpoint, you can do this in your breakpoints view, right click on it and go to Change Scope, then select a different scope. The default is Workspace, I suggest you put it on Global.


Now, I can’t imagine why you would want something else then the Global scope, so luckily the JDeveloper IDE has a preference to set for this.
Go to Preferences -> Debugger -> Breakpoints, and you can change the scope for all your future breakpoints.


This will result in happy green checks on your red bullets!

No comments:

Post a Comment