本地声明的变量无法检查 [英] Locally declared variables can not be inspected

查看:104
本文介绍了本地声明的变量无法检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时,当我在Eclipse中调试代码时,尽管我可以毫无困难地看到和检查类成员变量,但我无法检查在函数内本地声明的变量的值。除此之外,当前函数的任何参数都会丢失其真实名称,而是将其在Variables窗口中列出的值视为arg0,arg1,arg2等,但至少值可见。

Sometimes when I am debugging code in Eclipse it happens that although I can see and inspect class member variables without any difficulty I am unable to inspect the values of variables declared locally within functions. As an aside, any parameters to the current function lose their 'real' names and instead one sees their values listed in the Variables window as arg0, arg1, arg2, etc but at least the values are visible.

目前正在发生与核心JDK中定义的类有关的内容。我已经证实安装的和当前的JRE是一个JDK。

This is occurring at present in relation to classes defined within the core JDK. I have verified that the installed and current JRE is a JDK.

有没有人能够清楚这个行为?

Is anybody able to shed some light on this behaviour?

推荐答案

显然,答案是:


附带JDK(核心Java类所在的地方)没有编译的rt.jar完整的调试信息包含在.class文件中,所以调试器没有本地变量信息。

the rt.jar that ships with the JDK (where the core Java classes live) is not compiled with full debug information included in the .class files, so the debugger does not have local variable info.

不幸的是,这不是Eclipse可以做的事情 - 所有的调试器将有与JDK核心类相同的问题。

Unfortunately, this is not something that Eclipse can do anything about - all debuggers will have the same problem with JDK core classes.

Eclipse 3.4的发行说明指出:


缺少调试属性

调试器要求c如果能够显示行号和局部变量,则使用调试属性编译lass文件。很多时候,类库(例如rt.jar)被编译而没有完整的调试属性,因此这些类的局部变量和方法参数在调试器中是不可见的。

Missing debug attributes
The debugger requires that class files be compiled with debug attributes if it is to be able to display line numbers and local variables. Quite often, class libraries (for example, "rt.jar") are compiled without complete debug attributes, and thus local variables and method arguments for those classes are not visible in the debugger.

这篇关于本地声明的变量无法检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆