Link to home
Start Free TrialLog in
Avatar of allelopath
allelopath

asked on

Eclipse: set breakpoint when value changes - II

I've got a HashMap. Looking at in the Eclipse Expressions view, it looks like so:
- "tableMap" = LinkedHashMap<K,V> (id=26)
  + [0] LinkedHashMap$Entry<K,V> (id=43)
  + [1] LinkedHashMap$Entry<K,V> (id=47)
 
So at that point it is initialized.Then later it gets modified. My problem is that I can't find where this modification is happening. I would like to set a breakpoint such that the code stops when this map is written to, but I can't see how to do that.
Is there a way?

I've asked a very similar question before here:
https://www.experts-exchange.com/questions/26941506/Eclipse-set-breakpoint-when-value-changes.html
but never resolved it.

One thing that is different here is that I want to see when it changes, but don't know what it is changing to (and it doesn't really matter what is changing, just when). Also, the data within the map is changing, not the map reference itself.

One link:
http://stackoverflow.com/questions/1709929/is-there-a-way-in-the-eclipse-debugger-to-be-notified-when-the-state-of-a-java-ob
suggests:
To set a watch point, select a variable in the 'Outline' view in the 'Debug' perspective. Right click the variable, and press 'Toggle Watchpoint'. But I don't get the "Toggle Watchpoint" point when right-clicking on the variable. I do get it for variables that are of a Class, but not this map.

 
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of allelopath
allelopath

ASKER

That's a good idea, but leads to another question, which I will post shortly.
Can anyone say why I don't get "Toggle Watchpoint" when right-clicking on the the map variable, but I do get it for variables that are of a Class?
What happens when you do it with your own new subclass?
Haven't had time to get back to this. Will close now and ask again if necessary.
:)