As an extension, the question “ Change / view static variables when debugging in Eclipse ” arises, I would like to be able to change static variables when debugging in Eclipse.
For example, and local variables, I can simply select a variable in the Eclipse Variables view and use the "Change Value ..." context menu to change the value.
This is not possible for any static variables, as they do not appear in the Variables view.
What I tried:
- If you select Java / Show Static Variables from the triangles menu in the Variables view, you can see and change the static member variables of the variables listed in the Variable View. However, I did not find how to access the static member of a class whose instance does not appear in the Variables view.
- You can, of course, enter a static member as an expression in the "expression representation" (using the full name). Then you can see the value, but the "representation of the expression" does not have the ability to change the value (it allows you to change the elements of the expression, but not the expression itself, even if the expression is a field).
So, if I have a static variable like a logical MyClass.disableAllBugs, is there a way to change MyClass.disableAllBugs during debugging?
On the sidelines: I understand that even having public mutable static fields (i.e. mutable global variables) is very bad. But some codebases have it, and then it is sometimes useful to modify it during debugging.
variables debugging eclipse static
sleske
source share