简体   繁体   English

java运行时库中的断点(rt.jar)

[英]Breakpoint in java runtime libraries (rt.jar)

Can we not put a breakpoint in the classes in rt.jar? 我们不能在rt.jar中的类中放置断点吗?

I am debugging something and I need to put a breakpoint in java.sql.DriverManager, but as soon as I put a breakpoint at some place, eclipse prompts me with the message 我正在调试某些东西,我需要在java.sql.DriverManager中放置一个断点,但是一旦我在某个地方放置了断点,eclipse就会提示我该消息

Unable to install breakpoint in java.sql.DriverManager due to missing line number attributes. Modify compiler options to generate line number attributes

Does this mean that java runtime classes were not compiled for debugging? 这是否意味着未编译Java运行时类以进行调试? If yes, then why would such a thing be done. 如果是,那么为什么会这样做呢。 Please help! 请帮忙!

Edit1: I am doing remote debugging, the actual web application is running in tomcat on a linux machine, I am on a windows machine. Edit1:我正在执行远程调试,实际的Web应用程序在linux机器上的tomcat中运行,而我在Windows机器上。 Which rt.jar is the culprit here, the one on my machine or the one on remote machine? 这里的罪魁祸首是哪台rt.jar,这是我机器上的元凶,还是远程机器上的罪魁祸首? And is it possible that rt.jar is not compiled with line numbers and other useful info? rt.jar是否可能没有使用行号和其他有用信息进行编译?

Edit2: The answers to this question has the details Locally declared variables can not be inspected Anyone knows why this is compiled without debugging symbols? Edit2:这个问题的答案有详细信息, 无法检查本地声明的变量任何人都知道为什么在没有调试符号的情况下编译它? How does it affect the performance to keep some metadata or is it something else? 保留一些元数据对性能有什么影响?还是其他?

If a class is not compiled with the debug switch (-g) you are not able to set breakpoints on a specific line. 如果未使用调试开关(-g)编译类,则无法在特定行上设置断点。

However, you can still set breakpoints on methods (in eclipse: set breakpoint on the first line which defines the method) even if the classes are not compiled for debugging. 但是,您仍然可以在方法上设置断点(在eclipse中:在定义方法的第一行上设置断点),即使这些类没有编译用于调试。

It is most likely you will not have access to local variables and you are not seeing in which line you step through the code. 您很可能无法访问本地变量,并且您没有看到您在代码中单步执行的行。 This makes debugging a little bit harder, but you are able to still see what's going on (eg examine the method argument values), especially if you know the underlying source code. 这使得调试变得更加困难,但是你仍然可以看到发生了什么(例如检查方法参数值),特别是如果你知道底层的源代码。

But I am wondering that your rt.jar is not compiled with debugging information. 但我想知道您的rt.jar是否未使用调试信息进行编译。

Thats an eclipse setting. 这是一个日食环境。 As clear by error message too 2nd Option checked in Classfiel Generation 通过错误消息也可以清除Classfiel Generation中检查了第二个选项

Go to Preference 转到偏好 Classfiel Generation中选中的第二个选项

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

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