为什么我的 Eclipse 项目有幻像调试器断点? [英] Why does my Eclipse project have phantom debugger breakpoints?

查看:29
本文介绍了为什么我的 Eclipse 项目有幻像调试器断点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小项目,当在 Eclipse 调试器中运行时,它似乎总是停在 FileInputStream.class 的第 106 行,在那里打开文件.没有设置断点,但 Eclipse 的行为就像我在这里设置了断点一样.如果我清除所有断点,它仍然会发生.

我在同一个 Eclipse 工作区中有第二个更大的项目,它没有遇到这个问题.

我刚刚将较小的项目从我在 Europa Eclipse 中开发并遇到此问题的旧 Linux 机器上移到我的新 Windows 机器上,在那里我继续在 Ganymede Eclipse 中看到问题.该问题跨操作系统和跨 Eclipse 版本仍然存在,但显然不是跨项目.我不明白!我搜索了该项目目录中的每个文件,但找不到任何可能以某种方式指示 Eclipse 停止在 FileInputStream 中的文件.

更多信息:明显的断点实际上不是针对 FileInputStream 的第 106 行;它似乎是 FileNotFoundException 的异常断点,是从 FileInputStream 中该行调用的本机代码抛出的.但同样,我似乎根本没有设置任何断点.异常断点是否在其他地方定义?

解决方案

您是否尝试取消选择

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

?(如 ,当断点对象层次结构已被剥离.

<块引用>

为了设置断点,使用旧 API,客户端需要 Java 模型对象 - 例如 ITypeIField
使用新 API,调试模型所需的只是类型名称、字段名称等.

这允许客户端在 Java 模型对象不可用时设置断点.
客户端现在指定要与断点关联的资源(在我们将其限制为关联的 Java 模型资源之前).

断点现在也可以隐藏".也就是说,它们不需要在断点管理器中注册.
断点也可以有选择地保留(标记只允许保留所有/全部标记类型).
这使得调试模型更加灵活,并为客户提供更多构建块.

这也简化了我们的 Java 调试实现的某些部分 - 例如,功能暂停任何未捕获的异常",只需为名为的类型设置断点java.lang.Throwable",而不是特定项目中的特定IType.
断点未在断点管理器中注册(即隐藏) - 只有一个客户端知道和使用它.
另一个例子是run to line breakpoint".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.

这篇关于为什么我的 Eclipse 项目有幻像调试器断点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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