Eclipse 调试 - 行:不可用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2885526/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 14:46:21  来源:igfitidea点击:

Eclipse debug - line: not available

javaeclipsedebugging

提问by Mike

I can't seem to find anything on google telling me why this might be and what the resolution is. I'm Stepping through third party code (that I have the source for) and would really like to see the current line being executed...

我似乎无法在谷歌上找到任何告诉我这可能是什么以及分辨率是什么的任何内容。我正在逐步执行第三方代码(我有源代码)并且真的很想看到正在执行的当前行...

Looking at javac compile flags, I see the -g:none flag. If this flag is set, would this be enough to explain why I'm not able to see line numbers? If so, why would someone do this, are there performance implications? Do I need to recompile the jar myself to attach the missing debug info (if possible)?

查看 javac 编译标志,我看到 -g:none 标志。如果设置了这个标志,这是否足以解释为什么我看不到行号?如果是这样,为什么有人会这样做,是否有性能影响?我是否需要自己重新编译 jar 以附加缺少的调试信息(如果可能)?

Thanks!

谢谢!

采纳答案by tangens

Looking at javac compile flags, I see the -g:none flag. If this flag is set, would this be enough to explain why I'm not able to see line numbers?

查看 javac 编译标志,我看到 -g:none 标志。如果设置了这个标志,这是否足以解释为什么我看不到行号?

Yes, that's the reason.

是的,就是这个原因。

If so, why would someone do this?

如果是这样,为什么有人要这样做?

Perhaps the author of the library wanted to make his jar as small as possible. The performance won't be very different if you compile without the -g:noneswitch.

也许图书馆的作者想让他的罐子尽可能小。如果不使用-g:noneswitch编译,性能不会有很大不同。

回答by Mark Peters

I would imagine there would be performance implications, but debug information will definitelymake your class files larger. So that's another motivation.

我想会有性能影响,但调试信息肯定会使您的类文件更大。所以这是另一个动机。

Also, companies that want to protect their source often won't compile in debug information to make disassembly (reverse engineering) less valuable to someone so motivated (this is the same reason some companies obfuscate their bytecode).

此外,想要保护其源代码的公司通常不会在调试信息中进行编译,以降低反汇编(逆向工程)对如此积极的人的价值(这与一些公司混淆其字节码的原因相同)。

Clearly if the source is available to you the above point is irrelevant. If the code is open source, you shouldn't have too much trouble compiling yourself the library (after all, every other contributor would need to be able to do that!). And yes, that is your best option at this point.

显然,如果您可以使用来源,则上述观点无关紧要。如果代码是开源的,那么您自己编译库应该不会有太多麻烦(毕竟,其他所有贡献者都需要能够做到这一点!)。是的,这是您目前最好的选择。