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.

 
Java

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

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of allelopath
allelopath

ASKER

That's a good idea, but leads to another question, which I will post shortly.
Avatar of allelopath
allelopath

ASKER

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?
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

What happens when you do it with your own new subclass?
Avatar of allelopath
allelopath

ASKER

Haven't had time to get back to this. Will close now and ask again if necessary.
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

:)
Java
Java

Java is a platform-independent, object-oriented programming language and run-time environment, designed to have as few implementation dependencies as possible such that developers can write one set of code across all platforms using libraries. Most devices will not run Java natively, and require a run-time component to be installed in order to execute a Java program.

102K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo