且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为什么我的Eclipse项目有幻影调试器断点?

更新时间:2023-09-18 23:06:46

您是否尝试取消选择

 窗口>首选项> Java>调试:暂停执行未捕获的异常

? (如已被剥离


为了设置断点,使用旧的API,客户端需要Java模型对象 - 例如 IType IField 等。

使用新的API,调试模型所需的所有内容都是类型名称,字段名称等。



当Java模型对象不可用时,这允许客户端设置断点。

客户端现在指定将断点与(在我们限制到相关的Java模型资源之前)。



断点现在也可以是隐藏。也就是说,它们不需要在断点管理器中注册。

还可以选择性地保留断点(只允许所有标记/标记类型不保留)。

使调试模型更加灵活,并为客户提供更多的构建块。



这也简化了我们的Java调试实现的一些部分 - 例如,功能暂停任何未捕获的异常,只需为名为 java.lang.Throwable 的类型设置断点,而不是特定的 IType 在特定的项目中

断点未注册到断点管理器(即隐藏) - 它只是已知和使用一个客户端

另一个例子是运行到线路断点 IJavaRunToLineBreakpoint 已被删除,因为不再需要其特殊功能。现在,Java调试ui只是创建一个隐藏的,不持续的断点,并且命中数为1.这是向客户端提供构建块的一个例子。



I've got a small project which, when run in the Eclipse debugger, always seems to stop in FileInputStream.class line 106, where files are opened. There are no breakpoints set, but Eclipse behaves exactly as if I have a breakpoint here. If I clear all breakpoints, it still happens.

I have a second much-larger project in the same Eclipse workspace which does not suffer from this problem.

I just moved the smaller project off of my old Linux machine, where I developed it in Europa Eclipse and had this problem, onto my new Windows machine, where I continue to see the problem in Ganymede Eclipse. The problem persists across operating systems and across Eclipse versions, yet apparently not across projects. I don't get it! I grepped through every file in this project's directory and couldn't find anything that might be a file somehow directing Eclipse to stop in FileInputStream.

Further info: the apparent breakpoint is actually not for line 106 of FileInputStream; it appears to be an Exception breakpoint for FileNotFoundException, being thrown from native code called from that line in FileInputStream. But again, I don't appear to have any breakpoints set at all. Are Exception breakpoints defined somewhere else?

Did you try to un-select

Window > Preferences > Java > Debug : Suspend execution on uncaught exceptions

? (as mentioned in this thread, for instance)

Why does Eclipse work that way?

It goes back to 2002, when the breakpoint object hierarchy has been stripped down.

In order to set a breakpoint, with the old API, a client required Java Model Objects - such as IType, IField, etc.
With the new API, all that is required by the debug model is type names, field names, etc.

This allows clients to set breakpoints when Java Model Objects are not available.
Clients now specify the resource to associate a breakpoint with (before we constrained it to the associated Java Model resources).

Breakpoints can now also be "hidden". That is, they need not be registered with the breakpoint manager.
Breakpoints can also be selectively persisted (markers only allowed all/none of a marker type to be persisted).
This makes the debug model more flexible, and gives clients more building blocks.

This has also simplified some part of our Java debug implementation - for example, the feature "suspend on any uncaught exception", simply sets a breakpoint for the type named "java.lang.Throwable", rather than a specific IType in a specific project.
The breakpoint is not registered with the breakpoint manager (i.e. hidden) - it is only known and used by one client.
Another example is the "run to line breakpoint". The IJavaRunToLineBreakpoint has been removed, as its special functionality is no longer required. Now, the Java debug ui simply creates a "line breakpoint" that is hidden, non persisted, and has a hit count of 1. This is an example of providing building blocks to clients.