How can I easily detect when a variable changes value? I would like the execution of the program to break on the debugger whenever a specified variable changes value. Right now I'm using Eclipse's debugger.
How can I easily detect when a variable changes value? I would like the execution of the program to break on the debugger whenever a specified variable changes value. Right now I'm using Eclipse's debugger.
For a class or instance variable
I'm not sure about Eclipse, but in IntelliJ IDEA, you can right click on a break point and add the conditions, just like you would in an if statement. Then, the debugger only pauses at the break point if its condition is true.
For instance, in this case it only stops if min == 4.