Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set a breakpoint for when variable changes in Eclipse?

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.

like image 784
ewok Avatar asked Mar 18 '23 14:03

ewok


2 Answers

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.

like image 102
M A Avatar answered Mar 20 '23 02:03

M A


Use the Expressions View functionality from the Eclipse Debugger.

like image 27
Georgian Avatar answered Mar 20 '23 03:03

Georgian