如何使用Eclipse检查调试符号状态? [英] How can I check on debug symbol status with Eclipse?

查看:119
本文介绍了如何使用Eclipse检查调试符号状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在讨论另一个问题我问,@Aaron Digulla指出以下内容:


如果安装了Java SDK,应该有一个src.zip文件在Java安装的根目录中。如果没有,再次下载Java。当您打开类型JTable(或当您点击堆栈跟踪中的行)时,Eclipse应自动找到源并显示给您。


文件 src.zip 存在于我,但我仍然无法访问 JTable的来源


未知来源让我担心,
。这意味着您的Java
版本没有调试符号。确保
,您a)使用SDK,而
开发,b)您的SDK包含
调试符号,c)不要告诉
命令java去删除调试符号
加载类时


a)我使用的是Eclipse,为什么不使用SDK? / p>

b)如何知道我的SDK是否包含调试符号?如果没有,我如何添加它们?



c)如何检查Eclipse是否告诉 java 删除调试符号?



对于这些平淡的问题抱歉,但我觉得我完全不了解Java开发过程。

$ b $ a)Eclipse自带的Java编译器,因此如果您使用的是Java运行时环境,则不会遇到许多问题,除了附加功能像jarsigner,可能还缺少JRE源代码。验证您的安装的最佳方法是通过您的软件包管理器;但是,如果您通过其他方式安装,仔细的目录观察通常可以区分两者(见下文)。



b)JRE库通常在没有调试符号存在的情况下编译。 SDK库通常拥有它们。通过使用打开调试端口的命令行选项启动JVM来完成Java调试。 SDK通过该端口与JVM请求断点。稍后,如果您决定执行JVM,它也会通过此端口发送step / jump / rewind调试命令。 调试符号实际上是JVM字节码表,它引用了源代码在一个特定的字节码指令开始生效。这允许调试器将运行的字节码与原始源代码中的行号相关联。



c)通过(从菜单)验证它 - 窗口 - >首选项(在选择器上列)展开Java,展开Java下的构建路径,并选择ClassPath变量。您将看到一些变量,其中包括一个称为JRE_SRC的变量,它们应该指向包含公共面向JRE库源代码的src.zip文件。同时验证JRE_LIB是一个好主意。



JDK主目录通常包含一个bin子目录和jre子目录,所以如果你只看到一个bin子目录,那么你在JRE主目录中的几率是很好的。有了这个知识,希望你能够弄清楚。


While discussing another question I asked, @Aaron Digulla pointed out the following:

If you installed the Java SDK, there should be a "src.zip" file in the root directory of the Java installation. If it's missing, download Java again. Eclipse should find the source automatically and show it to you when you open the type JTable (or when you click on the line in the stack trace).

The file src.zip is present for me, but I still can't access the source of JTable like @Aaron said. What could be the problem? How can I solve this with Eclipse?

The "Unknown Source" worries me, though. it means your version of Java doesn't have debug symbols. Make sure that you a) use a SDK while developing, b) that your SDK contains debug symbols, c) don't tell the command java to strip debug symbols when it loads classes.

a) I'm using Eclipse, why shouldn't I being using SDK?

b) How do I know if my SDK contains debug symbols? And if it doesn't, how can I add them?

c) How can I check if Eclipse is telling java to strip debug symbols?

Sorry for these banal questions, but I feel like I don't fully understand the Java development process.

解决方案

a) Eclipse comes with it's own Java compiler, so if you are using the Java Runtime Environment, you won't run into many issues, except that extras like jarsigner and possibly the JRE source code may be missing. The best way to verify your installation is through your package manager; however, if you installed by some other means, careful directory observation can usually differentiate the two (see below).

b) JRE libraries are typically compiled without debugging symbols present. SDK libraries typically have them. Java debugging is done by starting the JVM with command line options which open a debugging port. The SDK talks to the JVM requesting breakpoints be set through this port. Later if you decide to step the JVM, it also sends the step / jump / rewind debugging commands through this port. The "debugging" symbols are actually JVM bytecode tables, which reference which line of source code is in effect starting at a particular bytecode instruction. This allows debuggers to associate the running bytecodes with line numbers in the original source code.

c) Verify it by (from the menu) Window->Preferences (on the selector column) expand "Java", expand "Build Path" under "Java", and select "ClassPath variables". You will see a few variables, including one called "JRE_SRC", which should point to the src.zip file containing the public facing JRE library source code. It is a good idea to verify JRE_LIB at the same time.

A JDK home directory typically contains a "bin" sub-directory and a "jre" sub-directory, so if you only see a "bin" sub-directory, odds are good you are in a JRE home directory. With this knowledge, hopefully you'll be able to figure the rest out.

这篇关于如何使用Eclipse检查调试符号状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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