Eclipse在调试时跳过线 [英] Eclipse skipping lines while debugging

查看:170
本文介绍了Eclipse在调试时跳过线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是java和eclipse的新手,我一直在尝试在设备上调试一个android应用程序。它是一个带有jar文件参考的小项目。我读了类似的问题,但没有帮助。



我需要的是调试jar文件的源代码,所以我附上了源代码(其中我使用反编译器获得),我可以进入库的源代码,所以我以为我做的正确。但是我不能成功地调试这些源代码;在调试模式下,它跳过断点(只有连接到jar文件的源文件中),当我尝试进入代码时,它会随机跳过跳线跳线。



我正在使用最新版本的eclipse,android sdk和jdk。我不知道是什么原因导致这个问题,我想知道。



提前谢谢,我希望我能够充分解释。

解决方案

问题是,您无法反编译类文件进行调试。因为反编译文件的行将不同于原始的Java源代码行(想象:真正的源代码有一些注释和其他不会被编译到类文件中的东西)!



所以,如果您的Eclipse显示当前调试行 42 ,那么它只会告诉你,调试器会向你显示 42 类文件中的代码行。这不符合您的反编译的java源文件。



但是,您可以使用选项将行号作为注释反编译类文件。评论中的这些行号可以与实际的stacktrace行号进行比较。这可以帮助你一点点想象这个问题。



编辑:作为 Laurent B 推荐,你会可以使用 JD-Eclipse 重新对齐代码,请参阅: http:// mchr3k.github.io/jdeclipse-realign/



+1的评论! :)



edit2:如果类文件使用标记 - g:无


-g:none

不生成任何调试信息。


所以如果是这种情况:尝试找到您的jar文件的原始源代码!


I am new to both java and eclipse, I have been trying to debug an android app on a device. It is a small project with a jar file reference. I read similar questions but they didn't help.

What I need is to be able to debug the source codes of the jar file so I attached the source codes ( which I obtained using a decompiler ) and I am able to go into source codes of the library so I thought I did that correctly. But I can not succeed in debugging into these source codes; in debug mode it skipps breakpoints (only the ones in the source files which are attached to jar file) and when I try to 'step into code' it goes to random lines skips lines when debugging.

I am using the latest versions of eclipse, android sdk and jdk. I don't know what causes this problem and I'd like to know.

Thanks in advance, I hope I explained sufficiently.

解决方案

The problem is, that you can't decompile the class files to debug it. Because the lines of the decompiled files will differ to the original Java source code lines (imagine: the real source code has some comments and other things which will not be compiled into class files)!

So, if your Eclipse shows you the current debug line 42, then it only tells you, that the debugger will present you the 42th line of code in the class file. This won't match your decompiled java source file.

However, you could decompile the class files with the option add line numbers as comments. These line numbers in comments you can compare to the actual stacktrace line numbers. This could help you a little bit to imagine the issue.

edit: as Laurent B recommended, you will be able to realign the code with JD-Eclipse, see: http://mchr3k.github.io/jdeclipse-realign/

+1 for the comment! :)

edit2: You won't be able to decompile with line numbers if the class files are compiled with the flag -g:none:

-g:none
Do not generate any debugging information.

So if this is the case: try to find the original source code of your jar file!

这篇关于Eclipse在调试时跳过线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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