How to configure an Eclipse watchpoint to activate when an object / primitive changes?

I am trying to reorganize some pretty terrible code at the moment. It bypasses objects very confusingly, I cannot track and, apparently, directly access primitives inside objects in some other place in the code. I am trying to figure out how I can use the debugger to find out when / where the object of interest to me is used after it is transferred to the tangled black box of code that passes these objects.

What I would like is a way to set watchpoints that break when an object (or primitive) changes. I know that watchpoints can be set to variables, but that’s not what I want. The variable pointing to the object of interest to me disappears at the end of the function call, I want to continue to track the object after this function returns.

Can someone tell me if Eclipse has this feature? I am using Helios.

thanks

+6
java eclipse ide breakpoints
source share
1 answer

You can set the watchpoint in each field of the class you are interested in.

Alternatively, you can find all the places in the source that refer to a specific field using the call hierarchy (click on the field and press Ctrl-Alt-H). This has the advantage that you not only find which field was accessed in a particular program execution, but also for all possible executions.

Note that none of the methods will be noticed when accessing the field using reflection.

+3
source share

All Articles