I would like to know if when debugging in Eclipse, is there a feature/way to focus on a variable and "back-track" where the variable got its value..? I hope I'm being clear enough, but I can see if this appears as a weird question.
The thing is, I have two similar classes, both using a @Resource instance of the same class. One of the classes runs fine but the other one gets a NullPointerException for the instance variable in question. And I can't see how this is. So if you know a way to "back-track" in the Eclipse debugger to see "how old" and where a value in a variable is set I would greatly appreciate it!
And if there's no such feature for some obvious reason and this question in stupid I apologize in advance...
You'd have to set a field breakpoint on the field in question before the value is set and catch it when it happens. "Standard" debuggers don't have the back-in-time feature. Omniscient debuggers do, though. These record every single action taken by a VM so that you can ask these kinds of questions at any point during execution. They're not widely used and have understandably high performance penalties. There are at least a couple of open source ones out there: TOD and ODB.
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