简体   繁体   English

检查Java字节码是否包含调试符号

[英]Check if Java bytecode contains debug symbols

I would like to know how can I check if a compiled Java class contains debug symbols. 我想知道如何检查编译的Java类是否包含调试符号。 The problem is that I compile an application from ant with debug="on", but a specific JVM throws an exception: it says that the debug symbols are missing. 问题是我使用debug =“on”从ant编译应用程序,但是特定的JVM会抛出异常:它表示缺少调试符号。

Thanks. 谢谢。

If you run javap -v on the class file, you will see the debug information that is present in the file. 如果在类文件上运行javap -v ,您将看到文件中存在的调试信息。

It is worth compiling a simple test class with different -g option settings and looking at the results with javap . 值得编译一个带有不同-g选项设置的简单测试类,并使用javap查看结果。

If, you need to know exactly how javap presents the information, it is it is best for you to try it out in your Java installation. 如果,您需要确切了解javap如何呈现信息,那么最好在Java安装中进行尝试。 The output from the javap command may vary between different Java versions. javap命令的输出可能因Java版本的不同而不同。

具有调试信息的类文件最重要的是LineNumberTable,它将字节码指令映射到源行号和LocalVariableTable,它告诉调试器您的本地变量,包括方法的参数在执行期间驻留在VM中。

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

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