view global/static/inherrited variables in eclipse debugger
Solution 1
You can use the Expression View to watch an arbitrary expression, including static and global variables.
Another handy view is the Displays View, which allows you to execute arbitrary code.
Solution 2
Expanding the entry for this
in the Variables
view in the Debug Perspective
should let you view all of those (non-static) members already, by default.
To view constants and static members, in the Variables
view's menu (opened by clicking the little down arrow at the top right of the view), choose Java > Show Static Variables
or Show Constants
Solution 3
In the Debug Perspective, open the Variables view, click on the downward pointing arrow at the top right of the pane and select Java / Show Static Variables
drew
Updated on June 13, 2022Comments
-
drew almost 2 years
This is a minor annoyance for me that keeps coming up. When I'm debugging a program I can see variables in the immediate scope, but I can't see variables which are global, static, or variables inherited by 'this' class. The only way I know how to get these values for testing is to create a dummy variable to store the variable I want within scope of a given function, which isn't efficient or elegant.
Is there an easier way to see the value of any/all of the three variable types I mentioned while stepping through the debugger?
Thanks
-
drew about 13 yearsthank you, that is exactly what I need. I feel kind of stupid that I wasn't able to find that on my own
-
no.good.at.coding about 13 yearsTo tell you the truth I had to Google it also! Now we both know :)
-
FDIM over 10 yearsLong annoyance finally gone, thanks! Don't know why I didn't google for this before..