如何从Intellij IDEA中删除(幻影)指向旧/缺少源的断点? [英] How to remove (phantom) breakpoints pointing to old/missing source from Intellij IDEA?

查看:228
本文介绍了如何从Intellij IDEA中删除(幻影)指向旧/缺少源的断点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Intellij(v14和now v15)我已经设置断点来调试来自Tomcat 7+中运行的Web应用程序的外部依赖关系(通常是快照版本)的尚未发布的类。



将外部依赖关系更改为已发布版本,重新编译项目并以调试模式运行;即使断点列表视图中不存在断点(从菜单:运行>断点),IntelliJ仍然停止旧类断点处的执行。



我尝试了以下内容:




  • 在启动应用程序之前,清理并重建所有工件,以确保部署的应用程序具有更新的依赖关系。 li>
  • 运行无效的缓存/重新启动功能,这将清除我心爱的文件更改历史记录,但不会显示这些断点。

  • 删除所有断点:(它清除当前有效的断点,但不显示幻影断点,因为它们不在当前列表中)



唯一适用于我的工具是重新附加确切的旧源代码(可能的话)查找受影响的类,并从中删除断点。



清除这些幻影断点有什么不方便吗?

解决方案

免责声明:这可能是最适合作为评论,但不符合有限数量的字符。



< hr />

很好!我从来没有这个问题,但我设法通过切换JDK版本来重现它。我从JDK8开始打开 java.io.File ,并在276行设置一个断点:

 throw new NullPointerException(); 
}
this.path = fs.normalize(pathname);
this.prefixLength = fs.prefixLength(this.path);
}

然后我切换到JDK6,它有一个简单的右括号(} )。但是,当按下 CTRL + SHIFT + F8 (windows)时,断点可用,但具有旧源文件的描述: p>



这让我想,所以我试图找出哪里断点被存储,结果它们在< project root> /。idea / workspace.xml < component name = XDebuggerManager> 部分:

 < component name = XDebuggerManager> 
<断点管理器>
<断点>
...
< line-breakpoint enabled =truetype =java-line>
< url> jar:// C:/ Program Files / Java / jdk1.8.0_45 / src.zip!/java/io/File.java< / url>
< line> 275< / line>
< properties />
< option name =timeStampvalue =4/>
< / line-breakpoint>
< / breakpoints>
...

所以看起来它保留对初始文件的引用。我不知道在使用maven,gradle等的情况下,是否会在列表中出现断点,在这种情况下,您可以轻松地从本地回购引用您旧的jar的路径,但在这一点上不要以为这很重要。



快速解决方法(也许?!):尽管如此,如果您手动删除 / em>断点从xml并保存文件,IJ将自动接收更改,并更新设置。至少在这样做之后,断点不再出现在我的列表中。



在他们的跟踪器上快速搜索显示这个问题影响v14.1.1(我目前在14.1.6),似乎还没有修复,所以我想我们会只需要等到它固定(不知何故,因为现在我不能想到一个简单/体面的方式)。


Using Intellij (v14 and now v15) I have put breakpoints to debug no-yet released classes coming from an external dependency (usually a snapshot version) for a web app running in Tomcat 7+.

when I change that external dependency to a released version, recompile the project and run in debug mode; IntelliJ still halts the execution at the old class breakpoint even though the breakpoint no longer exists in the breakpoint list view (from menu: Run > Breakpoints).

I have tried the following:

  • Clean and rebuild all artifacts before launching the app to make sure the deployed apps have the updated dependencies.
  • Run the "Invalidated Caches / Restart" feature, which clear my beloved file change history but not these breakpoints.
  • Remove all breakpoints: (which clear the current valid breakpoints but not the phantom breakpoints since they are not in the current list)

The only thing that has worked for me, is to re-attach the exact old source jar (whenever possible) look for the affected class and remove the breakpoint from there.

Is there any less inconvenient way to clear these phantom breakpoints?

解决方案

Disclaimer: This is perhaps best suited as a comment but does not fit the limited number of chars.


Nice catch! I never had this problem before but I managed to reproduce it by switching the JDK version. I simply opened java.io.File from JDK8 and set a breakpoint on line 276:

public File(String pathname) {
    if (pathname == null) { // <= breakpoint here
        throw new NullPointerException();
    }
    this.path = fs.normalize(pathname);
    this.prefixLength = fs.prefixLength(this.path);
}

Then I switched to JDK6 which has a simple right-curly-bracket ( } ) on that line. However, when pressing CTRL+SHIFT+F8 (windows) the breakpoint IS available, but has the description of the old source file:

This got me thinking, so I tried to figure out where the breakpoints are stored, and it turns out they're in <project root>/.idea/workspace.xml under the <component name="XDebuggerManager"> section:

<component name="XDebuggerManager">
    <breakpoint-manager>
      <breakpoints>
        ...
        <line-breakpoint enabled="true" type="java-line">
          <url>jar://C:/Program Files/Java/jdk1.8.0_45/src.zip!/java/io/File.java</url>
          <line>275</line>
          <properties />
          <option name="timeStamp" value="4" />
        </line-breakpoint>
      </breakpoints>
      ...

So it looks like it keeps a reference to the initial file. I'm not sure whether the breakpoints would still appear in the list when you're using maven, gradle, etc, case in which it would be easy to reference the path to your old jar from the local repo, but at this point I don't think it matters anyway.

Quick workaround (maybe?!): Nonetheless, if you manually remove the phantom breakpoint from the xml and save the file, IJ will automatically pick up the change, and update the setting. At the minimum after doing it, the breakpoint no longer appeared in my list.

A quick search on their tracker revealed this issue affecting v14.1.1 (I'm currently on 14.1.6) which seems to not be fixed yet, so I guess we'll just have to wait until it gets fixed (somehow, because right now I can't think of a simple/decent way).

这篇关于如何从Intellij IDEA中删除(幻影)指向旧/缺少源的断点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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