6

Is there a way, using the eclipse debugger, to break any time a particular variable is written to?

The only thing I can think of is to manually set a breakpoint at every reference but my codebase is several million lines and I really don't want to do that.

3
  • Once you reach a breakpoint you can just step through, isn't that enough?
    – Lucas
    Dec 19, 2014 at 15:12
  • 1
    @Lucas step through several million of lines?
    – ewok
    Dec 19, 2014 at 15:15
  • stackoverflow.com/a/1710013/1599699
    – Andrew
    Jun 13, 2017 at 15:56

2 Answers 2

6

You can set a watchpoint at the desired variable. Simply click on the line where the variable is declared, and select Run -> Toggle Watchpoint.

The watchpoint can break on either accessing the variable, modifying the variable, or both.

2
  • @ewok Is it a local variable or a field? I guess local variables are not supported by watchpoints.
    – M A
    Dec 19, 2014 at 15:19
  • 2
    Just removed that comment as Toggle Breakpoint only adds watchpoints on fields. Can't find a way to enable Toggle Watchpoint. Dec 19, 2014 at 15:38
1

Use the Expressions View functionality from the Eclipse Debugger.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.