I need to set watchpoints on Local Variables, but the problem is JDI allows ModificationWatchpoint
and AccessWatchpoint
to be set only on class/instance variables. Only approach I could think of is monitor stackframes after execution of each line, and keep current value of variables in HashTable
. So I am declaring variable modification when value changes after execution of one line and I declare variables access when value of some other variable is modified and it contains value that some other variable also contains. But there is one problem in my approach of finding variables access is suppose
x=10
z=x+30
In above case my approach will not find variable access of variable x.
So my question is is there any functionality supported by JDI to do above tasks ?