简体   繁体   English

在eclipse调试器中查看全局/静态/继承变量

[英]view global/static/inherrited variables in eclipse debugger

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. 当我调试程序时,我可以看到直接范围内的变量,但我看不到变量是全局的,静态的,或者是由'this'类继承的变量。 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 谢谢

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. 扩大为入门thisVariables在查看Debug Perspective应该让你查看所有的(非静态)成员已经是,默认情况下。

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 要查看常量和静态成员,请在Variables视图的菜单中(通过单击视图右上角的小向下箭头打开),选择Java > Show Static VariablesShow Constants

显示静态变量

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. 另一个方便的视图是Displays View ,它允许您执行任意代码。

在Debug Perspective中,打开Variables视图,单击窗格右上角的向下箭头,然后选择Java / Show Static Variables

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM