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

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

问题描述

在讨论另一个问题时 我问了,@Aaron Digulla 指出了以下几点:

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

如果您安装了 Java SDK,Java 安装的根目录中应该有一个src.zip"文件.如果丢失,请重新下载 Java.当您打开 JTable 类型(或单击堆栈跟踪中的行)时,Eclipse 应该会自动找到源并显示给您.

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).

文件 src.zip 对我来说是存在的,但我仍然无法像@Aaron 所说的那样访问 JTable 的源代码.可能是什么问题呢?如何用 Eclipse 解决这个问题?

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?

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

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) 我使用的是 Eclipse,为什么我不应该使用 SDK?

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

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

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

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

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

很抱歉这些老生常谈的问题,但我觉得我对 Java 开发过程并不完全了解.

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

推荐答案

a) Eclipse 自带 Java 编译器,所以如果你使用 Java Runtime Environment,你不会遇到很多问题,除了额外的像jarsigner 和可能的 JRE 源代码可能会丢失.验证安装的最佳方法是通过包管理器;但是,如果您通过其他方式安装,仔细观察目录通常可以区分两者(见下文).

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 库通常在不存在调试符号的情况下编译.SDK 库通常有它们.Java 调试是通过使用打开调试端口的命令行选项启动 JVM 来完成的.SDK 与 JVM 对话,请求通过此端口设置断点.稍后如果您决定单步执行 JVM,它还会通过此端口发送单步/跳转/倒带调试命令.调试"符号实际上是 JVM 字节码表,它引用从特定字节码指令开始的有效源代码行.这允许调试器将正在运行的字节码与原始源代码中的行号相关联.

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) 通过(从菜单中)Window->Preferences(在选择器列上)展开Java",展开Java"下的Build Path",然后选择ClassPath variables"来验证它.您将看到一些变量,包括一个名为JRE_SRC"的变量,它应该指向包含面向公众的 JRE 库源代码的 src.zip 文件.同时验证 JRE_LIB 是个好主意.

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.

JDK 主目录通常包含一个bin"子目录和一个jre"子目录,因此如果您只看到一个bin"子目录,则很有可能您位于 JRE 主目录中.有了这些知识,希望您能够解决剩下的问题.

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天全站免登陆