An everyday debugging situation for Java developers is that in which an Exception is thrown and then you need to dig into the debugger to find out what threw it. Usually you would try to set up some breakpoints before the exception is thrown and hope that you are able to determine the situation that leads up to that exception.
In Eclipse, a breakpoint may have an expression defined where it is only triggered when, for example, variable x equals value y. My question is, is it possible to define some kind of global expression where, once an exception is thrown, it is caught by the debugger, allowing the programmer to inspect all variables immediately? Ideally you would not have hit the catch block yet, Eclipse would catch the exception being raised and stop execution without changing the stack contents.
Is this possible or is it limited by the JVM?
Another illustration: Eclipse Tip: Breakpoint on Exception
Eclipse let you set breakpoints based on where an Exception occurs.
You access the option via the "j!" icon in the debugging window (i.e., in the "Breakpoint View").
The official help topic "Add Java Exception Breakpoint " has more on this.
RuntimeException
is configured to suspend on subclasses, it will also be triggered by a NullPointerException
.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With